Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Due to a new version of CUPS, I suddenly lost the direct path to my printers that was previously available under /dev/usb/lpXXX. I used this to print directly from the command line. echo "test" > /dev/usb/lp0.

After searching I found a way to fix this, by commenting out blacklist usblp in /etc/modprobe.d/blacklist.conf. This indeed works, but if I do so CUPS will no longer be able to communicate with any printer (and I do need that). So how can I have some sort of direct path to my printer, and still have CUPS working?

NOTE: some of the (receipt) printers are not recognized by CUPS, so lpr will not work for those.

share|improve this question
    
The Archwiki has some paragraphs on this issue, in the end they advise to use the usblp module to load the firmware (e.g. cat sihp1020.dl > /dev/usb/lp0) and rmmod it afterwards. (Ugly, indeed.) –  sr_ Mar 18 '12 at 13:31
    
    
For future reference, I confirm that DEVICE_URI="usb://HP/LaserJet%20102?serial=XYZ" /usr/lib/cups/backend/usb 1 1 1 1 '' ~/sihp1020.dl is a working libusb-ish way to send the firmware to a printer that needs it (and that, using usblp, got it sent to via cat sihp1020.dl > /dev/usb/lp0 before). This could also be used to send arbitrary files to the USB printer, so the OP could give this a try. –  sr_ Mar 19 '12 at 8:42
    
Another thing to try, according to this, there could be a way to use CUPS with the usblp module, by configuring it to use file:/dev/usb/lp0 instead of usb:/dev/usb/lp0. –  sr_ Mar 19 '12 at 14:39
add comment

3 Answers

I can confirm that the above solution works fine for me. I use OpenWRT with CUPS on it to print via the router (TL-WR1043ND). I use an HP Laserjet P1005. This one needs a firmware uploaded each time it powers on. I put the firmware in /usr/lib and used the following command:

DEVICE_URI="usb://HP/HP%20LaserJet%20P1005?serial=BB0417Y" /usr/lib/cups/backend/usb 1 1 1 1 '' /usr/lib/sihpP1005.dl

Where usb://HP/HP%20LaserJet%20P1005?serial=BB0417Y needs to be replaced with yours. You can find it by using the /usr/lib/cups/backend/usb command.

share|improve this answer
add comment

What is your version of CUPS and distribution? Since 1.4.x, CUPS can use libusb to talk to the USB device nodes instead of going through lpusb.

share|improve this answer
add comment

Can you state your printer brand and model, please? Also, what is your distribution? Also, what is your CUPS version? I'm not clear what the problem described in the first paragraph is. You can set up printing with CUPS via USB. It is (usually) not a big deal. Can you elaborate on how you originally set it up? Note that CUPS has an lpr utility, which in Debian at least is in the cups-bsd package, and can be used to print from the command line, using CUPS as the backend, in the usual fashion, i.e. lpr filename.

Normally when USB is set up, your /etc/cups/printers.conf will look something like this. My current printer is using USB.

# Printer configuration file for CUPS v1.4.4
# Written by cupsd
# DO NOT EDIT THIS FILE WHEN CUPSD IS RUNNING
<DefaultPrinter SamsungLaser>
Info SamsungLaser
MakeModel Samsung ML-2850 Series PS
DeviceURI usb://Samsung/ML-2850%20Series
[...]

This is usually set up using the command-line command lpadmin. The command looks something like this:

/usr/sbin/lpadmin -p printer -E -v device -P ppd_file

Run this as root or a user in the lpadmin group. In this the device is usb://something. To find the USB device corresponding to your printer, try

lpinfo -l -v

Of course you need to make sure it is plugged in and switched on. Someone suggested running /usr/lib/cups/backend/usb, which also worked for me. But lpinfo is more standard. How did you come to be using /dev/usb/lpXXX in the first place?

On my computer I get the following output:

/usr/lib/cups/backend/usb

DEBUG: list_devices_libusb
DEBUG: usb_find_busses=2
DEBUG: usb_find_devices=5
direct usb://Samsung/ML-2850%20Series "Samsung ML-2850 Series" "Samsung ML-2850 Series" "MFG:Samsung;CMD:PCL5E,PCL6,POSTSCRIPT;MDL:ML-2850 Series;CLS:PRINTER;STATUS:BUSY;" ""

You can check out the CUPS Software Adminstrator's Manual for further information. Apple has done something weird with the documentation for more recent CUPS versions, so this is for CUPS 1.1 but should still be valid.

Note: I wouldn't start blacklisting modules unless you are really sure that is the problem.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.