For example sometime:
[9.019817] usb 2-1.4: Qualcomm USB modem converter now attached to ttyUSB0 [9.053636] usb 2-1.6: pl2303 converter now attached to ttyUSB1or sometime so:
[9.053636] usb 2-1.6: pl2303 converter now attached to ttyUSB0 [9.019817] usb 2-1.4: Qualcomm USB modem converter now attached to ttyUSB1
The "pl2303 converter" is a USB-serial adapter that I need for some special hardware.
Because of this inconsistent mapping I needed to change quite often the settings in my software.
To solve the problem I created a symbolic device link for the USB-serial adapter, as described below:
1 step: detect the "idVendor" and "idProduct" of your hardware
$ lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub Bus 001 Device 003: ID 147e:2016 Upek Biometric Touchchip/Touchstrip Fingerprint Sensor Bus 001 Device 004: ID 0a5c:217f Broadcom Corp. Bluetooth Controller Bus 001 Device 005: ID 17ef:1009 Lenovo Bus 001 Device 006: ID 17ef:480f Lenovo Integrated Webcam [R5U877] Bus 002 Device 003: ID 05c6:9204 Qualcomm, Inc. Bus 002 Device 004: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port Bus 001 Device 007: ID 046d:c018 Logitech, Inc. Optical Wheel Mouse Bus 001 Device 008: ID 046a:0023 Cherry GmbH CyMotion Master Linux Keyboard Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
In my case was the "Prolific Technology, Inc. PL2303 Serial Port". The "idVendor" is 067b while the "idProduct" is 2303
2 step: add an udev rule to create a symbolic device link everytime that the hardware is attached.
go to '/etc/udev/rules.d/' and create a file named for example '97-local.rules' with this content:
kernel=="ttyUSB*", SYSFS{idVendor}=="067b", SYSFS{idProduct}=="2303", SYMLINK="SerialUSB"
3 step: restart you system... you've done!
Give a look to your /dev directory. You shoud now see a device named /dev/SerialUSB
You can create udev rules also for other purposes, for example run a script when a new hardware is detected.
No comments:
Post a Comment