Home:ALL Converter>hid usb gadget driver link to particular usb port

hid usb gadget driver link to particular usb port

Ask Time:2016-03-18T23:32:32         Author:jmzhang18

Json Formatter

I am trying to write Linux HID USB gadget driver on my linux machine. Since linux (kernel version: 2.6.37) already has completed HID gadget driver, I use it as a template. By referring the following websites: www.kernel.org/doc/Documentation/usb/gadget_hid.txt

Here are the Linux HID USB gadget driver code: https://android.googlesource.com/kernel/common/+/2b9b0b6a95cb7adbdd4fa03bff2c7dec86852aa0/drivers/usb/gadget/hid.c

And this is my Linux machine USB subsystem block diagram enter image description here

By reading the instruction (gadget_hid.txt), I can successfully generate a kernel module. The problem is, my USB port 0 has been used by other gadget driver, when trying to insmod g_hid.ko, the error message "device is busy" always prompts up. Unless I rmmod the gadget driver on USB port 0 and insmod g_hid.ko, then my host can receive correct HID signal from USB port 0. My question is, can I possibly hook up this HID gadget driver to USB port 1 only? Could anyone tell me, when USB connected, how the Linux machine deal with the gadget driver, on the slave side?


Author:jmzhang18,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/36088380/hid-usb-gadget-driver-link-to-particular-usb-port