On Sun, 28 Jun 2009, Guennadi Liakhovetski wrote: > On Sun, 28 Jun 2009, Adam Nielsen wrote: > > > Hi all, > > > > I'm implementing a simple USB device using gadgetfs and dummy_udc to help > > reverse engineer a physical USB device which can only be used with a > > Windows-based closed-source application. I figure if I can get the Windows > > app talking to my virtual device then I can fiddle with the values it returns > > and observe what changes this triggers in the app. > > > > So far I have implemented the device basics and it correctly gets identified > > by lsusb as a HID device, almost exactly like the actual hardware device (the > > exception being the real hardware is USB1.1 only, but gadgetfs only seems to > > support USB2.0 devices.) That's right. In fact, gadgetfs forces the bcdUSB value in the device descriptor to be 2.00. > > I'm running WinXP through VirtualBox and XP correctly detects my gadgetfs > > device and uses its HID driver for it. > > > > When I run the closed-source app to access the device, it works by sending > > control messages to the device and getting interrupt messages in response. > > With the gadgetfs "device" I receive the control message and send a response > > to the interrupt endpoint without any error, but not only does XP never > > receive the interrupt message, usbmon doesn't show it either - which seems to > > indicate that gadgetfs isn't sending the interrupt message over the virtual > > USB bus. Does usbmon show the interrupt URB being submitted? If not then of course the responses won't be delivered. > > If I run my own client under Linux then it works fine, I can send a control > > message and receive an interrupt in response, although interestingly enough if > > I run my client *after* the WinXP app, I receive the interrupt message that > > was supposed to go to the XP app instead - so it seems that gadgetfs is > > storing the interrupt data but it must be waiting for a read operation to come > > along instead of sending the interrupt immediately. > > FWIW, I also suspected some problems with interrupt requests when running > my PTP gadget usbfs application on a real hardware trying to talk to a > Windows machine running in VMware on a Linux PC. Even just opening an > interrupt endpoint over USBFS and keeping it open already sends empty > replies to interrupt requests to "real" hosts - Linux, Mac OS or Windows, > but I was getting timeouts with VMware. I didn't investigate it too much, > I just switched to real hardware and there everything worked as expected. I was going to suggest exactly the same thing. It sounds like VirtualBox and VMware don't do a good job of forwarding interrupt URBs from the guest to the host. It might be possible to learn something by enabling the usbfs_snoop parameter for usbcore in the host. 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