Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,730,629 Members 40,893 Now Online
XDA Developers Android and Mobile Development Forum

[USB OTG] [11DEC13] [PATCH] Externally Powered USB OTG

Tip us?
 
ziddey
Old
(Last edited by ziddey; 21st December 2013 at 11:42 PM.)
#1  
Senior Member - OP
Thanks Meter 1442
Posts: 1,524
Join Date: Aug 2007

 
DONATE TO ME
Default [USB OTG] [11DEC13] [PATCH] Externally Powered USB OTG

Externally Powered USB OTG - Nexus 4

This is an all-in-one patch to enable externally powered OTG (technically usb host mode) support. It's built off either the stock kernel or Franco's kernel sources, and should work with any ROM (that these kernels otherwise support). Refer to the second post for details on modifications and additions.

Again, power MUST be supplied externally, as there is no way for the phone to provide it.


Requirements:

Power MUST be supplied to both the USB device and phone. The easiest way would be by using an OTG Y-cable:


If using a traditional OTG cable, a USB Y-cable can be used:


Some powered USB hubs also send power up to the host and can be used directly with a regular OTG cable.

I am not endorsing any specific product or seller. Links are provided solely as examples, and are by no means definitive. As long as the phone and device both get 5V (charger, computer, etc.), and the data pins are connected, host mode will work (provided enough current can be supplied).


Installation:

Simply install the zip in recovery. Script will automatically install/patch necessary files. Must reinstall any time ROM is updated.

To uninstall, simply reflash your ROM. Data wipe is not necessary. If for some reason that's not an option, use the flashable unmod script to remove ROM-side modifications. Flash your kernel of choice afterwards (must flash "reset" kernel first if flashing an "anykernel").


Recovery:
(Optional)

For support in recovery, I've created a sort of "any-any" script. It replaces the recovery's kernel with the boot one. Therefore, by flashing this after the main patch, OTG will effectively be enabled in recovery (after a reboot). However, it is on the actual recovery itself to provide support for usb drives-- TWRP does. Otherwise, you'll have to manually mount any drives via linux console commands.

For your own safety/sanity, ensure the main patch works before flashing this. If recovery fails to boot after flashing, it can easily be replaced by using GooManager or similar. Worst case scenario, a new recovery can always be flashed via fastboot.


Downloads:
(Changelog at end of second post)

MAKE SURE TO DOWNLOAD THE RIGHT VERSION FOR YOUR ROM.
I don't keep track of all the different ROMs so it's on you guys to figure out which one is appropriate. The -CM builds have the two "CAF" commits that are now required for CM and its derivatives (unless they have specifically reverted the associated commits).

Franco-CM builds make use of a ramdisk mod script, which may have unpredictable results. Be ready in case it doesn't boot.

Current:
Old:
Bugs / Notes:
  • An OTG cable has the ID pin grounded out, which is used to trigger usb host mode. However, ID pin detection is broken in the Nexus 4 (although working for Slimport detection). Instead, we rely on detection of a "proprietary" charger (voltage on the data pins) in order to determine when to enable host mode.
  • Self-powered devices (e.g. digital cameras) don't send power to the phone. This will cause the device to not be detectable. Therefore, external power is still required.
  • Slimport cannot work concurrently with usb data due to hardware limitations (Slimport takes over the usb data pins).
  • USB drive will automatically mount at /storage/usbdisk0 (also accessible at /usbdisk and /mnt/usbdisk). Media scanning should occur automatically. Make sure to unmount before removal to avoid data loss.
  • Stock Android only supports FAT for storage. NTFS/exFAT/ext4 partitions may require the use of a third party app like StickMount (CM now supports these partitions natively!).
  • There appears to be a minor bug in the AOSP code that prevents available space from being reported in Settings->Storage->USB Storage. The screenshot is of CM10.1, which has this fixed
  • Current builds do not allow for host mode without charging. Use this as a workaround:
    Quote:
    Originally Posted by RussianBear View Post
    For those that want to stop usb charging, create a script modifying this to either 1 (disabled) or 0 (enabled). Works for me Not responsible for your phone(s) exploding.

    echo 1 > /sys/module/pm8921_charger/parameters/disabled
    echo 0 > /sys/module/pm8921_charger/parameters/disabled
  • Standard Disclaimer-- Flashing this patch is at your own risk, and carries no warranty or liability on my part. The assumption is that you will perform due diligence before flashing and make any necessary backups if required.

Screenshots:




