How to find out which USB-RS232 device is on which tty?

后端 未结 3 1175
梦如初夏
梦如初夏 2021-01-30 03:36

I have two different USB devices based on the same USB-RS232 chips. When I plug those in the USB they are mounted to /dev/ttyUSB0...3

My problem is how, inside a script,

3条回答
  •  北海茫月
    2021-01-30 03:53

    This one-liner udev rule will give a fixed name (e.g. /dev/ttyUSB_A9YL5BJJ) based on serial number for any device with vendor/product ids as given.

    Put this into a udev rules file e.g. /etc/udev/rules.d/60-ftdi-serial-names.rules

    SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ENV{ID_SERIAL_SHORT}=="?*", SYMLINK+="ttyUSB_%E{ID_SERIAL_SHORT}"
    

提交回复
热议问题