USB OTG

jazzzzzzz

Senior Member
Jul 1, 2011
618
92
0
Trivandrum
Am on arhd 6.7.0....I have installed it latest kernel...and used your same way for connecting my hardisk by using otg cable and y cable for mini USB for my hardisk...and its not working ...I have created USB folder in sdcard and just connect the whole setup and nothing is happening....

Did I skip any thing.?any need of typing any commands.?

I have 320gb hardisk...the disk is rotating I can feel it on touch....but at the phone side the charging led is on and nothing happens



Sent from my HTC Sensation XE with Beats Audio using Tapatalk 2
 

triffonovm

Member
Nov 23, 2008
32
48
0
Sofia
FC when removing cable

This is amazing Sebastian. Today a bought a USB OTG cable just to try this and it works like a charm. It's been a long time dream of mine to be able to review the clips on my GoPro camera without the need to bring a laptop. And now that dream has come true. Sensation + OTG cable + USB to miniB Y cable from an old external HDD + GoalZero battery pack = hello lightweight camping :D

I have one question though. Every time I unplug I get a FC for proccess "android.proccess.media" followed by a notification saying "SD card removed unexpectedly". So I thought "Oh stupid me, I have to un-mount first". So I fired TE, su, umount /sdcard/usb, remove cable and FC again this time followed by a notification that says "Removed SD card. SD card removed. Insert a new one."

Is this normal? Does any of you guys get those messages, or am I doing something wrong.
btw I'm on SmartDroid Berserk 2.2 ROM with kernel 1.5.2 (it was the same with 1.5.1 though).
 

XxXPachaXxX

Senior Member
May 1, 2010
1,542
4,301
0
Naples
When usb stick is mounted in /sdcard/usb when i remove the hardware the .android_secure is unmounted so all the apps on sd not works until i reboot the phone. Same thing if i use the umount /sdcard/usb command

EDIT: Working well without automatic mount in vold.fstab and with usb host controller app

EDIT: to SebFM, i suggest to not use mout points on sdcard but use one like this:
/mnt/usb
/mnt/ehdd
/mnt/ehdd1

So when the usb drive will be removed, this will not affect the sdcard


Or using mount points on sd, these have to be correctly unmounted before hardware remove. It works great with chainfire's stickmount 1.5
 
Last edited:

SebastianFM

Senior Member
Dec 13, 2009
640
5,305
0
38
Warsaw
Am on arhd 6.7.0....I have installed it latest kernel...and used your same way for connecting my hardisk by using otg cable and y cable for mini USB for my hardisk...and its not working ...I have created USB folder in sdcard and just connect the whole setup and nothing is happening....

Did I skip any thing.?any need of typing any commands.?

I have 320gb hardisk...the disk is rotating I can feel it on touch....but at the phone side the charging led is on and nothing happens



Sent from my HTC Sensation XE with Beats Audio using Tapatalk 2
1. Ensure that you have installed my newest kernel.
2. Reboot phone and wait until boot is finished.
3. Connect USB OTG Adapter.
4. Connect USB peripherals.

To check if USB mass storage device is connected properly run command ls /dev/block in Terminal Emulator.
If output contains sdX and sdXY (where X is a, b, ... for USB mass storage devices, e. g. sda, sdb and Y is 1, 2, ... for partitions, e. g. sda1, sda2) everything is OK. Remember that NTFS partitions won't be mounted automatically to /sdcard/usb directory.
If output doesn't contain any sdX and sdXY items, something is wrong. There are many ways to identify issues. First of all you should save kernel log immediatelly after connect using command dmesg > /sdcard/dmesg.txt. Log should contain useful informations about connected USB OTG Adapter and any connected USB peripherals to OTG Adapter.
 

jazzzzzzz

Senior Member
Jul 1, 2011
618
92
0
Trivandrum
1. Ensure that you have installed my newest kernel.
2. Reboot phone and wait until boot is finished.
3. Connect USB OTG Adapter.
4. Connect USB peripherals.

To check if USB mass storage device is connected properly run command ls /dev/block in Terminal Emulator.
If output contains sdX and sdXY (where X is a, b, ... for USB mass storage devices, e. g. sda, sdb and Y is 1, 2, ... for partitions, e. g. sda1, sda2) everything is OK. Remember that NTFS partitions won't be mounted automatically to /sdcard/usb directory.
If output doesn't contain any sdX and sdXY items, something is wrong. There are many ways to identify issues. First of all you should save kernel log immediatelly after connect using command dmesg > /sdcard/dmesg.txt. Log should contain useful informations about connected USB OTG Adapter and any connected USB peripherals to OTG Adapter.
Is there a way to detect connected cable ?s2 detects it even if cable without device is inserted....I remember that some cable don't have sense pin connected to ground that can become problem...

In my friends galaxy s2 we found that some of the otg cable is not working ...reason is that pin 5 and 4 is not shorted at the phones end


Sent from my HTC Sensation XE with Beats Audio using Tapatalk 2
 

SebastianFM