Credits:
  • CaptainMuon, for proving that host mode is possible on the Nexus 4.
  • Franco, for his kernel, which this patch is based off.
  • garyd9, for his command to patch platform.xml.
  • Chainfire, for his usb host wisdom, and article on secondary storage write permissions.
  • arpruss, for his compiled zip-for-android
  • All you guys for testing!
The Following 219 Users Say Thank You to ziddey For This Useful Post: [ Click to Expand ]
 
ziddey
Old
(Last edited by ziddey; 3rd December 2013 at 08:37 PM.)
#2  
Senior Member - OP
Thanks Meter 1442
Posts: 1,524
Join Date: Aug 2007

 
DONATE TO ME
Patch Overview:
  • Kernel with modified msm_otg.c -- This will REPLACE whatever kernel you currently have installed. If you flash a different kernel on top, you will obviously lose OTG capability. This contains the necessary workaround to enable usb host mode ("OTG").
  • Modified init.mako.rc/init.mako.usbdisk.rc -- Required for creating usb drive directories.
  • Precompiled modified storage_list.xml -- Allows unmounting usb drive in Settings->Storage. Hex offsets for storageDescription patched during flash.
  • Addition to build.prop -- Enables downloading apps from play store that require usb host mode support.
  • Addition to platform.xml -- Workaround to allow apps write access to usb drives
  • Addition to handheld_core_hardware.xml -- Activate android.hardware.usb.host.xml
  • android.hardware.usb.host.xml -- Enables Android API support for usb host mode.
  • fstab.mako (4.3) / vold.fstab (4.2) -- Required for automounting usb drive
  • Modules cifs.ko, ff-memless.ko, hid-dr.ko, hid-logitech.ko, and xpad.ko (/system/lib/modules). Manually insmod as needed or create an appropriate init.d script to load on boot. These are only required for certain gamepads. Refer here for more information.

Patch Details:

There seems to be an issue with detecting the state of the ID pin on the OTG cable, so we need to come up with an alternate way of determining when to switch to host mode. drivers/usb/otg/msm_otg.c (kernel) is responsible for detecting the charger type and setting host mode, among other tasks. I noticed that when connected to a powered OTG cable, the charge type becomes USB_PROPRIETARY_CHARGER (vs USB_DCP_CHARGER when connected to the wall, and USB_SDP_CHARGER to a computer). This will be the condition that we use to trigger host mode.

Standard OTG cables will have the ID pin shorted to ground. There are also usb accessory charger adapters (ACA) that provide different resistances between these pins to signal functionality (see http://en.wikipedia.org/wiki/USB_On-...TG_Micro_Plugs). Support for accessory charger detection isn't enabled in the kernel originally, and doesn't seem to work properly anyway. However, one of the modes is essentially what we're trying to achieve (ID_A): "A charger and a B-device are attached. The OTG device is allowed to charge and enter host mode." So I've added code when USB_PROPRIETARY_CHARGER is detected to simulate the case of ID_A being detected. Following through the code for host mode, certain events are handled differently when ACA support is enabled (specifically, suspension of host mode). In these instances, we need to simulate ACA support since ID_A is technically dependent on it (run into issues with the usb controller getting stuck in a suspended state otherwise). Now we have host mode with charging working properly.

Finally, we need a method of detecting when the OTG cable is unplugged so the device can switch out of host mode. Fortunately, since power (vbus) detection does work, we can use that. Normally, changes in vbus state are ignored while in host mode, so we need to address that. From there, we simulate ACA detection for the case of no ID_A, which is just clearing the ID_A bit and charger. Afterwards, it'll automatically reset the usb state, ready to start all over again.

The dirty hacks to msm_otg.c are complete, and externally-powered OTG is functional.

Refer here for actual changes: https://github.com/ziddey/mako/commi...htlies-4.3-JSS

No changes are needed to the kernel's .config. Do not enable Drivers->USB->OTG support (we get our support through "OTG support for Qualcomm on-chip USB controller" which is already enabled) or Support for ACA (does not work and most users don't have the proper adapter anyway).


Now we run into a problem with usb storage. Since there is no /system/etc/vold.fstab, usb drives get automatically mounted to /mnt/shell/emulated/0 (at least in CM10.1), which overloads the emulated sdcard, and causes major problems. So we create /system/etc/vold.fstab:

