[Guide] USB Host

Search This thread

nerd65536

Member
Jun 10, 2009
15
16
USB host lets you hook up external USB devices to your phone, like a keyboard, mouse, USB drive, etc..

Unlike devices which are designed to support USB host, the One S doesn't provide power to the peripheral. That means we need a few more adapters/cables to get it to work (and we need an external power source).
Purchase links are listed for all the required cables/adapters.

You will need:
  • USB Host adapter (The otherwise unused 5th pin on a micro-usb connector is grounded) dx.com/m-129671
  • Mini USB power Y cable (this kind of cable is often packaged with portable hard drives) dx.com/u-65630
  • Mini USB Female to USB A Female adapter This package comes with two, but you only need one. dx.com/u-55613
  • Your charger

Assemble the cable:
  • The micro USB of the "USB Host adapter" connects to your phone.
  • Your peripheral plugs into the female end of the "Mini USB Female to USB A Female adapter"
  • The "Mini USB power Y cable" has three connectors:
    1. Mini USB connector - connects to the "Mini USB Female to USB A Female adapter"
    2. Male USB A Power (the thinner wire) - connects to your charger
    3. Male USB A - connects to the "USB Host adapter"
That's all. As long as your ROM supports the peripheral, it will work.
Some fun peripherals to try:
  • Powered USB hub (You can also power the adapter from one of the hub's ports)
  • Keyboard
  • Mouse (a cursor will appear on your device)
  • USB flash drives and USB hard drives must be FAT32. You have to run a few commands to use a USB drive. Mount manually from the shell (use Connectbot or Terminal Emulator):
    Code:
    su
    mkdir /mnt/sdcard/usb
    mount -o uid=1000,gid=1015,fmask=0702,dmask=0702 /dev/block/sda1 /mnt/sdcard/usb
    To unmount:
    Code:
    su
    umount /mnt/sdcard/usb
 
Last edited:

mrufino63

New member
May 11, 2012
2
0
Hello,
I'm French so please excuse me for my english.
Just one question.
I understand nothing with custom ROMs (and i don't want to modify the phone).
Do i need to do something on the phone or your solution with only a couple of cables, an adaptor, a power (i mean a battery like a TeckNet Dual-Port 7000mAh) AND my micro sd card reader (USB), all that will be sufficient to make the deal? I mean i will be able to read the files (.flac music files) of the micro sd or sd card?
Thank you
 

nerd65536

Member
Jun 10, 2009
15
16
Hello,
I'm French so please excuse me for my english.
Just one question.
I understand nothing with custom ROMs (and i don't want to modify the phone).
Do i need to do something on the phone or your solution with only a couple of cables, an adaptor, a power (i mean a battery like a TeckNet Dual-Port 7000mAh) AND my micro sd card reader (USB), all that will be sufficient to make the deal? I mean i will be able to read the files (.flac music files) of the micro sd or sd card?
Thank you

A battery pack (like the TeckNet) should work as the power source.

For Keyboard/mouse, you do not need to modify the phone. (Only the cables and power are needed.)
For a card reader, you must "root" the phone, because to 'mount' the USB drive, you must run 'su'.
 
  • Like
Reactions: mrufino63

mrufino63

New member
May 11, 2012
2
0
So i'd have to root the HTC One S to mount external flash memory cards!
What a pity to sell phones without micro sd emplacement (so they sell you. mp3 players).
I have a 64gb micro SDXC in my HTC Desire (bravo) which works perfectly...
HTC will wait... (Perhaps i will root that one: i must learn how to do...)
Nice from you to answer me - specially on xda-developers site, i mean where the members speak of more interesting problems, like development, etc.
Thank you again
 

setzer715

Senior Member
Jan 29, 2009
1,236
209
North Phoenix
Is this part right?
Code:
mkdir /media/sdcard/usb

My phone doesn't have a media directory. Plus on your next line you mount /mnt/sdcard/usb.

Thanks for the write up. Tried with a powered hub and couldn't get it to work. Going to order the cables I listed below and give it a shot. If I store and access movies/music from an external drive for travel that would be awesome! Will use this for power source on the plane!

Also, for other options for what to purchase you can bring it down to 2 items with these.

1 - Y-cable with female end instead of mini usb.
2 - Micro to female "host" cable. Same as what you linked, just a different place to buy so order is from same site (cheaper shipping!).
 
  • Like
Reactions: MadJoe

setzer715

Senior Member
Jan 29, 2009
1,236
209
North Phoenix
Yes, it should be "mkdir /mnt/sdcard/usb". I'm updating the post now.

Yeah, that's what I figured. Thanks for updating the post.

Were you able to mount a flash drive doing this? If so, could you stream a movie from it? Just curious what all you have done with this mod.

Thanks again for the write up. I always though the issue was that the tech was not included in the kernel, not that we didn't have a powered port!
 

nerd65536

Member
Jun 10, 2009
15
16
Yeah, that's what I figured. Thanks for updating the post.

Were you able to mount a flash drive doing this? If so, could you stream a movie from it? Just curious what all you have done with this mod.

Thanks again for the write up. I always though the issue was that the tech was not included in the kernel, not that we didn't have a powered port!

I am able to mount a flash drive and play movies from it. I also tested using a USB keyboard and a USB mouse.
Note: It is best to use a fast charger (1 amp or more) for powering the arrangement. The phone can charge when everything is plugged in.
 
  • Like
Reactions: setzer715

setzer715

Senior Member
Jan 29, 2009
1,236
209
North Phoenix
So I have been playing with this for a bit. I can get it to mount my old 4GB USB 2.0 flash drive but not my new 32GB USB3.0 flash drive. Do you think it's a 32GB thing or a USB3 thing? I would like to order a new drive for this but not sure which to eliminate.

I would prefer to use a 32GB drive if it's just a USB3 thing but if it's the size of the drive I don't want to deal with returns.

Any ideas?

Also it will not mount my SDCard reader with 16GB card in it.

EDIT: So I found my old 16GB USB3 flash drive and it mounts that just fine. So it's looking like it just won't mount a 32GB drive. Of course my 32GB drive is a super fast USB3 (write speeds of 100Mbps+) so maybe that could have something to do with it. Either way my 16 gig is good enough for travel so I'm good.

Thanks again for the write up!
 
Last edited:

nerd65536

Member
Jun 10, 2009
15
16
So I have been playing with this for a bit. I can get it to mount my old 4GB USB 2.0 flash drive but not my new 32GB USB3.0 flash drive. Do you think it's a 32GB thing or a USB3 thing? I would like to order a new drive for this but not sure which to eliminate.

I would prefer to use a 32GB drive if it's just a USB3 thing but if it's the size of the drive I don't want to deal with returns.

Any ideas?

Also it will not mount my SDCard reader with 16GB card in it.

I'm able to use a 32GB MicroSDHC card in a MicroSDHC-USB adapter.
In principle, a USB 3.0 device should be backwards-compatible, but I don't have any to test with.

Troubleshooting:

Do you get a specific error when using the "mount" command? If so, please paste the error message here.

Run
Code:
ls /dev/block/
to see whether the device "/dev/block/sda" is detected. How many numbered "sda*" entries are listed?

Does the phone charge while everything is plugged in?
 

setzer715

Senior Member
Jan 29, 2009
1,236
209
North Phoenix
I'm able to use a 32GB MicroSDHC card in a MicroSDHC-USB adapter.
In principle, a USB 3.0 device should be backwards-compatible, but I don't have any to test with.

Troubleshooting:

Do you get a specific error when using the "mount" command? If so, please paste the error message here.

Run
Code:
ls /dev/block/
to see whether the device "/dev/block/sda" is detected. How many numbered "sda*" entries are listed?

Does the phone charge while everything is plugged in?

The error I get is "No such file or directory". It happens on this and my sdcard reader.

I ran ls /dev/block. With the 16gb flash drive I see sda and sda1. With my 32GB I only see sda.

My 32GB flash drive is a high speed Lexor. I tried my wifes flash drive, her's is a Lexor 32GB USB3 but a slower rated one and I can see her's.

Further testing with my SDCard reader. I have a Transcend 8GB Class 6, A-Data 16GB Class 6 and Patriot 32GB Class 10 SDCards. I can see the 8GB and 32GB but not the 16GB.

Seems maybe a compatibility issue maybe? The card's/drives I couldn't read I tried formatting again, everything is FAT32. Who knows. At least I know most things work.
 

nerd65536

Member
Jun 10, 2009
15
16
I ran ls /dev/block. With the 16gb flash drive I see sda and sda1. With my 32GB I only see sda.

The drive is detected by the phone, but the lack of a "sda1" entry means that the drive does not have a standard partition table. In that case, it should work if you specify "/dev/block/sda" instead of "/dev/block/sda1" in the mount command.

(The ideal solution would be to partition and format the drive so that it would behave like the others.)
 
Last edited:

setzer715

Senior Member
Jan 29, 2009
1,236
209
North Phoenix
The drive is detected by the phone, but the lack of a "sda1" entry means that the drive does not have a standard partition table. In that case, it should work if you specify "/dev/block/sda" instead of "/dev/block/sda1" in the mount command.

(The ideal solution would be to partition and format the drive so that it would behave like the others.)

Thanks but what do you mean "partition and format" with a flash drive? Are you saying there should be more than one partition and there isn't? I've formatted the flash drive a few time in windows always as fat32. Is there another way I should do it?

I have an Ubuntu Live CD if you think I should do it in Linux but I'm VERY new to Linux and have no clue as to what commands to use to accomplish this.
 

nerd65536

Member
Jun 10, 2009
15
16
Thanks but what do you mean "partition and format" with a flash drive? Are you saying there should be more than one partition and there isn't? I've formatted the flash drive a few time in windows always as fat32. Is there another way I should do it?

I have an Ubuntu Live CD if you think I should do it in Linux but I'm VERY new to Linux and have no clue as to what commands to use to accomplish this.
It is possible to skip the partition table altogether and just start with the FAT32 data instead. This is what the manufacturer of the drive has done. (The drive doesn't have any partitions, so there is no first partition to be named "/dev/block/sda1")
You should be able to use the drive if you mount "sda" instead of "sda1". You can follow these instructions below to make it behave like the other drives:

If you have an Ubuntu LiveCD, boot from it, and open GParted (Partition Editor):
Choose your flash drive from the drop-down at the top right. Make absolutely sure you select the correct device (the size of the drive is listed), as all data on it will be erased.
In the menu: Device --> Create Partition Table... --> Apply.
Click on the "unallocated" space, to select it.
Next, menu: Partition --> New --> File system: FAT32 --> Add.
Finally, menu: Edit --> Apply All Operations

(When finished, close GParted and shutdown the liveCD)

The drive should now show up with the expected /dev/block/sda1 partition.
 
Last edited:
  • Like
Reactions: setzer715

setzer715

Senior Member
Jan 29, 2009
1,236
209
North Phoenix
I just mounted it as you previously described on sda instead of sda1 and it worked fine. I don't want to repartition it as I don't know if that will mess with the speeds. Who knows what Lexor did to make this thing so amazing fast but I want to keep it that way. It's nice to through 8gigs of movies on it in 1-2 minutes.

I'm sure partitioning has nothing to do with it and it's all based on hardware but you never know!
 

markwalker84

New member
May 18, 2010
2
0
Just ordered an HTC One S. YAY!


I'm a little scared about potentially frying my new toy by using the wrong cables...


Would an all in one cable do the job?
(ebay search for "Micro USB Host OTG Cable With USB power")


Seems to be the same as the DIY setup mentioned in the OP just all wrapped up in a single cable.


Thanks,

Mark
 

arses

Senior Member
Mar 24, 2010
655
199
I'm think if we buy an extended battery which have a micro usb cable (I forget the brand) exist on amazon.
We can solder a female to the cable and use battery as power source for phone and host.
What u think???

Sent from my One Sinderella using Tapatalk 2
 
Aug 18, 2012
6
0
Graz
Hi everybody,

First of all sorry for my englisch. I have a big problem with the USB otg function. An USB mouse works well but USB drives don't work. I have copied the text from terminal emulator:

app_162@android:/ $ export PATH=/data/local/bin:$PATH
app_162@android:/ $ su
app_162@android:/ # mkdir /mnt/sdcard/usb
mkdir: can't create directory '/mnt/sdcard/usb': File exists
2 /dev/block/sda1 /mnt/sdcard/usb <
mount: mounting /dev/block/sda1 on /mnt/sdcard/usb failed: No such file or directory
255|app_162@android:/ #

I also tried sda instead of sda1. No difference.
Please could anybody help me.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 10
    USB host lets you hook up external USB devices to your phone, like a keyboard, mouse, USB drive, etc..

    Unlike devices which are designed to support USB host, the One S doesn't provide power to the peripheral. That means we need a few more adapters/cables to get it to work (and we need an external power source).
    Purchase links are listed for all the required cables/adapters.

    You will need:
    • USB Host adapter (The otherwise unused 5th pin on a micro-usb connector is grounded) dx.com/m-129671
    • Mini USB power Y cable (this kind of cable is often packaged with portable hard drives) dx.com/u-65630
    • Mini USB Female to USB A Female adapter This package comes with two, but you only need one. dx.com/u-55613
    • Your charger

    Assemble the cable:
    • The micro USB of the "USB Host adapter" connects to your phone.
    • Your peripheral plugs into the female end of the "Mini USB Female to USB A Female adapter"
    • The "Mini USB power Y cable" has three connectors:
      1. Mini USB connector - connects to the "Mini USB Female to USB A Female adapter"
      2. Male USB A Power (the thinner wire) - connects to your charger
      3. Male USB A - connects to the "USB Host adapter"
    That's all. As long as your ROM supports the peripheral, it will work.
    Some fun peripherals to try:
    • Powered USB hub (You can also power the adapter from one of the hub's ports)
    • Keyboard
    • Mouse (a cursor will appear on your device)
    • USB flash drives and USB hard drives must be FAT32. You have to run a few commands to use a USB drive. Mount manually from the shell (use Connectbot or Terminal Emulator):
      Code:
      su
      mkdir /mnt/sdcard/usb
      mount -o uid=1000,gid=1015,fmask=0702,dmask=0702 /dev/block/sda1 /mnt/sdcard/usb
      To unmount:
      Code:
      su
      umount /mnt/sdcard/usb
    2
    Hi guys. This has probably been asked already but I have an unrooted HTC one s running JB. Does OTG work and provide power via the Ian port on the standard official rom with just the OTG cable?

    Yes with the new OTA (jb) you onli need a normal OTG cable to connect any usb device (keyboard,mouse, usb key).
    2
    If you are on T-Mobile stock ROM, even if rooted, I don't think it'll work. The ROM needs USB host support, which is configured in the kernel, so a custom Rom would be the way to go (which one? Sorry, I don't know...). Of course if you can get another USB storage device to work on the stock ROM, then I'm wrong about the ROMs, haha. From the dmesg I don't see anything about any external USB device. I find that odd, since I would expect at least a blip on the dmesg, but then again, it could be related to the lack of USB host support... Could anyone verify my claims about the kernel USB support and the ROMs?

    Edit: My One S isn't rooted, so I can't test this right now. I think your best bet would be to try different devices. Also, after you issue the mount command, just type the command "mount" and press enter. If it mounted it, somewhere it that long blurb there should be mention of an sd* device along with /mnt/sdcard/usb as mount point. Also check in Astro by going to /mnt/sdcard/usb after mounting to see if there is something there. Hope that helps!

    Sent from my HTC VLE_U

    devgee posted a video with a working USB OTG: http://xdaforums.com/showpost.php?p=30791064&postcount=24 Which ROM is that? I've already tried ASTRO, it just said no data. If this all doesn't work, I'll buy a Y-cable and try a stick first, like in the video. Maybe it's just an issue with my HDDs...
    And it would be really great if someone (maybe the OP?) could say, if you need a custom ROM or not.

    Edit: OK, I've PM'd devgee and it seems like you need a custom ROM (ViperOneS works), a USB OTG cable and an Y-cable. No wonder it didn't work :D I'll have a closer look when I'm back from my vacation and then post here if it worked. Thanks to everyone who helped ;)
    1
    Hello,
    I'm French so please excuse me for my english.
    Just one question.
    I understand nothing with custom ROMs (and i don't want to modify the phone).
    Do i need to do something on the phone or your solution with only a couple of cables, an adaptor, a power (i mean a battery like a TeckNet Dual-Port 7000mAh) AND my micro sd card reader (USB), all that will be sufficient to make the deal? I mean i will be able to read the files (.flac music files) of the micro sd or sd card?
    Thank you

    A battery pack (like the TeckNet) should work as the power source.

    For Keyboard/mouse, you do not need to modify the phone. (Only the cables and power are needed.)
    For a card reader, you must "root" the phone, because to 'mount' the USB drive, you must run 'su'.
    1
    USB host lets you hook up external USB devices to your phone, like a keyboard, mouse, USB drive, etc..

    Unlike devices which are designed to support USB host, the One S doesn't provide power to the peripheral. That means we need a few more adapters/cables to get it to work (and we need an external power source).
    Purchase links are listed for all the required cables/adapters.

    You will need:
    • USB Host adapter (The otherwise unused 5th pin on a micro-usb connector is grounded) dx.com/m-129671
    • Mini USB power Y cable (this kind of cable is often packaged with portable hard drives) dx.com/u-65630
    • Mini USB Female to USB A Female adapter This package comes with two, but you only need one. dx.com/u-55613
    • Your charger

    Assemble the cable:
    • The micro USB of the "USB Host adapter" connects to your phone.
    • Your peripheral plugs into the female end of the "Mini USB Female to USB A Female adapter"
    • The "Mini USB power Y cable" has three connectors:
      1. Mini USB connector - connects to the "Mini USB Female to USB A Female adapter"
      2. Male USB A Power (the thinner wire) - connects to your charger
      3. Male USB A - connects to the "USB Host adapter"
    That's all. As long as your ROM supports the peripheral, it will work.
    Some fun peripherals to try:
    • Powered USB hub (You can also power the adapter from one of the hub's ports)
    • Keyboard
    • Mouse (a cursor will appear on your device)
    • USB flash drives and USB hard drives must be FAT32. You have to run a few commands to use a USB drive. Mount manually from the shell (use Connectbot or Terminal Emulator):
      Code:
      su
      mkdir /mnt/sdcard/usb
      mount -o uid=1000,gid=1015,fmask=0702,dmask=0702 /dev/block/sda1 /mnt/sdcard/usb
      To unmount:
      Code:
      su
      umount /mnt/sdcard/usb





    It shows me like this.Is it ok or some thing wrong ?


    $ su
    #su
    # mkdir /mnt/sdcard/usb
    # mount -o
    option requires an argument -- oBusyBox v1.20.2-cm7 bionic (2012-07-17 15:18 +0200) multi-call binary.

    Usage: mount [OPTIONS] [-o OPTS] DEVICE NODE

    Mount a filesystem. Filesystem autodetection requires /proc.

    -a Mount all filesystems in fstab
    -f Dry run
    -r Read-only mount
    -w Read-write mount (default)
    -t FSTYPE[,...] Filesystem type(s)
    -O OPT Mount only filesystems with option OPT (-a only)
    -o OPT:
    loop Ignored (loop devices are autodetected)
    [a]sync Writes are [a]synchronous
    [no]atime Disable/enable updates to inode access times
    [no]diratime Disable/enable atime updates to directories
    [no]relatime Disable/enable atime updates relative to modification time
    [no]dev (Dis)allow use of special device files
    [no]exec(Dis)allow use of executable files
    [no]suid(Dis)allow set-user-id-root programs
    [r]shared Convert [recursively] to a shared subtree
    [r]slaveConvert [recursively] to a slave subtree
    [r]private Convert [recursively] to a private subtree
    [un]bindable Make mount point [un]able to be bind mounted
    [r]bind Bind a file or directory [recursively] to another location
    move Relocate an existing mount point
    remount Remount a mounted filesystem, changing flags
    ro/rw Same as -r/-w

    There are filesystem-specific -o flags.

    # uid=1000,gid=1015,fmask=0702,dmask=
    # 0702 /dev/block/sda1 /mnt/sdcard/usb1