axel@dellbox:~$ dmesg | egrep "ttyUSB|ttyACM" ftdi_sio ttyUSB1: FTDI USB Serial Device \
converter now disconnected from ttyUSB1 usb 1-2.6: FTDI USB Serial Device converter now \
attached to ttyUSB1Recently I found, that the udev system under Linux povides a much more sophisticated way to assign user specified names to the boards. The udev daemon can assign the name according to the serial number, that is stored in the USB chip of the transceiver board or in an EEPROM. Read in the next section how this can be used ...
Finding the Serial Numbers
The serial number of an USB interface can be read with the tool lsusb. Connect the board with the PC and enter the command lsusb -vv | less, scroll trough the text and search e.g. for a FT232:$sudo lsusb -vv | less
Bus 001 Device 016: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Device Descriptor:
...
idProduct 0x6001 FT232 USB-Serial (UART) IC
bcdDevice 6.00
iManufacturer 1 FTDI
iProduct 2 FT232R USB UART
iSerial 3 A700evIv
Note: The serial number is only displayed, if you are root.
Writing a udev Rule
Now create as superuser the file 41-uracoli-boards.rules in /etc/udev/rules.d/ and add the line:KERNEL=="ttyUSB*", ATTRS{serial}=="A700evIv", NAME:="uracoli/rafa1", GROUP="dialout", MODE="0660"
- KERNEL=="ttyUSB*" checks for udev event with /dev/ttyUSBx
- ATTRS{serial}=="A700evIv" checks the serial number that was found with lsusb
- NAME:="uracoli/rafa1" creates a device node with name /dev/uracoli/rafa1
- GROUP="dialout", MODE="0660" sets the access permissions for all users in group "dialout".
Now the new udev-rules needs to be reloaded. This is done with the command
service udev restart (under Centos use: udevcontrol reload_rules ). After unplugging and replugging the board check the existence of the new devices nodes:
$ls -l /dev/uracoli/
crw-rw---- 1 root dialout 188, 0 2012-09-01 18:55 rafa1For those who need the original names and still want the new names, there is a SYMLINK option available in udev. Change the above rule like that:
KERNEL=="ttyUSB*", ATTRS{serial}=="A700evIv", SYMLINK+="uracoli/rafa1", GROUP="dialout", MODE="0660"
and an additional symlink that points to /dev/ttyUSBx is created.
If you finally glue some nice labels on the boards, there is no more who-is-who confusion in your setup.
Still some troubles
It was found that the most of the CP21xx driver based boards came with out a serial number, e.g. with the default 0x0001. The only exception was the the Meshnetics Meshbean board. Here I need to check, if the serial number can be assigned under Linux. Most of the vendors ANS or InCirquit do not brand the boards, that means there the only way is to set the chip serial number. For the Raven RZUSB sticks with uracoli Firmware, they do also not have a serial number. Here the situation is a bit easier, since the uracoli vendor and product ID (vendor=0x16c0 VOTI, product=0x0887) would allow at least to enumerate the device as (rzusb0, rzusb1) according to the sequence of plugging of the sticks.Stay tuned for updates of this article with solutions for the above points.
Keine Kommentare:
Kommentar veröffentlichen