On Mon, 8 Aug 2011, Chris Furlough wrote: > > Wait, you want to emulate a USB device on the same host as the kernel is > > running on in host mode, or to be a USB device and connect it to a host? > > I want to emulate a device so that user mode applications can be developed > in the absence of the hardware. > (Since it's not ready yet, but the timeline is VERY compressed, so we need > to get the developers up and going > quickly, and a driver that emulates the hardware is the easiest way.) > > > <snip> > > > > No, you can't do this at all, usbfs is to control a USB device from a > > userspace program, which I think it not what you really want to do, > > right? > > That's EXACTLY what I want to do. I want my driver to register itself with > USBFS, No, that's not what you want. You want your driver to emulate the hardware device currently under development. Registration with usbfs is handled entirely within the host, so it has nothing to do with your driver. > and for their code (excerpted in the 1st e-mail), > to be able to find, and interact with my driver as though I were the real > hardware. You can do what you want by using the Gadget framework. See include/linux/usb/gadget.h and <http://www.linux-usb.org/gadget/>. You might even be able to implement your program entirely in userspace rather than in the kernel; see include/linux/usb/gadgetfs.h and <http://www.linux-usb.org/gadget/usb.c> for sample code. If you don't have any USB device hardware, you can still use dummy-hcd and run your driver on the host computer. 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