Using the Pandora's USB-OTG port for connecting USB devices (ArchLinux)

2011-11-15 13:52
The Pandora console comes with two USB ports - an ordinary USB host port and a Mini-USB port which is USB-OTG compliant. Unfortunately, the USB host port is not fully USB compliant, because it does not support USB full speed and low speed devices. Most (if not all) USB HID devices like mice and keyboards are USB low speed devices and as such they do not work when connected to the USB host port without a USB 2.0 hub in between.

Pandora + Mouse

The Mini-USB port on the other hand supports USB low speed and full speed devices with a passive adaptor (Mini-USB-A plug to Standard USB-A socket). That means one can attach a USB mouse to the Pandora without a USB hub using the OTG port.
Basically one can connect any USB device to that port as long as it does not need more than 100 mA. Do not even think about connecting bus-powered USB hard disks to that port. ;) Normal USB ports (like the big USB port on the Pandora) can deliver up to 500 mA.

USB OTG adaptor

To enable USB host mode, connect your device with the adaptor to the Mini-USB port and then as root run the following command:
# echo host>/sys/devices/platform/musb_hdrc/mode
This should switch the port to host mode and your device should work just as if it had been connected to an ordinary USB port. I have tried that with both ArchLinux (2.6.37 kernel) and the Pandora OS (2.6.27 kernel), but I had no luck with it with the Pandora OS.

There are adaptors that are supposed to automatically switch the Pandora to host mode (by connecting one of its wires internally to ground). The adaptor I am using does not cause the Pandora to switch automatically, while it does cause such a switch on another device.

USB OTG adaptor attached to the Pandora

With lsusb you can check if your device has been detected. Here is an example output of lsusb with a USB mouse connected to the OTG port. Bus 1 is the normal USB bus (where the big USB port is attached to), while bus 2 appears only when you enable the host mode on the OTG port.
# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 046d:c025 Logitech, Inc. MX500 Optical 
Mouse
If it does not work, use dmesg to check if there had been an error. Some devices need more current than the OTG port can deliver. dmesg will tell you if that's the case. I have tried several devices on that port and had different results even with very similar devices. While one USB memory stick worked just fine another one (with the same capacity) refused to work because it needed to much current. I have also tried a USB soundcard and a few bluetooth dongles, all of them worked fine.

The relevant lines of dmesg's output after successfully connecting a USB mouse:
[  230.547241] usb 2-1: new low speed USB device using 
musb_hdrc and address 2
[  230.701324] usb 2-1: device v046d pc025 is not supported
[  230.701354] usb 2-1: New USB device found, 
idVendor=046d, idProduct=c025
[  230.701385] usb 2-1: New USB device strings: Mfr=1, 
Product=2, SerialNumber=0
[  230.701416] usb 2-1: Product: USB-PS/2 Optical Mouse
[  230.701416] usb 2-1: Manufacturer: B16_b_02
[  230.722839] input: B16_b_02 USB-PS/2 Optical Mouse 
as /devices/platform/musb_hdrc/usb2/2-1/2-1:1.0/input/input8
[  230.725036] generic-usb 0003:046D:C025.0001: input: 
USB HID v1.10 Mouse [B16_b_02 USB-PS/2 Optical Mouse] 
on usb-musb_hdrc-1/input0
The relevant lines of dmesg's output after unsuccessfully connecting a too power-hungry usb memory stick:
[ 2909.554962] usb 2-1: new high speed USB device using 
musb_hdrc and address 3
[ 2909.704833] usb 2-1: device v0781 p5408 is not 
supported
[ 2909.704864] usb 2-1: New USB device found, 
idVendor=0781, idProduct=5408
[ 2909.704864] usb 2-1: New USB device strings: Mfr=1, 
Product=2, SerialNumber=3
[ 2909.704895] usb 2-1: Product: U3 Titanium
[ 2909.704925] usb 2-1: Manufacturer: SanDisk Corporation
[ 2909.704925] usb 2-1: SerialNumber: 0000174B6A62108E
[ 2909.709014] usb 2-1: rejected 1 configuration due 
to insufficient available bus power
[ 2909.709045] usb 2-1: no configuration chosen from 1 choice
With "lsusb -v" you can get more information about attached USB devices. One especially interesting information is the MaxPower entry for each device. Devices that report more than 100 mA there, will not work on the USB OTG port.
 

Leave a comment

Name
E-Mail
Website
Homepage
Comment