Hello everyone,
I am trying to implement a USB device in user mode using the gadgetfs module. I am working off from the sample file http://www.linux-usb.org/gadget/usb.c and adding the support for 'fsl-usb2-udc' by adding the following in the function autoconfig():
else if (stat (DEVNAME = "fsl-usb2-udc", &statb) == 0) {
HIGHSPEED = 1;
device_desc.bcdDevice = __constant_cpu_to_le16 (0x0100),
fs_source_desc.bEndpointAddress = hs_source_desc.bEndpointAddress = USB_DIR_IN | 7;
EP_IN_NAME = "ep-a";
fs_sink_desc.bEndpointAddress = hs_sink_desc.bEndpointAddress = USB_DIR_OUT | 3;
EP_OUT_NAME = "ep-b";
source_sink_intf.bNumEndpoints = 3;
fs_status_desc.bEndpointAddress = hs_status_desc.bEndpointAddress = USB_DIR_IN | 11;
EP_STATUS_NAME = "ep-f";
}
So far both the sink and source endpoints are working nicely. Here's the only problem: when the host requests the string descriptors, the requests are successfully detected at my device end, and the corresponding string is sent (using the write system call) to endpoint 0, which is the file /dev/gadgetfs/fsl-usb2-udc. However, the host does not receive the strings and times out.
Does anyone have an idea of how I should properly send data through endpoint 0 of the fsl-usb2-udc driver? Thank you!
I am currently trying to do exactly that! And I would really appreciate your help!
Could you tell me, did you use the mount -t gadgetfs /dev/gadget/ command?
I created /edv/gadget/ but the autoconfig() function returns 0 because there's nothing mounted in there.
Thanks!!