yashsingh1/xdaforums huggingface dataset:
[Samsung Galaxy Nexus] highvista:
I'd suggest searching the Web and xda-dev for information on setting up a development environment for kernel building. There's much more complete information available than I'd be able to provide here.

The source code at GitHub is pretty old, as far as I know. It was set up by someone else who I don't believe is still working with it. So I'd set up your environment from the current Google source code tree for the 4.2.2 kernel and then replace the stock files with the modified ones from the ZIP archive.

---------- Post added at 01:23 PM ---------- Previous post was at 01:20 PM ----------

This kernel only tweaks the code for USB OTG charging, so any other functionality would be the same as in the stock kernel.
[Samsung Galaxy Nexus] mthous01:
Unless you use the source for a custom kernel with all the bells and whistles you want. Then you can change these files and build your own kernel with otg charging capabilities baked in.
[Samsung Galaxy Nexus] CriticalComposer:
Is there any chance this kernel could be ported over to the Toroplus Sprint GNex? If not, would using the one of the others work? I'm thinking the mysid is the closest to the Toroplus but I also know that even the slightest discrepancy could cause my phone to stop booting.
[Samsung Galaxy Nexus] highvista:
I'm no longer working on this kernel, but if someone wants to port it to your version of the Galaxy Nexus, it should be possible. I don't think any of the posted kernels would work without modification.
[Samsung Galaxy Nexus] CriticalComposer:
Thanks for the quick reply. How difficult would it be to port? I have little experience in modifying Android files but am willing to take a shot at it.
[Samsung Galaxy Nexus] highvista:
There's a lot of good information out there on building kernels for Android, so with research and a computer set up with the proper tools, it's not too hard.

Good luck!
[Samsung Galaxy Nexus] mthous01:
Most custom kernels for the GN are universal. Get the source code from the OP of the kernel you want, then add the patch and build away.
[Samsung Galaxy Nexus] redger_au:
I have created a new boot.img for Android 4.3, Maguro Yakju, including the Journeyman patches

with thanks to HighVista and Rotary Heart

