On Wed, 18 Aug 2010, Mark Hackett wrote: > I had hoped that, like the standard LPT1: and COM1: devices under DOS > that a USB device would be able to be written to without a driver as > long as you sent the right protocol down to the device (or endpoint). A forlorn hope... > E.g. under dos you could: > > C:> cat myfile.txt > LPT1: > > and your printer would print the ASCII file out. > > Doesn't seem to work for USB, despite being apparently a serial bus. No, it doesn't work. Although USB _is_ a serial bus, it uses a complex packet-based protocol. > So, am I barking up the wrong tree about how you must talk to a USB > device in Linux? Yes. > Do you HAVE to write a URB, or is there a way to (if > you have a USB printer that will accept ASCII text stream for > printing) "cat myfile.txt > /dev/usb/2-1:1.1" and get the printer on > that device printing your text? As Greg mentioned, all you need to do is use the USB printer driver that comes with your operating system (such as "cat myfile.txt > /dev/lpusb0"). If you don't want to use the driver then yes, you _do_ have to use URBs. > If you HAVE to URB, why? That's how USB devices work. Try skimming the USB-2.0 specification, freely available from www.usb.org. Although it is quite technical, many parts of it are very readable. > Is this something that could be done at the > USB subsystem level to let a binary/ascii stream go to the device, > packaged by the fact that it's in the USB subsystem into microframes > by that system itself, and leave it up to the user to know that the > file being sent there is talking the jive with the device. That's basically what the USB drivers already do. > NOTE: I do have a device which is a BULKIO device and I know the > binary protocol to make it work. I'd rather make a perl program that > writes up the binary packet and prints it to the device than have to > make a device driver or build up Device::USB etc for any platform > (e.g. OLPC) that I want to drive it with. Have you looked into libusb (www.libusb.org)? It seems to be what you want. 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