Senior Member
Dec 13, 2009
640
5,305
0
38
Warsaw
Is there a way to detect connected cable ?s2 detects it even if cable without device is inserted....I remember that some cable don't have sense pin connected to ground that can become problem...

In my friends galaxy s2 we found that some of the otg cable is not working ...reason is that pin 5 and 4 is not shorted at the phones end


Sent from my HTC Sensation XE with Beats Audio using Tapatalk 2
Yes. Kernel log taken after connecting USB OTG Adapter:
Code:
<6>[   97.455566] [CABLE] usb: id interrupt
<6>[   97.568359] [CABLE] cable_detect_get_type: id pin low
<6>[   97.581207] [CABLE] cable_detect_get_adc: MPP ADC 327
<6>[   97.581298] [CABLE] cable_detect_get_adc: result = 21
<6>[   97.581390] config_pyramid_usb_id_gpios 63 output high
<6>[   97.593811] [CABLE] cable_detect_get_adc: MPP ADC 968
<6>[   97.593902] [CABLE] cable_detect_get_adc: result = 64
<6>[   97.594055] [CABLE] [2nd] accessory adc = 0x40
<6>[   97.594146] config_pyramid_usb_id_gpios 63 input none pull
<6>[   97.594299] [CABLE] cable_detect_get_type prev_type 0, type 16, stable_count 0
<6>[   97.708099] [CABLE] cable_detect_get_type: id pin low
<6>[   97.720977] [CABLE] cable_detect_get_adc: MPP ADC 327
<6>[   97.721069] [CABLE] cable_detect_get_adc: result = 21
<6>[   97.721221] config_pyramid_usb_id_gpios 63 output high
<6>[   97.734008] [CABLE] cable_detect_get_adc: MPP ADC 968
<6>[   97.734161] [CABLE] cable_detect_get_adc: result = 64
<6>[   97.734252] [CABLE] [2nd] accessory adc = 0x40
<6>[   97.734344] config_pyramid_usb_id_gpios 63 input none pull
<6>[   97.734497] [CABLE] cable_detect_get_type prev_type 16, type 16, stable_count 1
<6>[   97.848175] [CABLE] cable_detect_get_type: id pin low
<6>[   97.860565] [CABLE] cable_detect_get_adc: MPP ADC 327
<6>[   97.860717] [CABLE] cable_detect_get_adc: result = 21
<6>[   97.860809] config_pyramid_usb_id_gpios 63 output high
<6>[   97.873413] [CABLE] cable_detect_get_adc: MPP ADC 968
<6>[   97.873504] [CABLE] cable_detect_get_adc: result = 64
<6>[   97.873657] [CABLE] [2nd] accessory adc = 0x40
<6>[   97.873748] config_pyramid_usb_id_gpios 63 input none pull
<6>[   97.873901] [CABLE] cable_detect_get_type prev_type 16, type 16, stable_count 2
<6>[   97.988433] [CABLE] cable_detect_get_type: id pin low
<6>[   98.001037] [CABLE] cable_detect_get_adc: MPP ADC 327
<6>[   98.001129] [CABLE] cable_detect_get_adc: result = 21
<6>[   98.001281] config_pyramid_usb_id_gpios 63 output high
<6>[   98.017242] [CABLE] cable_detect_get_adc: MPP ADC 968
<6>[   98.017395] [CABLE] cable_detect_get_adc: result = 64
<6>[   98.017486] [CABLE] [2nd] accessory adc = 0x40
<6>[   98.017578] config_pyramid_usb_id_gpios 63 input none pull
<6>[   98.017700] [CABLE] cable_detect_get_type prev_type 16, type 16, stable_count 3
<6>[   98.018981] [CABLE] USB Host inserted
<6>[   98.019073] [CABLE] [HostNotify] Send to: usb_host: 1
<6>[   98.019226] [USBH] msm_otg_set_id_state: 0
<6>[   98.019317] [USBH] Clear ID
<6>[   98.019409] [CABLE] cable_detect_handler ID pin 0, type 16
<6>[   98.019592] [USB] OTG runtime resume
<6>[   98.019653] [USBH] msm_otg_resume
<7>[   98.019866] [USBH] msm_hsusb_config_vddcx: min_vol:1045000 max_vol:1320000
<6>[   98.020050] [USBH] USB exited from low power mode
<6>[   98.020111] [USBH] msm_otg_sm_work: state:b_idle bit:0x00000000
<6>[   98.020263] [USB] OTG_STATE_B_IDLE state
<6>[   98.020355] [USBH] !id || id_a
<7>[   98.020446] [USBH] host on
<6>[   98.020599] msm_hsusb_host msm_hsusb_host.0: Qualcomm On-Chip EHCI Host Controller
<6>[   98.020721] msm_hsusb_host msm_hsusb_host.0: new USB bus registered, assigned bus number 1
<6>[   98.048248] msm_hsusb_host msm_hsusb_host.0: irq 132, io mem 0x12500000
<6>[   98.068145] msm_hsusb_host msm_hsusb_host.0: USB 2.0 started, EHCI 1.00
<6>[   98.068298] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002 
<6>[   98.068450] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
<6>[   98.068542] usb usb1: Product: Qualcomm On-Chip EHCI Host Controller
<6>[   98.068695] usb usb1: Manufacturer: Linux 3.0.16-v1.5.1 ehci_hcd
<6>[   98.068817] usb usb1: SerialNumber: msm_hsusb_host.0
<6>[   98.069824] hub 1-0:1.0: USB hub found
<6>[   98.069915] hub 1-0:1.0: 1 port detected
 