If I could work out how to add an attachment I'd post it here, just in case it's of use to someone else :(
[Samsung Galaxy Nexus] caioketo:
I'm gonna see today if the Provider of my Company got any powered usb hub, probably yes, and if so, i'll order, and it get delivery today, so I'll be able to test it today.
[Samsung Galaxy Nexus] caioketo:
What about these cables?

http://www.ebay.com/itm/190710044655
[Samsung Galaxy Nexus] Rotary Heart:
Wow! That looks promising. That was exactly what I was looking. Maybe I can give it a try.

EDIT: Well if the description is well writed, it looks like I will not be able to connect usb flash stick and chargephone. Or did I read wrong?
[Samsung Galaxy Nexus] AshtonTS:
That's sorta the reverse of what the OP is asking.....
[Samsung Galaxy Nexus] ttabbal:
Looks like something that might be worth a try. They don't give tech details, but the plugs are the right types and the description looks right.. Will take a while, shipping direct from China.
[Samsung Galaxy Nexus] caioketo:
You read right, at least is what it is saying, i want to give a try, but my international card didnt arrive yet, so I can't buy it =/

Maybe tomorrow, or monday ill try it!
[Samsung Galaxy Nexus] highvista:
I have all the parts on order to give this a try. Some are coming from China, so it might be a while. I'll report back here if this works. My fingers are crossed! :)
[Samsung Galaxy Nexus] SkOrPn:
What about this?

http://www.ebay.com/itm/Micro-USB-H...524313?pt=PDA_Accessories&hash=item1e70be1519

Seems to allow an OTG device to connect to flash drives and at the same time use your standard devices micro usb charger to provide the power. If your charger has a descent amp rating you could move up to standard hdd storage devices etc. However, I like the idea of using a high amperage USB HUB as the power source, 4 AMP minimum (like my USB 3.0 hub is).
[Samsung Galaxy Nexus] Rotary Heart:
I order one. If it doesn't work well it was just 5 bucks. (My powered hub is still in transit...)

Dang why didn't i read this before buying the other one... Well if the other one don't work I will try this one since it say that it will work.
[Samsung Galaxy Nexus] caioketo:
In the description it says that the female micro USB is for powering the external drives, so prob, it wont charge the phone.

I'm not sure, so, need to tests.

I didnt recieve my international card yet, so i think you guys will test b4 me, wich is good so I'll know wich one will work.

But, if I got my card b4 u can test it, i'll buy one of each and sees wich one will work.

ps. My powered hub arrived here, but without the cable i can't test it =/
[Samsung Galaxy Nexus] SkOrPn:
Well I do not believe that is how it works. Pin 1 is the 5v supply, so no matter how they wire it pin 1 will have a 5v supply which will make its way back to the OTG device and external devices. So depending on the amount of amp we are talking about if the external device is not using 100% of the supply, then the remaining will be available for the OTG device to use as it see's fit. Now with that said, this does not mean the OTG device will go into charge mode, but I see no reason why it wouldn't.

Example, if your flash drive is using less than 500 ma, and you are using a 2 AMP power supply/charger, then the remaining 1.5 AMP should be used by the OTG device (phone) for charging.
[Samsung Galaxy Nexus] highvista:
Given the previous posts in the thread on how to activate charge mode, this cable will have to have a 124K resistor tied between the ID/sense pin (pin 4) and ground (pin 5) in the male microUSB connector that goes into the phone. If that's the case, it should charge the phone while also being in USB OTG mode. Please let us know how this cable works out! :)
[Samsung Galaxy Nexus] ttabbal:
I tested with a powered hub and a simple memory stick. The hub has a 2 amp supply. The nexus didn't go into charge mode, though the stick did mount.

It seems the nexus might be picky about charge mode, the USB spec does seem to imply that it should be picky... I wonder if other devices just sense that there is power available and use it. If I had a way to connect it up, I'd try the resistor thing. My otg cable is molded, so I can't really take it apart...
[Samsung Galaxy Nexus] SkOrPn:
I am wondering about my NS as well. I do not have enough materials in stock to build this cable at present and I gave away my only OTG cable to my brother, lol... Oh well....
[Samsung Galaxy Nexus] caioketo:
I ordered my cable from ebay, now is waiting and test...

as soon as I test it i'll put here all my tests!
[Samsung Galaxy Nexus] Rotary Heart:
Mine is almost here, is amazing that it will arrive first than the powered hub :/
[Samsung Galaxy Nexus] highvista:
I made my first attempt at adding a 124K resistor to sense/ID pin 4, as described previously in the thread. I have a USB hub with a hard-wired microUSB cable meant to be attached to a phone. I cut off the microUSB connector and wired in a new one with the resistor in place. Unfortunately, it didn't work at all with my Galaxy Nexus, not even initiating a charge. And I regrettably didn't verify how it worked before making the modification, so I can't compare before and after. It's interesting that when I connect my old Nexus One or another microUSB-chargeable device to it, charging begins. And I can't guarantee that my soldering job for the connector doesn't have any shorts. It looks clean, but I'm new to doing such detailed soldering work.

I'm still waiting for a batch of USB OTG cables from China to make my next attempt at a mod. I'll replace the OTG-wired microUSB connector on one of these with a new one wired with the 124K resistor and attach my phone via this to a generic powered USB hub and see what happens. I have verified that using an unmodified USB OTG cable with this hub allows me to mount an attached USB flash drive but not charge the phone at the same time, as expected from past experimentation. Hopefully, the modded cable will enable charging.

I'll report back when I've given this a try.
[Samsung Galaxy Nexus] highvista:
I received this cable yesterday and tried it out. Unfortunately, it doesn't charge my GN at all when attached to both the phone and a power source. It does act as a proper USB OTG cable when a flash drive is attached, but no charging takes place.

I tried attaching it to my Nexus One just to see what would happen, and it does charge it. So something about the cable tells the Galaxy Nexus that it shouldn't go into charge mode. Interesting, though not very helpful.
[Samsung Galaxy Nexus] caioketo:
So still no way to charge the phone while OTG working??? thats some bad news.
[Samsung Galaxy Nexus] Rotary Heart:
Ok I got my cable today. When I connect the flash drive it reads it, but if I connect it to wall it doesn't charge so this is what I have tried.

-Connect it the way it supposed to go-----Didn't work

-Connect the USB cord to wall and then connect a USB to micro USB from phone to female USB------It charge, but don't read flash drive

So I decided to cut it all and see what's going on inside, and found that the micro USB don't have any resistor. I remembered the post of the resistor so I cut one of my wall chargers and found that that one HAVE a resistor.

I'm sure that if I add a resistor it will charge. But I can't try that right now since I can't find my "thing" (Don't know its name) to make my welding... will try soon when I have time to buy one.
[Samsung Galaxy Nexus] caioketo:
So, the cable dont do anything especial? we still need to cut it to put a resistor, and wish it will charge?
[Samsung Galaxy Nexus] Rotary Heart:
Lol yes, but the interest thing is that if I connect it with my frinds SII it charges :confused: it doens't read flash drive, but even if I connect the flash drive directly it doesn't read it. Also if I connect my phone, flash drive and my friends SII it charge my friends phone!!! :confused:
[Samsung Galaxy Nexus] caioketo:
Have you tried to connect a powered usb hub? to try to read the flash and charge?

