On Fri, Apr 10, 2020 at 2:29 AM Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote: > > On Thu, 9 Apr 2020, Andrey Konovalov wrote: > > > Hi Alan and Greg, > > > > I've been thinking about what kind of features raw-gadget might be > > missing, that would allow more flexibility in emulating USB devices. > > One of the things that is currently missing is halting endpoints. > > Adding this functionality seems to be fairly easy, but it's unclear to > > me how to test it. Any suggestions? > > You should use the usbtest driver along with the testusb program in > tools/usb. Of course, to do it you will need a userspace driver for > raw-gadget. usbtest works best with gadget-zero, but it can be used > (in degraded form) with any USB device. Oh, right, I'll try that! > > Also, are there some other features that might make sense to add? I > > see that e.g. GadgetFS has GADGETFS_FIFO_STATUS/FLUSH ioctls. Are > > those useful? > > I believe that was included just as an emulation of some existing UDC > hardware. It's rather controller-specific, not of general interest. > (The general idea is that the UDC says that an IN request completes > when its data has been loaded into the controller's FIFO, rather than > when the data has actually been sent to the host.) OK, then I guess raw-gadget won't need those at least just yet. > Have you implemented wedge as well as halt? Wedge is needed for the > mass-storage protocol; as far as I know it isn't used anywhere else. No, I didn't know about "wedge" at all :) Looks like the API for it is really simple, just usb_ep_set_wedge(). I'll need to figure out what it is and how it works, and I'll send a patch that adds halt/wedge support then. > And have you given any thought to suspend/resume support? It's a bit > tricky because you have to consider both gadget suspend and USB bus > suspend. Hm, no. Is there something specific I need to consider to support it? I guess I'll need to read about how it works as well, before I can understand what it would require and ask meaningful questions. > Nothing else springs to mind. Something else: I've been testing raw-gadget with various UDCs that I have [1] and everything seems to work, except for emulating SuperSpeed devices with net2280. I've just found it out yesterday night, and haven't had a chance to debug that yet, but if you know about some potential issues I could encounter with SuperSpeed/USB3+, please let me know. Thank you, Alan! [1] https://github.com/xairy/raw-gadget#usb-device-controllers