USB host mode

Line 111: Line 111:
uu: echo otg > /sys/devices/platform/musb_hdrc/mode
uu: echo otg > /sys/devices/platform/musb_hdrc/mode
-
[[Category:Users]]
 
[[Category:Internet Tablet Talk]]
[[Category:Internet Tablet Talk]]

Revision as of 17:02, 19 August 2008

USB host mode can allow the user to connect various hardware devices to the N800 just like a regular computer. There are limitations however, there is limited power and only a few device types will work.

Some examples of devices that may work include:

  • Mass storage - works (some usb sticks require more power than the n800 can handle - put a self-powered hub between the devices and the n800)
  • Digital Camera - works
  • HID - keyboards work, mice are detected, but need some setup to work usefully (same troubles as BT mice).
  • Serial - works, needs kernel module to be compiled and inserted (do not forget to insmod usbserial.ko first)
  • Ethernet - works, needs kernel module to be compiled and inserted (tested with 3Com USB Ethernet 3C460B, module pegasus.ko)
  • GPS - works, but only in combination with gpsd and only in maemo-mapper (Nokia Mapper/Wayfinder requires a BT gps) (tested with magellan explorist in usb nmea 2.1 mode with cdc_adm.ko module)


In order for the n800 to enter into host mode you need to flash the N800 to OS 2008 and obtain the correct adapter. What is required is a USB A (Female) to USB Mini-B (Male) OTG cable (sometimes called a OTG convertor cable).

You can find a professionally modified USB OTG adapter designed specifically to provide automatic host-mode functionality on the N800 here. Ensure your tablet is running OS 2008, the device you want to use is supported, and plug it in using the adapter; the tablet will automatically switch into host mode and your device should be ready to use. (larger devices such as hard drives/etc require external power; see the note above)

Alternative adapters that have the correct connections but that are NOT confirmed to do automatic switching can be found here UK [1] and here using Google Product seach [2]. *some report these cables and others advertized as OTG have the proper end connectors but don't automatically start host mode. The only report I have seen of true OTG behavior is a Big Lots adapter kit. For current info on the search for OTG connectors see this thread[3].

Using a seprate powered USB hub is a good idea when connecting devices that have more power needs.


How to manually set the N800 with OS2008 to host mode. For use with typical or non-OTG connections. For example the USB cable that ships with the N800 combined with a Female A to A gender Bender. 1. Download becomeroot http://eko.one.pl/maemo/dists/bora/user/binary-armel/becomeroot_0.1-2_armel.deb 2. Open Xterm and type:

 2.a. sudo gainroot
 2.b. echo host> /sys/devices/platform/musb_hdrc/mode
   -You will see a 'USB device not Supported' message, then it will work.
   -Inserting a USB drive opened File Manager to the new drive.
   -Insufficient power will cause some devices to perform erratically.

3. To set N800 back to OTG mode, do:

 3.a. echo otg > /sys/devices/platform/musb_hdrc/mode

Hint: Copy/Paste /sys/devices/platform/musb_hdrc/mode or use tab-completion. Type /sys/de <tab>/pla <tab>/mu <tab> and it will autocomplete the command line for you.

For more information see the forum Discussion on the Topic.[4]

If the system does not detect cable events after switching back to OTG mode, switch it to peripheral mode first, then to OTG mode as follows [5]:

echo peripheral > /sys/devices/platform/musb_hdrc/mode
echo otg > /sys/devices/platform/musb_hdrc/mode

A Simple Method of setting the N8X0 with OS2008 to host mode - 'Extras' App

A simple script for entering Host and OTG modes on the N8X0 with OS2008 (courtesy of Mara). It accomplishes the above, but in a more elegant (read: Newbie-friendly) way! It allows easier switching into and out of Host mode, without going to the command line in Xterm each time.

After completion of the steps below, you will have an entry under 'Extras' for entering Host mode, and OTG mode. Pre-requisiste apps are: becomeroot

Adapted from Mara's original post.


1. Unzip the files at Mara's post, and copy the Host.sh and Otg.sh to /home/user/MyDocs

2. change the scripts to be executable by running:

2.a. chmod +x Host.sh
2.b. chmod +x Otg.sh

3. As root user, copy host.desktop and otg.desktop to /usr/share/applications/hildon

That's it! Now, you should have two applications under 'Extras' to enable you to switch between modes.


Another Simple Method of setting the N8X0 with OS2008 to host mode - Status Bar Switch.

Another way to have easy access to Host and OTG modes was proposed by mplawner.

After completion of the steps below, you will have an icon in the status bar that shows your CPU and MEM usage (osso-statusbar-cpu). By tapping this icon, you will be able to see a drop-down menu where you can select to enter either Host or OTG modes.

Pre-requisiste apps are: becomeroot

1. Unzip the files at Mara's post, and copy the Host.sh and Otg.sh to /home/user/MyDocs

2. change the scripts to be executable by running:

2.a. chmod +x Host.sh
2.b. chmod +x Otg.sh

3. Install osso-statusbar-cpu application from the following site: http://people.debian.org/~tschmidt/maemo/chinook/osso-statusbar-cpu/

4. In the Settings-->Command menu of the osso-statusbar-cpu application, enter the commands below along with a description:

4.a. /home/user/MyDocs/Host.sh 
4.b. /home/user/MyDocs/Otg.sh

5. Edit the /etc/sudoers file and add the following lines to the bottom of the file

user ALL = NOPASSWD: /home/user/MyDocs/Host.sh
user ALL = NOPASSWD: /home/user/MyDocs/Otg.sh

Ensure that the /etc/sudoers file retains the 0440 file access permissions, or else bad things will happen!

That's it! Now you can switch between OTG and Host mode by simply clicking on the osso-statusbar-cpu application icon in the status bar and selecting the description title you gave in Step 4.



Urho Konttori (author of UKMP) has released an application that makes doing this easy too. http://konttoristhoughts.blogspot.com/2008/02/usbcontrol-and-theme-maker.html

usbcontrol (above) is reported to have problems with ukki's ntfs support.


You can also use Kate Alhola's statusbar plugin: https://garage.maemo.org/projects/usb-otg-plugin/

6. Use shortcuts: http://www.internettablettalk.com/forums/showthread.php?t=20997&page=7, thread #63; no commands, no scripts, just enter the following lines as a HWR shortcuts as described in the link: USB host uh: echo host > /sys/devices/platform/musb_hdrc/mode

USB unhost/OTG uu: echo otg > /sys/devices/platform/musb_hdrc/mode