• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[Important] USB OTG / USB2Go - host mode for Nexus 4?

Search This thread

iwasblown

Senior Member
Sep 7, 2010
1,019
63
The host isn't powered by the battery.

Sent from my SGH-T959 using xda premium

---------- Post added at 08:15 AM ---------- Previous post was at 08:14 AM ----------

It is working off of an external power supply.

Sent from my SGH-T959 using xda premium

---------- Post added at 08:16 AM ---------- Previous post was at 08:15 AM ----------

Turn around the connection.

Sent from my SGH-T959 using xda premium
 

myself11

Senior Member
Oct 11, 2009
1,753
813
I don't have a Nexus 4, but I've been searching about MYDP technology the last couple of days due to the launch of Fonepad Infinity (without micro-sd slot).

I don't know if this info has been posted before, but there seems to be an accessory - even though not released yet AFAIK - that has Micro-USB to HDMI and Micro-USB Y-Dongle. And also a dock. Maybe it will allow usb otg.

http://www.analogix.com/markets/partners.html

 

ziddey

Senior Member
Aug 26, 2007
1,816
1,563
See http://forum.xda-developers.com/showthread.php?t=2151159

Got it sort of working, but you need a Y cable and have to switch it on manually. I'm still trying to figure out how to get it to work with regular usb mode at the same time.

I've been trying to go from here but am really in over my head. I've been able to compile Franco's kernel with otg debug mode (CaptainMuon's method -- "otg_user_control"). It'd be fine, but there are problems with this approach-- seemingly when it goes to a_idle, it becomes stuck, and a reboot is needed for either host or peripheral.

Anyone have any ideas on otg_pmic_control? Or a reliable otg_user_control? I've tried setting that mode in board-mako.c, but then there is no /sys/kernel/debug/msm_otg altogether, and assumedly no otg.
 

ziddey

Senior Member
Aug 26, 2007
1,816
1,563
May be onto something. I noticed in board-mako.c that apt8064_ehci_host_init() is an empty function. Comparing with board-8064.c, I see:

Code:
static void __init apq8064_ehci_host_init(void)
{
        if (machine_is_apq8064_liquid() || machine_is_mpq8064_cdp() ||
                machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
                if (machine_is_apq8064_liquid())
                        msm_ehci_host_pdata3.dock_connect_irq =
                                        PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
                else
                        msm_ehci_host_pdata3.pmic_gpio_dp_irq =
                                                        PMIC_GPIO_DP_IRQ;

                apq8064_device_ehci_host3.dev.platform_data =
                                &msm_ehci_host_pdata3;
                platform_device_register(&apq8064_device_ehci_host3);

#ifdef CONFIG_USB_EHCI_MSM_HOST4
                apq8064_device_ehci_host4.dev.platform_data =
                                &msm_ehci_host_pdata4;
                platform_device_register(&apq8064_device_ehci_host4);
#endif
        }
}

I added the contents along with two definitions:
Code:
#define PMIC_GPIO_DP            27    /* PMIC GPIO for D+ change */
#define PMIC_GPIO_DP_IRQ        PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PMIC_GPIO_DP)

Gave it a compile, but it doesn't seem to have any effect.

Anyone?
 

ziddey

Senior Member
Aug 26, 2007
1,816
1,563
Spent a long time trying to figure out how to properly "debug/fix" OTG but was really in over my head, so I resorted to dirty hackjobs for now to provide a solution:

http://forum.xda-developers.com/showthread.php?p=38871971&postcount=159

Thank CaptainMuon for the original proof-of-concept. Without knowing it's possible, I wouldn't have considered fiddling with it. Thank Franco for the kernel that I used as a base.

Detects OTG cable and switches to host mode. On unplug, there's a 25-30s timer before it switches back to peripheral mode.

No /sys/kernel/debug/msm_otg/mode in this build. Will add it back in the next one.

Basically, host mode is triggered based on detection of a "specific" charger. During what's supposed to be the unpowering of the USB port, peripheral mode is triggered, in essence. Going to bed now. Will post exact code changes in msm_otg.c later tonight.

Works on CM10.1 and assumedly whatever else Franco's kernel works on (r93 is based on 4.2.2).

REQUIRES EXTERNAL POWER.

http://d-h.st/Oa0
 

kris2lee

New member
Mar 16, 2013
1
0
No love with Arduino, I guess?