You have installed the stickyUSB app to be able to read external drivers?
[Samsung Galaxy Nexus] Rotary Heart:
No my powered hub haven't arrived, yes I do have sticky mounton my Nexus
[Samsung Galaxy Nexus] caioketo:
Maybe, just maybe, with the powered hub would work, as it will go data and charge into the same cable (female USB)
[Samsung Galaxy Nexus] HinotoriBR:
I believe this is not possible... At least with the type of connector that GN uses (perhaps the one in Galaxy SIII, that has extra pins to use MHL and USB OTG at the same time allow this).

Once the phone port is in OTG mode, it will not try to drawn power from +5V and GND USB connections, instead, it will source power to those connections, so the USB device get powered up. No matter if a device is self powered (like a powered USB Hub), it has to source power in those two pins, it can't drawn power from them...

So, the closest you might get to is to lessen the power drain by using a powered USB hub (so the hub and any USB devices you use don't drawn power from the phone, but, from the HUB power source)...

Perhaps, with the landscape desk dock, that uses the pogo pins to charge the phone, that might be possible, not sure about that, might be something worth trying...
[Samsung Galaxy Nexus] Rotary Heart:
I didn't even know that we can charge it with the pogo pins... will read how it works and study it, will try to make one and report back (It will take me some time) I have look some different pics and threads and it doesn't look hard.
[Samsung Galaxy Nexus] caioketo:
I am wondering, if is there anyway to make it via software, like an app to tell the phone should charge via POGO PINS, while OTG connected.

---------- Post added at 12:22 PM ---------- Previous post was at 12:12 PM ----------

So i was looking, and I found one forum where the guys said this:

"The Galaxy Nexus OTG kernel code does not evaluate a single resistor. So no Battery Charging Spec implemented here.

However, I was able to modify this kernel to make it accept a charge while in OTG host mode. A Y-cable is connecting my phone to a powered USB hub. The hub has a USB-to-Ethernet dongle, connected to a router. The hub is also powering the Gnex via the other end of the Y-cable. The phone can now, say, act as a WiFi access point (wired + 3G!) and it's battery level will never drop below 100% or 99%. One disadvantage: in a real on-the-go situation, this kernel will not anymore power slave devices. One could fix this by allowing the user to switch between OTG host mode charge-out (default) vs. OTG host mode charge-in. Should be possible with the N7 as well."

So maybe, we will need to edit the kernel to work properly.
[Samsung Galaxy Nexus] highvista:
I've tried using the landscape dock and USB OTG at the the same time. I cut a slot in my dock to allow access to the USB port. Unfortunately, it didn't work. You can charge or engage USB OTG, but not both at the same time. A real bummer. :(
[Samsung Galaxy Nexus] ttabbal:
I suspect the pogo pins connect to the same place as the usb power. So a kernel mod like the usb fast charge mod might be needed. How stupid. Can you ask that guy for the patch or a git repo? Get me the mod he used and I'll make a configurable version and send it to the kernel devs. I've done kernel dev for other phones, but don't really have time to chase down the right spot right now.
[Samsung Galaxy Nexus] Rotary Heart:
If you cloud do this, it will be awesome. If its kernel related then there's nothing I can do. I haven't studied how kernels works...
[Samsung Galaxy Nexus] caioketo:
Prob is kernel related, but prob again, we can talk to cm devs so they can fix it in the cm kernel, and everyone will be happy! xD
[Samsung Galaxy Nexus] markj_2222:
Its possible

It is kernel related. The Gnex uses rules in the boot loader to decide if its a slave or a host. I have been able to mess around a little and get it to stop putting out power to the device in slave mode using buddy's code, but to actually make it toggle into charge mode while otg is out of my skill range atm.

It is possible.

It is in the kernel

How do we proceed from here?

Also i've scene youtube video's with this done on the i9300 but can't find code or anything.

I'm sure many would love a toggle feature in CM10. Soon...
[Samsung Galaxy Nexus] jonnyg1097:
Can you post the video? I would love to see this in action.
[Samsung Galaxy Nexus] markj_2222:
watch?v=RtWHVx6zRQM

1:50

kinda pulling at strings here but if it is just a stock s3 then technically it should just be mhl+otg+charger into this spider laptop
[Samsung Galaxy Nexus] caioketo:
In this link the guy made the modifications and explained how it will work.

if you want to take a look, it have a github with modifications.

http://rootzwiki.com/topic/30615-can-you-charge-usb-host-mode-simultaneously/page__st__20
[Samsung Galaxy Nexus] ttabbal:
Thanks for the link. I'm pretty sure I can make a version of this that lets you toggle it like the usb fast charge if there is interest.
[Samsung Galaxy Nexus] Rotary Heart:
Well you can bet that I'm interested :highfive: :good:, actually if I could do it (know how to build/modify kernels) I would do it, but that's out of my dev kills atm...
[Samsung Galaxy Nexus] caioketo:
I would do that if I knew how, but i'm out of time to learn it, so, if you can do it, it will be very good for a lot of people.

I'm pretty sure that if you talk with cm devs, prob they will let the modifications in the cm kernel.

Thanks in advanced.
[Samsung Galaxy Nexus] highvista:
I would be extremely interested, either if it was a standalone kernel or part of CM10. From reading the rootzwiki thread, it sounds like my hopes of implementing the resister mod to a USB OTG cable to enable charging have been dashed, since the stock kernel doesn't check for the resistance level on sense pin 4. So without this kernel mod, we're pretty much out of luck.
[Samsung Galaxy Nexus] caioketo:
I think that if the kernel is moded like the guy did in rootzwiki, you wont need the resistor, just enable it, and connect an otg cable (Y one) with the 2 conectors in the powered hub, one for the OTG, the other to recieve charging from p-hub
[Samsung Galaxy Nexus] highvista:
That's how I read it, as well. In the meantime, I'm going to try building an AOSP-based kernel with the code mod from rootzwiki and see how it works. But having it in a kernel with an enable/disable toggle will be much better, since with my time and knowledge, I won't be able to do anything more than build in the disable for testing purposes.
[Samsung Galaxy Nexus] markj_2222:
Well I picked up a few books on C and a basic risk processor all for $32

Was able to make the led blink in changing intervals.

I'll be able to do this, in ~ two years
[Samsung Galaxy Nexus] caioketo:
if its possible to make a software toggle, it would be much better than a resistor toggle, couse any otg cable should work.
[Samsung Galaxy Nexus] standardtoasters:
I haven't done this but I would experiment with these parts:

- Male micro USB to female USB adapter (male Micro USB B to female USB A adapter)

- USB hub/splitter

- Male USB to female micro USB adapters (male USB A to female micro USB B adapter)

If I try this one of these days, I'll post up my experiences. Good luck!
[Samsung Galaxy Nexus] highvista:
Thanks for the ideas, but these have pretty much all been tried. The way the Galaxy Nexus implements USB OTG won't allow them to work. The current best hope is a change to the phone's operating system software (the kernel code) that a couple of us hope to try soon. Along with a USB OTG "Y" cable described earlier in the thread, this has a good chance of working
[Samsung Galaxy Nexus] scar45:
I would love to have the ability to toggle USB OTG charging on/off with a Y-cable! I have just started to play around with OTG on my maguro with AOKP JB b3 + faux123's latest kernel. It works great, but the drawback is surely not being able to power both devices. My plan was to use binds to map the /storage/sdcard0/Android/data/{{game_data_folders_that_are_+1gb_in_size_nowadays}} folders to my usbdisk. It works, but playing the games consumes massive cpu usage AND the USB I/O + device power that kills the battery fast.

I have talked with faux123 on freenode before, so I will send him a query and see what his thoughts are. Hoping the kernel dev community can get to the bottom of this one. It quickly becomes obvious after toying around with OTG that this functionality is highly desired!
[Samsung Galaxy Nexus] highvista:
I finally managed to set up a kernel build environment and built a stock kernel for the GN last night. I'm going to try installing it this weekend and see if it works. If so, I'll make the code change that should enable the Y-cable to charge the phone while USB OTG is engaged. I'll report back when I have some results!
[Samsung Galaxy Nexus] Rotary Heart:
I will be waiting for it :)
[Samsung Galaxy Nexus] caioketo:
This is very good to hear, but I need yakju build =/
[Samsung Galaxy Nexus] highvista:
Do you have a Nandroid backup of your phone? If you can post the "boot.img" file from that backup, I can use it to create a yakju boot image file. The same goes for any other of the GN variants. I'd also like to get the full details on your phone, such as the radio version, so I could include this information in the zip file I create for the boot image. Check out the README.txt in the current zip file for what info I'm looking for. Or just take a look at my sig and include that information. Hope that helps!

---------- Post added at 05:51 AM ---------- Previous post was at 05:36 AM ----------

I just realized I can download the stock ROM for yakju and should be able to use the boot image in that to create a boot image for yakju. I'll give it a shot and post it in a little while if it works out.

---------- Post added at 06:41 AM ---------- Previous post was at 06:40 AM ----------

I've posted a yakju build in my original post, along with the takju build. If you try it out, please let me know how it goes, since I can't test it.
[Samsung Galaxy Nexus] Rotary Heart:
I will need to try this when I get back home!!
[Samsung Galaxy Nexus] scar45:
That was quick! :) Thanks for the efforts highvista. I am waiting for my Y-cable to be delivered from Asia, so I will be testing as soon as it comes (could be quite a while though!).
[Samsung Galaxy Nexus] @rbiter:
Shouldn't this work with a hub too?

...
[Samsung Galaxy Nexus] highvista:
I tried plugging in my flash drive to a USB hub and then attaching my phone to a standard USB OTG cable, which was connected to another USB cable going into the hub. This didn't work. I've also tried plugging my phone into the hub directly via a standard USB cable, also without success. I would have throught the hub would work, as well. It could be one would need a USB OTG cable with the right connector straight into the hub.
[Samsung Galaxy Nexus] edgebond:
U mentioned a usb to micro usb adapter... Where do u get that? Amazon?
[Samsung Galaxy Nexus] caioketo:
First thanks for yakju build, I cant test it yet since my cable didnt arrive yet.

Now, for the hub, the cable that comes from the hub you connect in the connector that you plug the power, and it should work, I'll try that out when my cable arrives.

But thanks for all.
[Samsung Galaxy Nexus] caioketo:
Quick question, you think that this will work with MHL cable too? Or it will need more kernel modifications? Is it even possible?
[Samsung Galaxy Nexus] highvista:
I don't think it'll work with MHL as is, since MHL seems to be handled differently in the kernel code than USB OTG. It may be possible, but I don't know enough about how MHL works to be qualified to give a solid answer.

---------- Post added at 08:46 PM ---------- Previous post was at 08:43 PM ----------

It looks like I've figured out how to tweak the kernel code just a bit more to enable battery charging as well as powering the phone and external USB device. The phone shows that it's charging, and I watched the charge level jump from 98% to 99% a few minutes ago.