SebastianFM

Senior Member
Dec 13, 2009
640
5,305
0
38
Warsaw
This is amazing Sebastian. Today a bought a USB OTG cable just to try this and it works like a charm. It's been a long time dream of mine to be able to review the clips on my GoPro camera without the need to bring a laptop. And now that dream has come true. Sensation + OTG cable + USB to miniB Y cable from an old external HDD + GoalZero battery pack = hello lightweight camping :D

I have one question though. Every time I unplug I get a FC for proccess "android.proccess.media" followed by a notification saying "SD card removed unexpectedly". So I thought "Oh stupid me, I have to un-mount first". So I fired TE, su, umount /sdcard/usb, remove cable and FC again this time followed by a notification that says "Removed SD card. SD card removed. Insert a new one."

Is this normal? Does any of you guys get those messages, or am I doing something wrong.
btw I'm on SmartDroid Berserk 2.2 ROM with kernel 1.5.2 (it was the same with 1.5.1 though).
Automatic mount isn't perfect yet. It must be supported by ROM. I know how it should work, I tested USB OTG on Galaxy S II.

When usb stick is mounted in /sdcard/usb when i remove the hardware the .android_secure is unmounted so all the apps on sd not works until i reboot the phone. Same thing if i use the umount /sdcard/usb command

EDIT: Working well without automatic mount in vold.fstab and with usb host controller app

EDIT: to SebFM, i suggest to not use mout points on sdcard but use one like this:
/mnt/usb
/mnt/ehdd
/mnt/ehdd1

So when the usb drive will be removed, this will not affect the sdcard


Or using mount points on sd, these have to be correctly unmounted before hardware remove. It works great with chainfire's stickmount 1.5
If I disable automatic mount, files won't be indexed by Media Library and won't visible in Gallery and Music.
If I use different directory by modifing vold.fstab, it won't be indexed too because /sdcard/usb is defined as storage directory by HTC in xml/storage_list.xml in framework-res.apk.
I still try to find best solution.
 

XxXPachaXxX

Senior Member
May 1, 2010
1,542
4,301
0
Naples
Automatic mount isn't perfect yet. It must be supported by ROM. I know how it should work, I tested USB OTG on Galaxy S II.


If I disable automatic mount, files won't be indexed by Media Library and won't visible in Gallery and Music.
If I use different directory by modifing vold.fstab, it won't be indexed too because /sdcard/usb is defined as storage directory by HTC in xml/storage_list.xml in framework-res.apk.
I still try to find best solution.
The problem is only how to correctly unmount before to remove hardware. the umonut command doesn't works
 

mike2nl

Senior Member
Jul 24, 2009
3,966
670
0
61
Near Utrecht
You don't need any rare cables. Every USB OTG Adapter with Micro USB Male and USB A Female should work.
There are several ways to connect USB peripherals to USB OTG Adapter, I'll describe this later in more detail.
.......
Thank You Sebastian for the advise.
Will take a look at it, after i have ordered the cable by a local dealer.
Will report back...

BTW: this is a must have for us flashers and modders

---------- Post added at 08:21 PM ---------- Previous post was at 08:19 PM ----------

EDIT: to SebFM, i suggest to not use mout points on sdcard but use one like this:
/mnt/usb
/mnt/ehdd
/mnt/ehdd1

So when the usb drive will be removed, this will not affect the sdcard
This is the best way on linux and unix too. There is no problem in the es file explorer with that, so long you are rooted ;)
 

heavy_metal_man

Senior Member
Nov 6, 2011
2,779
760
0
OpenSensation will get support for this. Mountpoint will be /mnt/usbdisk (see this commit). Kernel changes will be included in next nightly, but they need to be tested (currently don't have the required cables..)
is the open sensation kernel compatiable with the cm10 beta? (please excuse me if that is stupid :eek:) if not how would we approach getting a aosp kernel that can do this? aside from hope :p
 

TamCore

Senior Member
Jul 8, 2010
665
649
0
28
Düsseldorf
tamcore.eu
is the open sensation kernel compatiable with the cm10 beta? (please excuse me if that is stupid :eek:) if not how would we approach getting a aosp kernel that can do this? aside from hope :p
It should. But the OS kernel is not available as a standalone zip. I'll release my updated AOSP kernel later (based on the newly released 3.0.40, hopefully with the required USB-OTG changes). Currently compiling it. Release will be announced via twitter.
 

heavy_metal_man

Senior Member
Nov 6, 2011
2,779
760
0
once you have it compiled would it be possible for others to make a install zip? i really appreciate you help making this aosp and sebastianFM for making this work for sense! you guys rock :cool:
 
  • Like
Reactions: eduka