What is the difference between /dev/tty* and /dev/bus/usb/001/002?
Matthew Harrington
When I plug in a device that uses the LUFA USB framework (or any USB<->serial peripheral), Ubuntu creates a /dev/ttyACM* device file. It also creates a /dev/bus/usb/001/002 file and a /sys/bus/usb/devices/usb1/1-1/1-1.3/1-1.3.1/ tree.
What are the differences between these? I ask because I am using pyudev, which provides device nodes such as the /dev/bus/... example, but I don't know if this is different to the tty. Is it?
1 Answer
The /sys/bus/usb/devices/* tree describes the full physical USB topology, and contains metadata about each device.
The /dev/bus/usb/<bus number>/<device number> devices address each device in a simplified way (so you don't have to care about whether a device is connected directly or via one or more USB hubs, just pick the right bus) and allows passing raw USB packets to/from the device. With a USB serial converter, you might send a request packet and get back a response describing the current state of the serial port's handshaking lines.
The /dev/ttyACM* device, on the other hand, hides the complexity of the USB bus and allows you to control the serial port of the USB<->serial peripheral pretty much like a directly-connected serial port, with all the features of a Unix-style tty driver. Because of the latencies caused by the USB bus, some things may not work as well as with a "real" serial port: in particular, attempts to bit-bang the control lines with precise timing might not work.