Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,741,492 Members 39,434 Now Online
XDA Developers Android and Mobile Development Forum

[Guide] USB Host

Tip us?
 
nerd65536
Old
(Last edited by nerd65536; 24th May 2012 at 10:57 AM.) Reason: /mnt, not /media
#1  
Junior Member - OP
Thanks Meter 16
Posts: 14
Join Date: Jun 2009
Default [Guide] USB Host

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:
    Select 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:
    Select Code
    su
    umount /mnt/sdcard/usb
The Following 10 Users Say Thank You to nerd65536 For This Useful Post: [ Click to Expand ]
 
mrufino63
Old
#2  
Junior Member
Thanks Meter 0
Posts: 2
Join Date: May 2012
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
Old
#3  
Junior Member - OP
Thanks Meter 16
Posts: 14
Join Date: Jun 2009
Quote:
Originally Posted by mrufino63 View Post
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'.
The Following User Says Thank You to nerd65536 For This Useful Post: [ Click to Expand ]
 
mrufino63
Old
#4  
Junior Member
Thanks Meter 0
Posts: 2
Join Date: May 2012
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
Old
#5  
setzer715's Avatar
Senior Member
Thanks Meter 202
Posts: 1,205
Join Date: Jan 2009
Location: North Phoenix
Is this part right?
Code:
Select 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!).
LG G2 - CM11
Nexus 5 - PurityROM
Nexus 10 - PurityROM
Nexus 4 - My Son is using it running PurityROM
TMO SGSIII - CM10.1
HTC One S - Sold
TMO SGSII - Sold
Sensation 4G - Sold
MT4G - Got a new one! Stock 2.3.5 with root.
Nexus One - CM9!
Vibrant - Let in-law use it. Just wasn't cutting it for me.
MyTouch3G Slide - Returned
MyTouch 3G - Sold
G1 - Sold
The Following User Says Thank You to setzer715 For This Useful Post: [ Click to Expand ]
 
nerd65536
Old
#6  
Junior Member - OP
Thanks Meter 16
Posts: 14
Join Date: Jun 2009
Quote:
Originally Posted by setzer715 View Post
Is this part right?
Code:
Select Code
mkdir /media/sdcard/usb
My phone doesn't have a media directory. Plus on your next line you mount /mnt/sdcard/usb.
Yes, it should be "mkdir /mnt/sdcard/usb". I'm updating the post now.
The Following User Says Thank You to nerd65536 For This Useful Post: [ Click to Expand ]
 
setzer715
Old
#7  
setzer715's Avatar
Senior Member
Thanks Meter 202
Posts: 1,205
Join Date: Jan 2009
Location: North Phoenix
Quote:
Originally Posted by nerd65536 View Post
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!
LG G2 - CM11
Nexus 5 - PurityROM
Nexus 10 - PurityROM
Nexus 4 - My Son is using it running PurityROM
TMO SGSIII - CM10.1
HTC One S - Sold
TMO SGSII - Sold
Sensation 4G - Sold
MT4G - Got a new one! Stock 2.3.5 with root.
Nexus One - CM9!
Vibrant - Let in-law use it. Just wasn't cutting it for me.
MyTouch3G Slide - Returned
MyTouch 3G - Sold
G1 - Sold
 
nerd65536
Old
#8  
Junior Member - OP
Thanks Meter 16
Posts: 14
Join Date: Jun 2009
Quote:
Originally Posted by setzer715 View Post
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.
The Following User Says Thank You to nerd65536 For This Useful Post: [ Click to Expand ]
 
setzer715
Old
#9  
setzer715's Avatar
Senior Member
Thanks Meter 202
Posts: 1,205
Join Date: Jan 2009
Location: North Phoenix
Quote:
Originally Posted by nerd65536 View Post
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.
Awesome, thanks! Just ordered some cables, cant wait to try it out!
LG G2 - CM11
Nexus 5 - PurityROM
Nexus 10 - PurityROM
Nexus 4 - My Son is using it running PurityROM
TMO SGSIII - CM10.1
HTC One S - Sold
TMO SGSII - Sold
Sensation 4G - Sold
MT4G - Got a new one! Stock 2.3.5 with root.
Nexus One - CM9!
Vibrant - Let in-law use it. Just wasn't cutting it for me.
MyTouch3G Slide - Returned
MyTouch 3G - Sold
G1 - Sold
 
setzer715
Old
(Last edited by setzer715; 4th June 2012 at 11:37 PM.)
#10  
setzer715's Avatar
Senior Member
Thanks Meter 202
Posts: 1,205
Join Date: Jan 2009
Location: 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!
LG G2 - CM11
Nexus 5 - PurityROM
Nexus 10 - PurityROM
Nexus 4 - My Son is using it running PurityROM
TMO SGSIII - CM10.1
HTC One S - Sold
TMO SGSII - Sold
Sensation 4G - Sold
MT4G - Got a new one! Stock 2.3.5 with root.
Nexus One - CM9!
Vibrant - Let in-law use it. Just wasn't cutting it for me.
MyTouch3G Slide - Returned
MyTouch 3G - Sold
G1 - Sold

Tags
usb, usb host
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes