PORTS Forum
Ports and Interfaces => USB => Topic started by: st2000 on February 19, 2014, 07:03:51 pm
-
Hi,
Is there a better place to talk about the gadget drivers and how to make a Linux computer act like a USB PERIPHERAL (aka DEVICE)?
My questions for now are basic. For instance, given most Linux boxes have several USB port, how do you run something like the gadget g_serail.ko on a specific port? Or am I looking at this all wrong?
-thanks
-
Every USB communication is between a host computer and a USB device. The hardware interface and programming differs for host and device ports.
A typical Linux PC has USB host ports.
To use the gadget driver, you need a USB device port or an OTG port configured to function as a device port.
The BeagleBoard and some other Linux embedded systems have OTG ports and can use the gadget driver.
-
To use the gadget driver, you need a USB device port...
So, there is no way one can use a USB Type A Socket as a USB DEVICE. Even if you modify it some how? I don't think I'll be forced to try - but it would be nice to know what if anything can be done.
... or an OTG port configured to function as a device port.
Yes, yes, but how do you configure it as a device port? I plugged in a cable to an OTG micro connector. I verified that pin 4 of the cable was not shorted to ground. This should signal the embedded Linux computer (a TI.COM OMAP board) that this USB port is to be a USB DEVICE. But when I plugged the other end of the USB cable (Standard Type A Plug) into another Linux computer (which should be playing the part of USB HOST) it reported "nothing". I was using the "lsusb" command.
The BeagleBoard and some other Linux embedded systems have OTG ports and can use the gadget driver.
The OMAP board I am using has 2 Type A USB 2.0 Sockets, 1 USB 2.0 micro Socket, 1 USB 3.0 micro Socket. If I did an "modprobe g_multi.ko" to install the Gadget Multiple USB DEVICE driver - well - I don't see how to tell it which physical USB port is to be used as the DEVICE USB port. It would be helpful to see the step-by-step for setting up, say, a USB Serial DEVICE on a specific physical USB port on an embedded Linux box.
-thanks
-
So, there is no way one can use a USB Type A Socket as a USB DEVICE. Even if you modify it some how? I don't think I'll be forced to try - but it would be nice to know what if anything can be done.
No, the hardware is different.
Yes, yes, but how do you configure it as a device port? I plugged in a cable to an OTG micro connector. I verified that pin 4 of the cable was not shorted to ground. This should signal the embedded Linux computer (a TI.COM OMAP board) that this USB port is to be a USB DEVICE. But when I plugged the other end of the USB cable (Standard Type A Plug) into another Linux computer (which should be playing the part of USB HOST) it reported "nothing". I was using the "lsusb" command.
You need to load a gadget driver on the device with modprobe.
On the BeagleBoard with Angstrom, you can use
cd /sys/devices/platform/musb_hdrc
cat mode
to find out if an OTG port has switched to device mode. I don't know if your board has that or something similar.
The OMAP board I am using has 2 Type A USB 2.0 Sockets, 1 USB 2.0 micro Socket, 1 USB 3.0 micro Socket. If I did an "modprobe g_multi.ko" to install the Gadget Multiple USB DEVICE driver - well - I don't see how to tell it which physical USB port is to be used as the DEVICE USB port. It would be helpful to see the step-by-step for setting up, say, a USB Serial DEVICE on a specific physical USB port on an embedded Linux box.
modprobe loads the driver. The descriptors the device returns on enumeration determine the device function.
-
Yes, yes, but how do you configure it as a device port?
You need to load a gadget driver on the device with modprobe.
That worked! This particular embedded Linux board is running Ubuntu and was compiled with Gadget enabled/available. When I did a "modprobe g_serial" I found Gadget supporting a PERIPHERAL(DEVICE) USB on the board's Mini OTG USB port.
I think what I would really like to know is where you tell Gadget how to set its self up when you do a, for instance, "modprobe g_serial". I have a sneaking suspicion that one does this "configuration magic" at compile time - not at modprobe time.
-thanks
-
For OTG ports, the port should configure itself as a device port on detecting insertion of a micro-B plug.
modprobe loads the g_serial driver to support the device function.
If that answers your question...