OK, I got the needed answer from the following link: http://osdir.com/ml/linux.usb.general/2008-05/msg00056.html Thanks for help, Alan. Regards, Aniruddha On Mon, Apr 13, 2009 at 3:46 PM, Aniruddha Marathe <marathe.aniruddha@xxxxxxxxx> wrote: > Yes Alan, the values you have mentioned are correct. I am following > the usb.c program and I have inserted read() with 0 bytes to read for > sending an ACK. However, usb.c itself gets hung when it reaches the > read() call with 0 bytes to read and so does my driver program. In the > sniffer output, I see that the SET_CONFIGURATION ACK response is sent > over to the host and the host then asks for the report descriptor. But > my program is unable to respond to the request since it is hung. > > I am using kernel 2.6.28 on Ubuntu 8.04. I am using the version of > usb.c example on http://www.linux-usb.org/gadget/usb.c. I assumed that > this version of usb.c should work with 2.6.28. Is this correct? > > I also came across this article: > http://www.nabble.com/USB-proxy-the-other-way-td10167713.html > > It states that one needs to comment out 'select USB_GADGET_DUALSPEED' > in Kconfig in 'gadgets' so that gadgetfs does not freeze out, like > what I am experiencing. So I did that and recompiled and now I am > getting 'Invalid arguments' error for the same descriptors that used > to work earlier, when I try to write the device descriptor buffers to > '/dev/gadget/net2280'. I am not sure why this is happening, trying to > debug... > > Appreciate your help in this matter. > > Regards, > Aniruddha > > On Mon, Apr 13, 2009 at 11:09 AM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote: >> On Sun, 12 Apr 2009, Aniruddha Marathe wrote: >> >>> > Get-Device-Qualifier is sent only to USB-2.0 devices. No doubt your >>> > real keyboard is USB-1.1. >>> > >>> >>> Thanks for clearing that out. I am specifying the device type as USB >>> 1.1. However, I see USB 2.0 type of device when I list the device on >>> the host. Here are the device and hid descriptors I use for the >>> device: >>> >>> static struct usb_device_descriptor device_desc = { >>> .bLength = sizeof device_desc, >>> .bDescriptorType = 1, >>> .bcdUSB = __constant_cpu_to_le16(0x0110), >>> .bDeviceClass = 0, >>> .bDeviceSubClass = 0, >>> .bDeviceProtocol = 0, >>> .idVendor = __constant_cpu_to_le16(KEYBOARD_VENDOR_NUM), >>> .idProduct = __constant_cpu_to_le16(KEYBOARD_PRODUCT_NUM), >>> .bcdDevice = 0x0100, >>> .iManufacturer = STRING_MANUFACTURER, >>> .iProduct = STRING_PRODUCT, >>> .iSerialNumber = STRING_SERIALNUM, >>> .bNumConfigurations = 1 >>> }; >>> >>> static struct hid_descriptor hid_config_desc = { >>> >>> .bLength = sizeof(hid_config_desc), >>> .bDescriptorType = 0x21, >>> .bcdHID = 0x0110, >>> .bCountryCode = 0, >>> .bNumDescriptors = 1, >>> .desc[0].wDescriptorLength = sizeof(ReportDescriptor), >>> .desc[0].bDescriptorType = 0x22 >>> }; >>> >>> [aniruddha@localhost ~]$ cat /proc/bus/usb/devices >>> >>> T: Bus=04 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 7 Spd=12 MxCh= 0 >>> D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 >>> P: Vendor=4242 ProdID=0110 Rev= 1.00 >>> S: Manufacturer=Microsoft Corporation >>> S: Product=Microsoft Natural Keyboard Pro >>> C: #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA >>> I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver= >>> E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=3ms >>> >>> I am not sure why it shows Ver= 2.00, even though I specify 1.1. >> >> This is because the gadgetfs driver overrides the value provided by >> your program; it always sets the version to 2.00. (It also always >> sets the number of configurations to 1, but I don't why, since >> specifying any other number of configurations would cause it to reject >> the device descriptor with an error.) >> >>> >> Was the response >>> >> to the earlier 'GET DEVICE DESCRIPTOR' request malformed (the sniffer >>> >> doesn't indicate that, however)? >>> > >>> > I can't tell since Wireshark doesn't display the response data >>> > properly. >> >> If KEYBOARD_VENDOR_NUM is 0x4242, KEYBOARD_PRODUCT_NUM is 0x0110, and >> STRING_SERIALNUM is 0, then the device descriptor was sent correctly. >> >> However the usbmon trace shows that your program still doesn't respond >> properly to Set-Configuration. The program has to read a 0-length >> message from the control file to tell the host that the request has >> been carried out. Look at what the demo usb.c program does at the end >> of the USB_REQ_SET_CONFIGURATION case in handle_control(). >> >> Alan Stern >> >> > -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html