Difference between revisions of "Udev"

From
Jump to: navigation, search
(Created page with "== Giving a static device name == * Get the automatically assigned device name sudo dmesg | grep tty [21151.646593] cdc_acm 1-2:1.2: ttyACM0: USB ACM device * Get vendor and p...")
 
 
Line 1: Line 1:
 
== Giving a static device name ==
 
== Giving a static device name ==
 
* Get the automatically assigned device name
 
* Get the automatically assigned device name
sudo dmesg | grep tty
+
sudo dmesg | grep tty
[21151.646593] cdc_acm 1-2:1.2: ttyACM0: USB ACM device
+
[21151.646593] cdc_acm 1-2:1.2: ttyACM0: USB ACM device
 
* Get vendor and product id
 
* Get vendor and product id
 
  udevadm info --name=/dev/ttyACM0 --attribute-walk | grep idProduct
 
  udevadm info --name=/dev/ttyACM0 --attribute-walk | grep idProduct
Line 10: Line 10:
 
     ATTRS{idVendor}=="0483"
 
     ATTRS{idVendor}=="0483"
 
     ATTRS{idVendor}=="1d6b"
 
     ATTRS{idVendor}=="1d6b"
 +
* Create a new rule
 +
sudo nano /etc/udev/rules.d/50-usb-serial.rules
 +
* Insert
 +
SUBSYSTEM=="tty", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", SYMLINK+="specificName"
 +
* Activate the rule
 +
sudo udevadm trigger
 +
* Now the device should be available with the new name
 +
ls -l /dev/specificName
 +
lrwxrwxrwx 1 root root 7 Apr 26 07:33 /dev/specificName -> ttyACM0

Latest revision as of 07:37, 26 April 2023

Giving a static device name[edit]

  • Get the automatically assigned device name
sudo dmesg | grep tty
[21151.646593] cdc_acm 1-2:1.2: ttyACM0: USB ACM device
  • Get vendor and product id
udevadm info --name=/dev/ttyACM0 --attribute-walk | grep idProduct
   ATTRS{idProduct}=="374b"
   ATTRS{idProduct}=="0002"
udevadm info --name=/dev/ttyACM0 --attribute-walk | grep idVendor
   ATTRS{idVendor}=="0483"
   ATTRS{idVendor}=="1d6b"
  • Create a new rule
sudo nano /etc/udev/rules.d/50-usb-serial.rules
  • Insert
SUBSYSTEM=="tty", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", SYMLINK+="specificName"
  • Activate the rule
sudo udevadm trigger 
  • Now the device should be available with the new name
ls -l /dev/specificName 
lrwxrwxrwx 1 root root 7 Apr 26 07:33 /dev/specificName -> ttyACM0