This thread fills me with cold hate because I bought the Nexus 4 so I could play with Arduino and Android. I did not confirm it before from multiple sources because it is my first smart phone and I did read raving reviews about it and saw that it should support OTG.

This and lack of SD card that I too overlooked (hey, what sane person would have no SD card designed in?) makes it clear that this is done only by reason that Google wants to own our data by pushing it into cloud.

Anyway, can please somebody with more knowledge and understanding than me kindly point out what is the current situation?

It is a bit hard to confirm if

a) somebody has ever really managed to get USB host working on Nexus 4,
b) would it be possible to get it work with external power soure (kind of sucks but I could provide additional battery when I'm already on it),
c) would it be possible to get it work without external power soure,
d) probably no love from Google with this so rooting and custom kernel is nessesary?

I'm sorry, I could not root my Nexus because it already suddenly droped the charge from 95% to zero and when it does it again I will like to send it back and have warranty for it.
 

sga999

Senior Member
Mar 13, 2012
810
113
This thread fills me with cold hate because I bought the Nexus 4 so I could play with Arduino and Android. I did not confirm it before from multiple sources because it is my first smart phone and I did read raving reviews about it and saw that it should support OTG.

This and lack of SD card that I too overlooked (hey, what sane person would have no SD card designed in?) makes it clear that this is done only by reason that Google wants to own our data by pushing it into cloud.

Anyway, can please somebody with more knowledge and understanding than me kindly point out what is the current situation?

It is a bit hard to confirm if

a) somebody has ever really managed to get USB host working on Nexus 4,
b) would it be possible to get it work with external power soure (kind of sucks but I could provide additional battery when I'm already on it),
c) would it be possible to get it work without external power soure,
d) probably no love from Google with this so rooting and custom kernel is nessesary?

I'm sorry, I could not root my Nexus because it already suddenly droped the charge from 95% to zero and when it does it again I will like to send it back and have warranty for it.
See this thread.
http://forum.xda-developers.com/showthread.php?t=2181820

This method requires external power source. I have no idea if someone will come up with a way to do it without external power. Rooting and ziddey's custom kernel is required for this method.

EDIT: Actually, I'm not really sure if root is required. I don't know if the stock download mode and/or recovery allow flashing of the kernel or update.zip files. And I don't know if root is a requirement to install a custom recovery. I rooted and then installed twrp recovery, so I can't answer. Maybe someone else can chime in here.

For the manual vold.fstab change, ziddey says: "To create /system/etc/vold.fstab, execute as root" and then he gives the commands. So for this reason alone, maybe root is required.
 
Last edited:

crazzzik

Member
Feb 16, 2011
19
5
If someone manages to get it to working condition, I'll attempt modding my battery pack to include built in usb storage powered by unused usb port.
 

jazza_s

Senior Member
Jan 15, 2011
58
6
See this thread.
http://forum.xda-developers.com/showthread.php?t=2181820

This method requires external power source. I have no idea if someone will come up with a way to do it without external power. Rooting and ziddey's custom kernel is required for this method.

EDIT: Actually, I'm not really sure if root is required. I don't know if the stock download mode and/or recovery allow flashing of the kernel or update.zip files. And I don't know if root is a requirement to install a custom recovery. I rooted and then installed twrp recovery, so I can't answer. Maybe someone else can chime in here.

For the manual vold.fstab change, ziddey says: "To create /system/etc/vold.fstab, execute as root" and then he gives the commands. So for this reason alone, maybe root is required.

If there could be a dirty hack that used just a small battery or 9v battery as external power that'd be sick.
 

ritchea

Senior Member
Sep 6, 2011
829
173
okeechobee
It looks like a Galaxy Nexus to me. Maybe just me, but it just doesnt quite look like the Nexus 4 (Same same but different).

Definitely galaxy nexus. I own both. Both have working otg, but N4 is using y connector and power bank with ziddey's kernel mod. The y connector works on GNex as well as Nexus 7. The "power" cable is not needed but does keep a charge going on those devices as well as on the N4.

Sent from my Nexus 7 using Tapatalk 2
 

kamranhaghighi

Senior Member
Apr 8, 2012
952
34
22
Orgrimmar
well it doesn't support OTG anyay i mean almost no way but why don't u use es-explorer LAN to access files from pc or something?:D i do this for my fathers one as my phone is bricked at:D(i didn't do it i sold it to someone he bricked it! a noob programmer :D) and im going to buy this sacred piss of glass in 12 days after exam:D
i think they would be many other ways! to connect external storage i had an idea forgoted:( damn!
 

RussianBear

Recognized Contributor
Nov 10, 2008
2,016
328
well it doesn't support OTG anyay i mean almost no way but why don't u use es-explorer LAN to access files from pc or something?:D i do this for my fathers one as my phone is bricked at:D(i didn't do it i sold it to someone he bricked it! a noob programmer :D) and im going to buy this sacred piss of glass in 12 days after exam:D
i think they would be many other ways! to connect external storage i had an idea forgoted:( damn!

Chill, man. We have unofficial otg support. Check the dev section.
 

ziddey

Senior Member
Aug 26, 2007
1,816
1,563
If anyone is interested, it may be worth looking into flo's (N7 2013) kernel sources since it shares the essential hardware. While it's not likely to be able to have the N4 supply power, we may very well be able to make use of pin5 for proper otg detection. If that's achieved, I imagine a lot more devs would be interested in incorporating support since it won't be a hack anymore. Specifically, we'd need to look at at least msm_otg.c and board-flo, comparing to our board-mako. Not sure what else would be involved, but one issue with regards to pin5 detection on our devices involves slimport support which also uses that pin. Luckily, flo also has slimport and working otg.
 
  • Like
Reactions: SpasilliumNexus

punitthereddevil

Senior Member
Jun 26, 2012
675
112
Belgaum
Xiaomi Poco F3
Definitely galaxy nexus. I own both. Both have working otg, but N4 is using y connector and power bank with ziddey's kernel mod. The y connector works on GNex as well as Nexus 7. The "power" cable is not needed but does keep a charge going on those devices as well as on the N4.

Sent from my Nexus 7 using Tapatalk 2

Please check your PM... Thank you...

Sent from my Nexus 4 using XDA Premium 4 mobile app
 

Top Liked Posts

  • There are no posts matching your filters.
  • 13
    Answer from google

    Just got off of a long call with customer support. I pressed the issue until I got a firm answer. I was told that usb otg will be fixed and that it is a software issue. The rep stated that that was definitive and that they had just acknowledged the issue in the last 24 hours.
    13
    It appears to be a firmware issue, and the device *should* support it, according to somebody inside Google (not an official statement).

    If you want to get OTG support on the Nexus 4 fixed, please star the bugreport here: http://code.google.com/p/android/issues/detail?id=40087&colspec=ID Type Status Owner Summary Stars
    11
    using a OTG y cable is just completely un-convenient.

    Plus I don't want to be on a plane and have to pull out a multitude of devices and wires to consume my media and the guy next to me is worried for his life because it looks like I'm putting together an explosive.
    7
    Hi all...just a few comments to make on all of this.

    The USB host capabilities are part of the Qualcomm processor/chipset. The ones in the N4 support USB host mode.

    Snapdragon S4 Pro APQ8064: https://developer.qualcomm.com/discover/chipsets-and-modems/snapdragon

    The spec sheet lists USB OTG, but the way N4 is setup, it does not technically support OTG. I made a post not to long ago on a similar thread about USB OTG/host: http://forum.xda-developers.com/showthread.php?p=33618150#post33618150 and I mention that in order to be considered USB OTG (per the USB Consortium), the connector used needs to be of the type AB (micro AB) and if I remember correctly, charging is not allowed through the connector. I reference the Nokia N810 and N900 as examples of this...N810 was an actual USB OTG device because it had USB micro AB port and had separate charging jack. In order for USB host mode to work on N810 you needed an A type micro USB cable/dongle. The A type cables have an extra pin tied to ground (or something like that) and when plugging into device, it would automatically know to be a host versus a slave. But, there was a way to use a type B cable/dongle (what N4 and most every other phone/tablet has) for host mode purposes...but there was a software command that had to be run first before doing so.

    So, what I'm getting at is N4 is technically not an OTG device, but the hardware does support USB host capabilities and it might be possible to enable the capabilities in software (either through a command, most likely at root level, or worst case, a mod to the kernel and/or custom ROM).

    Key word is "might"...don't hold me to anything, but I tend to be more of an optimist. Hope this helps.
    5
    Yes the Nexus 4 supports usb OTG (and you probably won't need a custom kernel for this)
    Yes you can use ESFile explorer and run everything from your hard drive

    I think latest TWRP offer OTG support but I'll probably never use it since you may "brick" your phone if the flash fail and not sure if otg is perfectly stable...