USB OTG port to act as a USB host


I was able to work the USB OTG port to act as a USB host. I used USB hub with external power and plugs the following usb devices:

Ralink: 802.11 n WLAN

Here’s what I did based on what I need:

  1. Connect the OTG pin 4 to the ground
  2. I am using kernel 2.6.35-rc6 and compiled the following modules:
    2.1. Under USB, check Inventra Highspeed Dual Role Controller (USB_MUSB_HDRC) ‘Y’
    2.1.1. Select Both and host peripherals (USB_MUSB_OTG) ‘Y’
    2.2. check USB Gadget Support (USB_GADGET) ‘Y’
    2.2.1. USB Peripheral Controller, select Inventra HDRC USB… (USB_GADGET_MUSB_HDCR) ‘Y’
    2.2.2. USB Gadget Drivers, select ‘M’ Select Multifunction Composite Gadget ‘M’

After you compiled the kernel/module and boot your board, load the g_multi module and you will see it will detecting the usb devices that you inserted in USB HUB.

The only thing it’s not working, when you disconnect the USB HUB cable to the board then reconnect it again. Seems, the g_multi module didn’t detect the disconnection.

hope it helps,

john tobias

I`m having the same problem on the GumStix Overo, the OTG port does
not detect disconnects. Have you had any luck figuring out the
problem? My software that uses libusb doesn't work properly when the
devices are reconnected, a hub or the host port has to be used, which
is a pain.

No luck yet…

When I disconnect stuff from the OTG port sometimes it goes idle, and
simply doesn't want to work neither as a host nor as a device. In
these cases I manually kick it back to host mode (sometimes twice) and
it continues to work:

echo host >/sys/devices/platform/musb_hdrc/mode

(strange but it helps in device configurations too)


I think I have a better solution.
I am using g_ether module (you may try this in other otg module) and if I unload and reload the module after un-plugging the hub and plug it again, it will do the enumeration again.

I modified the /etc/udev/scripts/ and added the following command lines under remove) case statement.

rmmod g_ether
sleep 1
modprobe g_ether

Here’s how it works.

If I unplug the usb hub, the driver of my USB devices automatically unregister itself and causing the udev trigger/s an event. Since, my devices are network devices, udev will call /etc/udev/scripts/ to take a network down. Since, i-reloaded the g_ether module, I’ve got a fresh module and waiting for an usb event.