Persistent names for usb and serial devices

Persistent names can be set for printers and similar devices


Connect the device and from Saleculator shell (Ctrl+Alt+F1), give the below command:

usb-devices

Not down the value of SerialNumber. If the above command not working, use below command:

udevadm info -a -p$(sudo udevadm info -q path -n /dev/usb/lp0)

Replace /dev/usb/lp0 to the desired device name you want to set a persistent name.
From the output of the command, note down an attribute which is unique for the device (i.e. ATTRS{serial}==”xxxxxxxxxxxxxx”).
Now give the below command:

nano /etc/udev/rules.d/99-printer.rules

Type remountrw and try above command (In case it doesn't let you save the changes. Mostly old devices)

Add the below line to this file:

ACTION=="add", ATTRS{serial}=="xxxxxxxxxxxxxx", SYMLINK+="ticket"
or
ACTION=="add", ATTRS{idProduct}=="xxxx", SYMLINK+="ticket"

You can replace “ticket” with your desired device name.
Now give the below command to apply the changes:

/etc/init.d/udev restart

Unplug and plug back the device and check the fixed device name created

ls -al /dev/ticket

0 Comments

Leave a Reply

Arrow-up