Thursday, 17 January 2013
Receipt printer udev rules
We use the Epson and DigiPOS line of receipt printers for most of our retail customers as both use similar lingo and could possibly be the most reliable printers I've ever encountered (Epson being the best in my opinion but more expensive).
The printers work perfectly in Linux except for when they are plugged out and back in, often due to the permissions changing and not allowing direct access to the device from a normal user access, a chmod 666 /dev/usb/lp0 usually fixes this for the time being.
To add a udev rule to always have a eg. 666 mode on the device:
lsusb <- run 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:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 006: ID 0525:a700 Netchip Technology, Inc. << The printer in my case
Bus 001 Device 004: ID 04f2:b272 Chicony Electronics Co., Ltd Lenovo EasyCamera
Bus 002 Device 003: ID 0489:e00d Foxconn / Hon Hai
Bus 002 Device 004: ID 0bda:0139 Realtek Semiconductor Corp.
Open /etc/udev/rules.d/15-printers.rules and add the line:
Make sure to change the idVendor and idProduct to the lsusb values eg. 0525:a700 in my case, ie. 0525 being vendor ID and a700 being product ID.
Reload the rules (you can also: restart udev):
udevadm control --reload-rules