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

OTG + charge project. Charge phone while using FLASH DRIVE

Search This thread

Rotary Heart

Senior Member
Aug 1, 2012
1,127
615
Just want to know for something like, connect a external storage and the other usb to charge the phone or something else and still have the other one to charge the phone.

Thanks

EDIT:
Well since this is getting into a project. I will be adding the info here.

New thread: http://forum.xda-developers.com/showthread.php?p=32618626#post32618626

New info

It looks like it works! Both the phone and my 64GB flash drive are being powered via a USB charger connected to a Y-cable. As far as I can tell, the phone battery isn't being charged and may still be draining a bit--this may depend on the current delivered by the USB charger. But I've been playing music for hours from an attached USB flash drive with my screen on and the battery level is still sitting at 98%.

I've attached ZIP files with a boot image containing the kernel. The yakju boot image was created by replacing the stock kernel in a Nandroid boot image obtained from the Galaxy Nexus described in my sig. The other boot images were created from the boot image included with the Google factory ROM. I can't test these, so use with caution. NOTE!!! Make sure you do a Nandroid backup of your phone before trying out the attached boot images. Things can go wrong and you want to be able to recover.

This was posted earlier in the thread, but credits for the kernel code tweak, along with details, go to the contributor to this thread

http://rootzwiki.com/topic/30615-can-you-charge-usb-host-mode-simultaneously/

Have fun! :)

10/09/12:

I've added two more ZIP files. These contain boot images with the code modded such that the phone battery is charged when using the Y-cable. NOTE: The phone will think it is being charged any time a USB OTG cable is connected. I haven't figured out a way around this yet. This doesn't really hurt anything, except if you have your phone set to stay on when charging, you could end up running down your battery! Important safety tip. :)

10/15/12:

I've replaced the previous ZIP files with two new ones. These contain boot images for takju and yakju JRO03C/4.1.1 that provide USB OTG+charging, with the added benefit that you can still use a standard USB OTG cable to connect an external device. As in the stock kernel, the phone will provide power for the external device. In other words, the new kernel in the ZIP archives auto-detects if there is a charger attached via a y-cable and uses it to power the external device and charge the phone, if it's found.

I've also fixed the problem where the phone would show a charging icon in the notification bar if a USB OTG cable was attached without any external device connected to it.

NOTE: THESE ZIP FILES ARE NOT MEANT TO BE FLASHED TO YOUR PHONE. These files contain a file called boot.img that can be flashed to your rooted phone from your computer via ADB with the commands

fastboot flash boot /path/to/<boot>.img
fastboot reboot

You can learn more about using fastboot at http://wiki.cyanogenmod.org/wiki/Fastboot.

12/28/12:

Version V4 is replacing V3. This new version fixes the bug where detaching external power from the USB OTG y-cable or USB hub wasn't detected by the phone. Now, when power is detached, the phone switches to battery power, including supplying battery power to any attached USB devices.

Note that the reverse is not true. If you connect external power when the phone and external USB devices are being powered by battery, the phone will continue to use battery power. The external power is not detected. When in doubt, disconnect and reconnect the USB OTG cable to cause the phone to recognize what's attached.

-----------------------------

12/28/12:

Version V4 is replacing V3. This new version fixes the bug where detaching external power from the USB OTG y-cable or USB hub wasn't detected by the phone. Now, when power is detached, the phone switches to battery power, including supplying battery power to any attached USB devices.

Note that the reverse is not true. If you connect external power when the phone and external USB devices are being powered by battery, the phone will continue to use battery power. The external power is not detected. When in doubt, disconnect and reconnect the USB OTG cable to cause the phone to recognize what's attached.
 

Attachments

  • takju-jop40d-JourneymanMod-Kernel-V4.zip
    4.3 MB · Views: 103
  • takju-jro03c-JourneymanMod-Kernel-V3.zip
    4.3 MB · Views: 10
  • takju-jzo54k-JourneymanMod-Kernel-V4.zip
    4.3 MB · Views: 11
  • yakju-jop40d-JourneymanMod-Kernel-V4.zip
    4.3 MB · Views: 31
  • yakju-jro03c-JourneymanMod-Kernel-V3.zip
    4.3 MB · Views: 8
  • yakju-jzo54k-JourneymanMod-Kernel-V4.zip
    4.3 MB · Views: 34
  • mysid-jro03o-JourneymanMod-Kernel-V4.zip
    4.6 MB · Views: 32
  • takju-jdq39-JourneymanMod-Kernel-V4.zip
    4.3 MB · Views: 17
  • yakju-jdq39-JourneymanMod-Kernel-V4.zip
    4.3 MB · Views: 48
Last edited:
G

GuestK007

Guest
I think he is wanting to somehow daisy chain the devices having power from the first one provide enough charge current for the last one. Least that is what im thinking he said i dunno though
 

Rotary Heart

Senior Member
Aug 1, 2012
1,127
615
Ok let me explain it a bit better. Lets say I have a flash drive (external storage, external hard drive, whatever you want to call it) I connect it to my phone with a usb to micro usb adapter. Now I have my ONLY micro usb connector in use, but after a while I'm running out of battery so I want to charge my phone BUT I can't since I can't remove my flash drive (because I'm using it).

Now I'm asking for an adapter or something that can let me connect my flash drive and still be able to charge my phone. like a 2 usb to 1 usb adapter for PC. Or like the adapter to connect 2 headphones in one headphone port.

I hope it's clear enough now. :laugh:
 

ACHILLES R32

Senior Member
Dec 28, 2010
1,199
809
VA
Ok let me explain it a bit better. Lets say I have a flash drive (external storage, external hard drive, whatever you want to call it) I connect it to my phone with a usb to micro usb adapter. Now I have my ONLY micro usb connector in use, but after a while I'm running out of battery so I want to charge my phone BUT I can't since I can't remove my flash drive (because I'm using it).

Now I'm asking for an adapter or something that can let me connect my flash drive and still be able to charge my phone. like a 2 usb to 1 usb adapter for PC. Or like the adapter to connect 2 headphones in one headphone port.

I hope it's clear enough now. :laugh:

This is the closest thing i could find.
 
Last edited:

highvista

Senior Member
Jul 12, 2009
249
56
Oregon
Ok let me explain it a bit better. Lets say I have a flash drive (external storage, external hard drive, whatever you want to call it) I connect it to my phone with a usb to micro usb adapter. Now I have my ONLY micro usb connector in use, but after a while I'm running out of battery so I want to charge my phone BUT I can't since I can't remove my flash drive (because I'm using it).

Now I'm asking for an adapter or something that can let me connect my flash drive and still be able to charge my phone. like a 2 usb to 1 usb adapter for PC. Or like the adapter to connect 2 headphones in one headphone port.

Unfortunately, the answer is no. I've tried several ways to get this to work, with no success. I routinely mount a flash drive using a USB OTG cable and the Stickmount app in order to listen to my music collection. It works great, but USB OTG drains the phone battery rather quickly.

I even cut out a notch on my desktop dock so I could attach the flash drive while trying to charge the phone via the dock's pogo pins. Here's a thread discussing this:

http://forum.xda-developers.com/showthread.php?t=1651757

The USB standard does provide for a method of charging while using USB OTG via a device called an Accessory Charger Adapter. But I haven't found such a device available anywhere.

Sorry to be the bearer of bad news. If you do happen to find another solution, do let us know. :)
 

ttabbal

Senior Member
Jul 1, 2009
2,076
723
Samsung Galaxy S21 Ultra
I don't think I have the bits needed to try it, but looking through the spec, I think you can simulate the requirements for the ACA.

Connect a 124K resistor from ID to GND on the micro side. That should tell the OTG host (the phone) to go to Charge/Host mode allowing the B device (memory stick etc) to work AND allowing the phone to charge... You will need to provide a decent 5V power connection. You need to power both the phone and the accessory device from this.
 

Rotary Heart

Senior Member
Aug 1, 2012
1,127
615
I don't think I have the bits needed to try it, but looking through the spec, I think you can simulate the requirements for the ACA.

