Hi! We're discussing a clarification of the content license; please look over to Current events if you're interested in editing.

Msm Usb Host

From Htc-linux

Jump to: navigation, search

Contents

[edit] USB Host

[edit] Description

With USB Host you can connect the following to your device:

  • USB mouse and keyboard
  • Mass storage devices like USB pendrives and HDDs
  • Networking devices like WiFi and wired ethernet, bluetooth etc.
  • Video devices like capturing devices, external displays...
  • Audio devices
  • TV Receivers
  • Many other Linux supported USB devices


Source(s): Msm Usb Host

[edit] Hardware

Power


Using usb host mode it is important to provide external power, because some devices (like htc leo) don't provide the needed power.

In case you are planning to use a hub: It is good to choose one that provides power on the usb host line already while connected to AC. Not every usb hub that has a power supply does necessarily do this. You can figure it out by connecting your device to the host port and see if it charges. If it does, you are all set and don't need extra power setup.

USB hubs known to provide power to the uplink port:

Tiveco TM-UH710


If it doesn't, or if you don't want to use any hub but connect only one usb device directly, you need to 'inject' the power between phone and device. The best way is to use the power from a pc/charger via Y-cable.

You can also use a Y-cable without a usb hub, but this will only allow you to use one device at a time.


example:

File:usb-y-power-cable.jpg

http://www.reichelt.de/?;ACTION=3;LA=444;GROUP=C6992;GROUPID=16;ARTICLE=55407;START=0;SORT=artnr;OFFSET=100;SID=31Gf7LrqwQAR8AAGSi9lY471efc09e61fcf8e023c3256a83662e4



Note: In case you want to use a Y-cable you can also use an Y-cable with 3-male or 2 female outputs, just make sure that you will need

1x Male for power supply 1x male/female to connect your hd2 via standard or OTG cable 1x male/female to connect your usb device or hub -> devices

TODO: add list of usb hubs that have power on the host line, add diffent Y-cables


Hub

You can also modify the hub itself instead of using a cable, but this requires more skill then making the cable which is explain below. The process of modifying the hub is explained here. File:P1200023.small.JPG


Cable


The normal usb cable that comes with your device probably has micro-b usb connector on the one side to connect to your phone and a male standard usb connector to connect to your computer. This means you (may) can't connect directly to a Usb hub/Y cable (depends on device). Instead you can use a micro usb OTG cable (search ebay for nokia n810 otg micro usb , n810 has same micro usb connector like passion, leo, tg01, etc) that directly connects to phone and has slot ready for device on other side

File:micro-b-usb-otg.jpg File:micro-b-usb-otg-adaptor.jpg


Alternatively can use a gender changer/bender to turn your shipped usb data cable from male to female.

http://www.amazon.com/USB-Gender-Changer-Female/dp/B000BSN4UY

File:usb-genderbender.jpg


Make your own cable


With some knowledge you can also build your own cable. The best thing to do is probably building your own Y-cable.

It's not hard at all.

The best condition is to have 2 cables with one side female and on the other side wires without connector (should be white/green/red/black). You may also use one cable with two times female connectors and cut it in the middle. Now you need power on both cables. The best way to do this is using another standard usb-A male cable. Later you can just plug it into pc/charger to get power. The connector on the other side has to be without connector. Now you should have green/white/red/black wires on the end of each cable. (colors may be different, measure! http://www.pc-control.co.uk/usb%20pinout.htm)

The cable with standard usb-A male is only used for power supply, so we only need the current supplying wires of this cable. ( probably red/black, if not or if your not sure measure it!, link above) You now need to attach those 2 wires to the right counterpart on your two female cables. So you connect 3x GND (likely black) and 3x VCC (likely red). You now have power for both of your female outputs. You now only need to connect the 2 data wires (only the female cables, NOT OF THE POWER CABLE) with its counterpart. The data wires will be same color if you cut the cable at the begin (or likely be green/white). If your not sure of anything now, measure or better leave it!


Example wiring schematic showing exactly which pins need to be connected:

3 way joins are required on the (+) and (-) wires - these are illustrated by the circles where these lines meet. The Windows Mobile solution without the 3 way connection (only D+ & D-) doesn't work.

(For the ghetto hackers out there I made my lead by stripping wires with my teeth, twisting connections and insulating with black electrical tape! It's not pretty but it works)

(This is modified schematics without need to use USB adapder, but it use battery. Capacitor are optional but they increase stability. Power supply(battery) is not connected to HTC Leo so it last longer. This option requires some knowledge of soldering)

[edit] Kernel

leo/hd2 htc-msm-2.6.32 kernel is patched for usb host mode support. Use htcleo-usbhost_defconfig to configure with correct configurations.

leo/hd2 linux_on_wince_htc (EVO Kernel) Usb hosting is borked, due to different USB stack incompatibilites. ehci_msm.c is missing from EVO, needs porting, copy+paste will not work, stacks are too different.

TODO: list required config options for usb host mode here.

[edit] Additional information

Currently the best source of information is Sven Killig's Nexus USB Host guide. It also has a video demonstrating use of peripherals.

There is a also a patched kernel available.


Additional information and illustration will be provided later on.

If you're able to solder a bit you can get rid of all the connectors and compose a battery powered setup like this http://twitpic.com/20cohg to turn your phone into a laptop like device.