I'm going to try this new kernel out for a day or so and will post new boot images if all goes well.
[Samsung Galaxy Nexus] Rotary Heart:
This is getting better :P
[Samsung Galaxy Nexus] subvertz:
Rotary Heart, now that this has become an active project, maybe we could change the name of this thread to something like "OTG + charge project" so it doesn't get lost in the fog of worthless screen protector threads...

Oh, and I volunteer to test the kernel. Got OTG, powered usb hub, peripherals, MHL, pogo charging capabilities...
[Samsung Galaxy Nexus] Rotary Heart:
Ooo you are right, I forgot I was the OP. Thanks for the suggestion!
[Samsung Galaxy Nexus] Rotary Heart:
I added the attachment to the first page so it's easier to find them.
[Samsung Galaxy Nexus] caioketo:
so can you giv me some tutorial to create a build envoriment in windows, if its possible, so I can modify the kernel and try to enable it working with the MHL too, it would be fantastic to have the power to enable Charge + OTG + MHL working at the same time.

---------- Post added at 11:04 AM ---------- Previous post was at 10:44 AM ----------

What about to open an freenode irc channel to discuss the changes and exchange information about the kernel? So we can together mod it to work with all the functions we want, like OTG + MHL and more

I'm installing ubuntu under my windows, so I can have dual boot and use ubuntu to modify and edit kernel, so I'll be able to help you out with the modifications!

And I think it would be good to create an github repo for this project.