Connect a 124K resistor from ID to GND on the micro side. That should tell the OTG host (the phone) to go to Charge/Host mode allowing the B device (memory stick etc) to work AND allowing the phone to charge... You will need to provide a decent 5V power connection. You need to power both the phone and the accessory device from this.

Ok I understand the resistor and where to connect it, but where I will connect the power source? if the memory stick is using the micro usb port?
 

caioketo

Senior Member
Mar 4, 2011
157
31
I'm about to do this too, so if I got mine first, i update here. =D
And it should work, couse it will be the same in specification, so teorically it will work!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    Just want to know for something like, connect a external storage and the other usb to charge the phone or something else and still have the other one to charge the phone.

    Thanks

    EDIT:
    Well since this is getting into a project. I will be adding the info here.

    New thread: http://forum.xda-developers.com/showthread.php?p=32618626#post32618626

    New info

    It looks like it works! Both the phone and my 64GB flash drive are being powered via a USB charger connected to a Y-cable. As far as I can tell, the phone battery isn't being charged and may still be draining a bit--this may depend on the current delivered by the USB charger. But I've been playing music for hours from an attached USB flash drive with my screen on and the battery level is still sitting at 98%.

    I've attached ZIP files with a boot image containing the kernel. The yakju boot image was created by replacing the stock kernel in a Nandroid boot image obtained from the Galaxy Nexus described in my sig. The other boot images were created from the boot image included with the Google factory ROM. I can't test these, so use with caution. NOTE!!! Make sure you do a Nandroid backup of your phone before trying out the attached boot images. Things can go wrong and you want to be able to recover.

    This was posted earlier in the thread, but credits for the kernel code tweak, along with details, go to the contributor to this thread

    http://rootzwiki.com/topic/30615-can-you-charge-usb-host-mode-simultaneously/

    Have fun! :)

    10/09/12:

    I've added two more ZIP files. These contain boot images with the code modded such that the phone battery is charged when using the Y-cable. NOTE: The phone will think it is being charged any time a USB OTG cable is connected. I haven't figured out a way around this yet. This doesn't really hurt anything, except if you have your phone set to stay on when charging, you could end up running down your battery! Important safety tip. :)

    10/15/12:

    I've replaced the previous ZIP files with two new ones. These contain boot images for takju and yakju JRO03C/4.1.1 that provide USB OTG+charging, with the added benefit that you can still use a standard USB OTG cable to connect an external device. As in the stock kernel, the phone will provide power for the external device. In other words, the new kernel in the ZIP archives auto-detects if there is a charger attached via a y-cable and uses it to power the external device and charge the phone, if it's found.

    I've also fixed the problem where the phone would show a charging icon in the notification bar if a USB OTG cable was attached without any external device connected to it.

    NOTE: THESE ZIP FILES ARE NOT MEANT TO BE FLASHED TO YOUR PHONE. These files contain a file called boot.img that can be flashed to your rooted phone from your computer via ADB with the commands

    fastboot flash boot /path/to/<boot>.img
    fastboot reboot

    You can learn more about using fastboot at http://wiki.cyanogenmod.org/wiki/Fastboot.

    12/28/12:

    Version V4 is replacing V3. This new version fixes the bug where detaching external power from the USB OTG y-cable or USB hub wasn't detected by the phone. Now, when power is detached, the phone switches to battery power, including supplying battery power to any attached USB devices.

    Note that the reverse is not true. If you connect external power when the phone and external USB devices are being powered by battery, the phone will continue to use battery power. The external power is not detected. When in doubt, disconnect and reconnect the USB OTG cable to cause the phone to recognize what's attached.

    -----------------------------

    12/28/12:

    Version V4 is replacing V3. This new version fixes the bug where detaching external power from the USB OTG y-cable or USB hub wasn't detected by the phone. Now, when power is detached, the phone switches to battery power, including supplying battery power to any attached USB devices.

    Note that the reverse is not true. If you connect external power when the phone and external USB devices are being powered by battery, the phone will continue to use battery power. The external power is not detected. When in doubt, disconnect and reconnect the USB OTG cable to cause the phone to recognize what's attached.
    5
    Boot Images with Modded Kernel for USB OTG with Power Via Y-Cable

    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!

    It looks like it works! Both the phone and my 64GB flash drive are being powered via a USB charger connected to a Y-cable. As far as I can tell, the phone battery isn't being charged and may still be draining a bit--this may depend on the current delivered by the USB charger. But I've been playing music for hours from an attached USB flash drive with my screen on and the battery level is still sitting at 98%.

    I've attached ZIP files with a boot image containing the kernel. The yakju boot image was created by replacing the stock kernel in a Nandroid boot image obtained from the Galaxy Nexus described in my sig. The other boot images were created from the boot image included with the Google factory ROM. I can't test these, so use with caution. NOTE!!! Make sure you do a Nandroid backup of your phone before trying out the attached boot images. Things can go wrong and you want to be able to recover.

    This was posted earlier in the thread, but credits for the kernel code tweak, along with details, go to the contributor to this thread

    http://rootzwiki.com/topic/30615-can-you-charge-usb-host-mode-simultaneously/

    Have fun! :)

    -----------------------------

    10/09/12:

    I've added two more ZIP files. These contain boot images with the code modded such that the phone battery is charged when using the Y-cable. NOTE: The phone will think it is being charged any time a USB OTG cable is connected. I haven't figured out a way around this yet. This doesn't really hurt anything, except if you have your phone set to stay on when charging, you could end up running down your battery! Important safety tip. :)

    -----------------------------

    10/15/12:

    I've replaced the previous ZIP files with two new ones. These contain boot images for takju and yakju JRO03C/4.1.1 that provide USB OTG+charging, with the added benefit that you can still use a standard USB OTG cable to connect an external device. As in the stock kernel, the phone will provide power for the external device. In other words, the new kernel in the ZIP archives auto-detects if there is a charger attached via a y-cable and uses it to power the external device and charge the phone, if it's found.

    I've also fixed the problem where the phone would show a charging icon in the notification bar if a USB OTG cable was attached without any external device connected to it.

    -----------------------------

    12/10/12:

    NOTE: THESE ZIP FILES ARE NOT MEANT TO BE FLASHED TO YOUR PHONE. These files contain a file called boot.img that can be flashed to your rooted phone from your computer via ADB with the commands

    fastboot flash boot /path/to/<boot>.img
    fastboot reboot

    You can learn more about using fastboot at http://wiki.cyanogenmod.org/wiki/Fastboot.

    -----------------------------

    12/28/12:

    Version V4 is replacing V3. This new version fixes the bug where detaching external power from the USB OTG y-cable or USB hub wasn't detected by the phone. Now, when power is detached, the phone switches to battery power, including supplying battery power to any attached USB devices.

    Note that the reverse is not true. If you connect external power when the phone and external USB devices are being powered by battery, the phone will continue to use battery power. The external power is not detected. When in doubt, disconnect and reconnect the USB OTG cable to cause the phone to recognize what's attached.
    3
    I don't think I have the bits needed to try it, but looking through the spec, I think you can simulate the requirements for the ACA.

    Connect a 124K resistor from ID to GND on the micro side. That should tell the OTG host (the phone) to go to Charge/Host mode allowing the B device (memory stick etc) to work AND allowing the phone to charge... You will need to provide a decent 5V power connection. You need to power both the phone and the accessory device from this.
    2
    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.

    Cool stuff going on here! :). I may not have time until the weekend, but I'll put together some notes on how I got my build environment going. And I'll also look into the github repository, too.

    So far, so good with battery charging while in USB OTG mode. The only quirk I'm going to try to fix is that whenever I plug an OTG cable into the phone, it goes into charge mode--the battery icon shows that it's charging and the screen stays on as if power is being provided, even if no power cable is attached to the OTG cable. The battery stats page still shows that the phone is on battery power, though. It's not a show-stopper but is annoying.

    But it sure is neat to finally be able to leave my flash drive plugged into the phone, the screen on, and still have it charge. I've been looking for a hardware or software solution to allow this for months now... :)
    2
    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!

    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!