From: Erico M. <Eri...@su...> - 2016-02-12 22:39:26
|
Date: Thu, 11 Feb 2016 20:43:03 -0600 From: "J. Leslie Turriff" <jlt...@ma...> > It's been quite a while since I attempted to access a device using ttyUSBx; >at least on my distro, I gave up when I found that the x was hardcoded in the >driver and the author didn't want to bother changing it because "nobody >really uses this." > Of course, that may just have been peculiar to that release of the distro I >was using (OpenSuSE). That sounds odd. Device allocation on most distros is dynamic, and has been for quite some time, including openSUSE. The device names are regulated by LANANA, and follow the Unix major/minor notation. A full listing can be found here: http://www.lanana.org/docs/device-list/devices-2.6+.txt In this case, /dev/ttyUSBx is a char device, major 188: # ls -ld /dev/ttyUSB0 crw-rw---- 1 root dialout 188, 0 Feb 12 20:29 /dev/ttyUSB0 The device ttyUSB0 starts with minor 0, ttyUSB1 is minor 1, and so on. Whenever the kernel detects a new device being plugged in, the UDEV subsystem allocates the next available major/minor pair for the device type and creates the proper /dev file entry. So, it’s not really hardcoded. Plug three different serial USB devices, and they may get either ttyUSB0, ttyUSB1 or ttyUSB3 for each one depending on the order they’re connected. If what you want is a fixed device name, there are ways around it. You could create an UDEV rule to make a symbolic link to a device, for example /dev/modem pointing to /dev/ttyUSBx, no matter the order you plugged it. Any of the device’s properties can be used to filter it, from the vendor/product down to the serial number of the device. I can help you write one if you wish. -- — Erico Mendonça Dedicated Support Engineer SUSE |