Wednesday, April 11, 2012

Restoring usblp and /dev/usb/lp0

In our firmware development, we use /dev/usb/lp? to talk with our printers. For example:

% python pjltest.py /dev/usb/lp0  # run some PJL tests

Whenever a USB printer is attached, a new char dev node is populated in /dev/usb. The dev node can be read/written just like a file so it's quite easy to communicate with the printer's USB without having to write C code on libusb.

Ubuntu 11.10 did away with the usblp driver. From what I understand, CUPS has stopped using /dev/usb/lp? files to talk with the USB print interface. However, the usblp driver will grab the print interface, effectively blocking CUPS.

The solution in Ubuntu 11.10 (11.04 still had /dev/usb/lp?) was to add usblp to a modeprob blacklist. To restore the /dev/usb/lp?, edit /etc/modprobe.d/blacklist-cups-usblp.conf and comment out the line:

blacklist usblp

For example
#blacklist usblp

On the next USB plug, modprobe is once again free to load usblp.

Note: this will probably break CUPS which is why usblp was added to the blacklist in the first place.