Code:
dev_mount usbdisk /storage/usbdisk0 auto /devices/platform/msm_hsusb_host/usb2
Update:
Quote:
In 4.3, Google did away with vold.fstab, instead unifying mounting with fstab.mako (on the ramdisk). The replacement line would be:

Code:
/devices/platform/msm_hsusb_host/usb2 /storage/usbdisk0 auto defaults voldmanaged=usbdisk0:auto
Update:
Quote:
In 4.4, mountpoint is set to auto instead of /storage/usbdisk0, and will be taken care of by vold / fuse daemon.
But /storage/usbdisk0 does not exist, so it will fail to mount. We will be using /init.mako.rc to create this directory and symlink associated legacy ones. This file resides in a ramdisk (which combines with the kernel to form boot.img), so we need to modify that instead of /init.mako.rc on the device itself (since it wouldn't be able to persist through a reboot). As well, we define the environmental variable SECONDARY_STORAGE. Below the analogous /storage/sdcard0 lines, add:

Code:
export SECONDARY_STORAGE /storage/usbdisk0

mkdir /storage/usbdisk0 0666 system system

symlink /storage/usbdisk0 /usbdisk
symlink /storage/usbdisk0 /mnt/usbdisk
Update:
Quote:
In 4.4, usb disks must be further FUSE mounted. Rather than insert the script into init.mako.rc, it will now reside in init.mako.usbdisk.rc and be imported to init.mako.rc (strictly for ease/neatness and not standard convention):

Code:
# USB Storage -ziddey

on init
    mkdir /mnt/media_rw/usbdisk0 0700 media_rw media_rw
    mkdir /storage/usbdisk0 0700 root root

    export SECONDARY_STORAGE /storage/usbdisk0

    # Support legacy paths
    symlink /storage/usbdisk0 /usbdisk
    symlink /storage/usbdisk0 /mnt/usbdisk

service fuse_usbdisk0 /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/usbdisk0 /storage/usbdisk0
    class late_start
    disabled
In order to enable Settings->Storage->USB Storage, res/xml/storage_list.xml in /system/framework/framework-res.apk needs to be modified. We should be able to simply inject an encoded version of our modified storage_list.xml. I'm not sure if it's possible to simply encode a single file, so I decompiled framework-res.apk in order to make the following addition to res/xml/storage_list.xml (inside StorageList):

Code:
    <storage android:mountPoint="/storage/usbdisk0"
             android:storageDescription="@string/storage_usb"
             android:primary="false"
             android:removable="true" />
After recompiling, we should now be able to extract our newly encoded storage_list.xml for use with any ROM's framework-res.apk.

To allow downloading apps from the market that require usb host support, we need to add the following to /system/build.prop:

Code:
ro.usb.host=1
To enable android api support for usb host, we need to create /system/etc/permissions/android.hardware.usb.host.xml with the following:

Code:
<?xml version="1.0" encoding="utf-8"?>
<permissions>
    <feature name="android.hardware.usb.host" />
</permissions>
Now to "activate" this file, we add to /system/etc/permissions/handheld_core_hardware.xml:

Code:
<feature name="android.hardware.usb.host" />
Google assigned a different permission group for secondary storage devices (e.g. usb drives), media_rw, for which user apps cannot have write access (Chainfire has a good article on the issue here). We need to modify /system/etc/permissions/platform.xml to allow write access. Add the line in red ("officially" used by Samsung):

Code:
<permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
    <group gid="media_rw" />
    <group gid="sdcard_rw" />
</permission>
That's it! Externally powered usb host mode should be fully functional.

For full disclosure, these are the changes to the kernel config vs stock (really just NTFS and modules):

Code:
        echo "CONFIG_INPUT_JOYSTICK=y" >> .config
        echo "CONFIG_JOYSTICK_XPAD=m" >> .config
        echo "CONFIG_JOYSTICK_XPAD_FF=y" >> .config
        echo "CONFIG_JOYSTICK_XPAD_LEDS=y" >> .config
        echo "CONFIG_INPUT_FF_MEMLESS=m" >> .config
        echo "CONFIG_HID_LOGITECH=m" >> .config
        echo "CONFIG_LOGITECH_FF=y" >> .config
        echo "CONFIG_LOGIRUMBLEPAD2_FF=y" >> .config
        echo "CONFIG_LOGIG940_FF=y" >> .config
        echo "CONFIG_LOGIWHEELS_FF=y" >> .config
        echo "CONFIG_HID_DRAGONRISE=m" >> .config
        echo "CONFIG_DRAGONRISE_FF=y" >> .config
        echo "CONFIG_CIFS=m" >> .config

        echo "CONFIG_NTFS_FS=y" >> .config
#        echo "CONFIG_USB_DEBUG=y" >> .config
        sed 's/\(CONFIG_USB_STORAGE_DEBUG\)=y/# \1 is not set/' -i .config

Changelog:
  • 4.4: 2013.12.01 0349ET: [fk r196] [fk r196-CM] [aosp r5] aosp includes gamepad kernel modules.
  • 4.4: 2013.11.29 0219ET: [fk r195] [fk r195-CM] CM build attempts to patch Franco ramdisk mods on the fly, so be prepared if things go south.
  • 4.4: 2013.11.21 1922ET: [fk r194] [aosp r2] Update to 4.4 configuration for mounting usbdisk.
  • 4.3: 2013.10.22 2201ET r191: [JWR] [JSS/JLS] Allow potentially faster charging in host mode, re-add manual host mode
  • 4.3: 2013.10.22 2204ET r191-CM: [JWR] [JSS/JLS] ^ + 2 "CAF" commits for CM compatibility
  • 4.3: 2013.10.09 2148ET r190: [JWR] [JSS/JLS] Re-enable USB debug messages
  • 4.3: 2013.10.01 1954ET r188: [JWR] [JSS/JLS] Zipalign framework-res.apk
  • ziddey-otg-r183-09141713.zip ziddey-otg-r183-JSS-09141713.zip Add SECONDARY_STORAGE env., do ramdisk patching during flash, include CIFS module -- rebase to r183.
  • ziddey-otg-r182-09041823.zip ziddey-otg-r182-JSS-09041823.zip Remove module unloading support, patch handheld_core_hardware.xml -- rebase to Franco r182.
  • ziddey-otg-r178-08240234.zip ziddey-otg-r178-JSS-08240238.zipDisable modversions, enable kernel wakelock stats-- rebase to Franco r178.
  • JSS15J 4.3.0 2013.08.13 1533ET: ziddey-otg-r174-08131533.zip First release for JSS15J. Updated to 4.3's new unified fstab (native mounting support). Using an "anyramdisk" method for compatibility with different ROMs (specifically, different su implementations). Based off Franco r174.
  • 2013.07.29 1101ET: ziddey-otg-r165-07291101.zip Maintenance build-- rebase to Franco r165.
  • 2013.07.14 2015ET: ziddey-otg-r163-07142015.zip Allow automatic host mode without charging-- rebase to Franco r163.
  • 2013.07.08 1420ET: ziddey-otg-r162-07081420.zip Update storage_list.xml for compatibility with new CM nightlies-- rebase to Franco r162.
  • 2013.06.28 1551ET: ziddey-otg-M3-06281551.zip Maintenance build-- rebase to Franco M3.
  • 2013.06.27 0427ET: ziddey-otg-r156-06270427.zip Re-enable read-only NTFS support in kernel.
     
    • 2013.06.06 1736ET: ziddey-otg-r151-06061736.zip Releases will now include modules ff-memless.ko, hid-dr.ko, hid-logitech.ko, and xpad.ko (/system/lib/modules). Manually insmod as needed or create an appropriate init.d script to load on boot. Rebase to Franco r151.
    • 2013.05.25 0749ET: ziddey-otg-05250749.zip Fix compatibility issue with CWM (MTP crashes).
    • 2013.05.23 2119ET: ziddey-otg-05232119.zip Start charging immediately when entering host mode. This resolves issues with proprietary chargers.
    • 2013.05.22 2305ET: ziddey-otg-05222305.zip Rebase to Franco's r140. Revert checks for actual proprietary chargers in favor of manually disabling automatic host mode (temporary). Issue "# echo disable > /sys/kernel/debug/msm_otg/aca" to disable automatic host mode (enable to re-enable).
    • 2013.05.17 0107ET: ziddey-otg-05170107.zip Added check for other proprietary charger case. Rebase to Franco's r137.
    • 2013.05.15 0124ET: ziddey-otg-05150124.zip Attempt to detect actual proprietary chargers (Apple-compatible) and charge properly. Rebase to Franco's r136.
    • 2013.05.09 1729ET: ziddey-otg-05091729.zip Should now patch precompiled storage_list.xml to address incorrect strings (Internal Storage/USB Storage). Re-enabled verbose usb debugging messages (dmesg).
    • 2013.05.06 1846ET: ziddey-otg-05061846.zip Maintenance build. Based off Franco's current nightlies branch (r134?). Updated storage_list.xml to match current CM nightlites. Removed freshen flag to hopefully address issues with framework-res.apk not being patched (thanks sga999). Verbose usb debugging messages not enabled (unaltered r134 config)
    • 2013.04.07 0355ET: ziddey-otg-04070355.zip Now modifies /system/etc/permissions/platform.xml to allow app write access to usb storage (thanks garyd9 for script code). Kernel build number reverted to 105 to match Franco's M1 build number.
    • 2013.03.27.2338ET: ziddey-otg-03272334.zip Allow host mode when slimport connected (must manually enable for now. not sure if it actually works, so please report results.) Prevent forced host mode from entering suspended state so it won't get stuck (perhaps worth reinvestigating if we ever get internal power working). Allow forcing mode via /sys/kernel/debug/msm_otg/mode regardless of current state (original code had conditions that were unreasonable. it is designed to be used for debugging after all..). Forgot to reset the build number; should be 105. Would only potentially matter if using Franco's app.
    • 2013.03.23 2000ET: ziddey-otg-03231951.zip All-in-one update now enables android api for usb host mode. Should automatically rescan media library when usb storage is connected. Kernel updated to Franco M1 (milestone), and will probably stay here for a while.
    • 2013.03.17 1548ET: otg-aio-20130317.zip All-in-one flashable zip that includes modified kernel/ramdisk, vold.fstab, and precompiled storage_list.xml for framework-res.apk (thanks arpruss for precompiled zip-for-android). Kernel unchanged from last release (Franco r102 base), but removed unrelated line previously added to default.prop in ramdisk
    • 2013.03.14 1648ET: otg-franco-boot-03141621.img Should have fixed all issues involving unpopulated hubs, unplugged devices, host mode timeout, and charging. Changed main mount point to /storage/usbdisk0 since that seems to be the new standard (manually update vold.fstab accordingly). Based on Franco's git as of 3/12 (after r102)
    • 2013.03.11 2244ET: otg_boot_r3.img Interim build to address wall charging issues (do not attach/detach devices while otg cable connected to phone)
    • 2013.03.09 0739ET: otg_boot_r2.img Should charge (faster) in host mode
    • 2013.03.08 1128ET: otg_franco.zip Initial release in this thread.
    • 2013.03.07 1350ET: franco-otg-201303071328.img "Pre-alpha" build posted in CaptainMuon's thread. Forces disabling of host mode on device unplug.
    • 2013.03.07 1102ET: franco-otg-201303071032.img "Pre-alpha" build posted in CaptainMuon's thread. Forces host mode on detection of "proprietary" type charger (vs usb = sdp, wall = dcp).
References:
The Following 56 Users Say Thank You to ziddey For This Useful Post: [ Click to Expand ]
 
cobhc
Old
#3  
cobhc's Avatar
Senior Member
Thanks Meter 57
Posts: 479
Join Date: Nov 2009
Location: Nottingham
Default Re: [OTG] [08MAR13] [DIRTY HACKS] OTG Kernel / Ramdisk / Framework (Seeking Devs)

Just for clarification this still requires external power via a y cable right?

Sent from my Nexus 4 using XDA Premium HD app
 
ziddey
Old
#4  
Senior Member - OP
Thanks Meter 1442
Posts: 1,524
Join Date: Aug 2007

 
DONATE TO ME
Yes, still requires external power. Currently, the hack triggers host mode when detecting "USB_PROPRIETARY" charger.
The Following 4 Users Say Thank You to ziddey For This Useful Post: [ Click to Expand ]
 
sga999
Old
(Last edited by sga999; 8th March 2013 at 06:35 PM.)
#5  
Senior Member
Thanks Meter 54
Posts: 434
Join Date: Mar 2012
ziddey, is it possible for you to make a framework file for the stock rom? Also, you've given us .img files before. I'm assuming we can flash these .zip files during recovery (e.g. twrp)?

EDIT: I just tried this without the framework file since I'm on stock rom. I flashed the kernel through twrp, but the otg_vold zip would not flash (just said "failed"). Maybe it's not supposed to?. I manually put it in /system/etc. Let me know if I should have been able to flash it.

It works as you described, with usbdisk, no stickmount required. However, the phone is no longer charging like it did with your prior kernels. Maybe that should have been expected, but I certainly liked the fact that I had that "feature" before (with my cable from post #40...it did NOT charge with other OTG or Y-cables).

Strange, but a flash drive works, but a microsd card reader does not. It was working with your prior kernels. EDIT: It seems to be finicky, but I can get that microsd card reader to work also.

Thanks so much for your efforts!
The Following 2 Users Say Thank You to sga999 For This Useful Post: [ Click to Expand ]
 
zarboga
Old
#6  
zarboga's Avatar
Senior Member
Thanks Meter 3
Posts: 105
Join Date: Nov 2011
Default Re: [OTG] [08MAR13] [DIRTY HACKS] OTG Kernel / Ramdisk / Framework (Seeking Devs)

Nice work man.. Will give a try

Sent from my Nexus 4 using xda app-developers app
 
ziddey
Old
(Last edited by ziddey; 9th March 2013 at 02:32 PM.)
#7  
Senior Member - OP
Thanks Meter 1442
Posts: 1,524
Join Date: Aug 2007

 
DONATE TO ME
Made some updates. Should now charge (faster) in host mode.

otg_boot_r2.img: http://d-h.st/Oky Modified kernel/ramdisk based on 3/1 git clone of Franco's kernel
The Following 5 Users Say Thank You to ziddey For This Useful Post: [ Click to Expand ]
 
ereghro
Old
(Last edited by ereghro; 9th March 2013 at 02:41 PM.)
#8  
Junior Member
Thanks Meter 2
Posts: 10
Join Date: Feb 2012
Default an idea

what happens if you make a manual switch for usb host mode? like when we need to plug usb, we change the state?
 
ziddey
Old
#9  
Senior Member - OP
Thanks Meter 1442
Posts: 1,524
Join Date: Aug 2007

 
DONATE TO ME
Quote:
Originally Posted by sga999 View Post
ziddey, is it possible for you to make a framework file for the stock rom? Also, you've given us .img files before. I'm assuming we can flash these .zip files during recovery (e.g. twrp)?
Gone back to image files again. One less step to do this way.

Quote:
EDIT: I just tried this without the framework file since I'm on stock rom. I flashed the kernel through twrp, but the otg_vold zip would not flash (just said "failed"). Maybe it's not supposed to?. I manually put it in /system/etc. Let me know if I should have been able to flash it.
You're right; I hadn't tested it, and assumed I'd be able to just hack up a different zip for use. Pulled it for now.

Quote:
It works as you described, with usbdisk, no stickmount required. However, the phone is no longer charging like it did with your prior kernels. Maybe that should have been expected, but I certainly liked the fact that I had that "feature" before (with my cable from post #40...it did NOT charge with other OTG or Y-cables).
I'm surprised you didn't have issues with the prior builds. I don't think I ever changed anything. That said, it should be fixed now. Let me know how it works.

Quote:
Strange, but a flash drive works, but a microsd card reader does not. It was working with your prior kernels. EDIT: It seems to be finicky, but I can get that microsd card reader to work also.
Likely an issue on your end since I don't think anything was changed that would cause this. Are you trying to use both the flash drive and microsd at the same time? I'm not sure how that'd be handled-- upon insertion of the second drive, either nothing happens, or it overloads the first drive. As it is, I'm guessing my implementation of usbdisk isn't properly done.

Quote:
Thanks so much for your efforts!
No problem! More of a personal challenge/desire. Really hoping that a real dev takes notice.
The Following 4 Users Say Thank You to ziddey For This Useful Post: [ Click to Expand ]
 
ziddey
Old
(Last edited by ziddey; 10th March 2013 at 02:15 PM.)
#10  
Senior Member - OP
Thanks Meter 1442
Posts: 1,524
Join Date: Aug 2007

 
DONATE TO ME
Quote:
Originally Posted by ereghro View Post
what happens if you make a manual switch for usb host mode? like when we need to plug usb, we change the state?
You mean like CaptainMuon's build, where you change /sys/kernel/debug/msm_otg/mode?

Originally, there were issues with that method after unplugging the OTG cable, but that may have been fixed with the hacks to the OTG_STATE_A_IDLE case. It's possible that the other modifications will now cause problems with with the debug mode, but I'm imagining it just makes it unnecessary (except for debugging purposes) since it's not actually triggering a_host based on the ID pin, but rather by the detected charger.

Is there a particular reason you want to use a manual switch? I can re-enable it in the next build.

The Following 3 Users Say Thank You to ziddey For This Useful Post: [ Click to Expand ]
Tags
usb otg host
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes