Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USB (libusb) backend needs to print an error message when the open fails #5658

Closed
salfter opened this issue Oct 1, 2019 · 12 comments
Closed
Assignees

Comments

@salfter
Copy link

salfter commented Oct 1, 2019

I picked up a Zebra LP2844 cheap off of eBay today...tested it at work under Windows 10, and now I want to get it running at home under Gentoo Linux. CUPS is built with libusb support and /usr/libexec/cups/backend/usb finds the printer and returns usb:https://Zebra/LP2844?serial=42A062401950 as the printer URL. lpinfo -v shows no indication of the printer, though, and "Find New Printers" in the CUPS web interface returns nothing.

If I enable CONFIG_USB_PRINTING in the kernel source and recompile, plugging in the printer now causes it to show up at /dev/usb/lp0. I can manually configure the printer in CUPS, telling it to print to file:https:///dev/usb/lp0 (after tweaking /etc/cups/cups-files.conf appropriately), and the test page and a label I knocked together in LibreOffice will priint successfully. If I unload the usblp kernel module and change the printer configuration from the file: URL to the usb: URL, print jobs get stuck. If I reload usblp and change the configuration back to the file: URL, jobs in the queue will finally print.

@michaelrsweet
Copy link
Collaborator

What version of CUPS?

What does the /var/log/cups/error_log file show when you run "lpinfo -v"?

@michaelrsweet michaelrsweet self-assigned this Oct 1, 2019
@michaelrsweet michaelrsweet added unable-to-reproduce Unable to reproduce investigating Investigating the issue labels Oct 1, 2019
@salfter
Copy link
Author

salfter commented Oct 1, 2019

I'm running CUPS 2.2.12 on Gentoo Linux. It's built with the following configuration:

[ebuild   R    ] net-print/cups-2.2.12::gentoo  USE="X acl dbus pam python ssl threads usb -debug -java -kerberos -lprng-compat (-selinux) -static-libs -systemd -xinetd -zeroconf" ABI_X86="32 (64) (-x32)" PYTHON_TARGETS="python2_7" 0 KiB

The usb USE flag tells it to build against libusb (and libusb 1.0.21 is installed).

lpinfo -v returns the following:

network https
network ipps
network http
network lpd
network ipp
network socket
network beh
direct hp
network smb

lsusb returns the following...notice that the printer shows up here:

Bus 002 Device 002: ID 8087:8001 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8009 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 045e:00cb Microsoft Corp. Basic Optical Mouse v2.0
Bus 003 Device 002: ID f617:0905
Bus 003 Device 010: ID 0a5f:0009 Zebra LP2844 Printer
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

/usr/libexec/cups/backend/usb returns this:

DEBUG: Loading USB quirks from "/usr/share/cups/usb".
DEBUG: Loaded 95 quirks.
DEBUG: list_devices
DEBUG: libusb_get_device_list=9
DEBUG2: Printer found with device ID: MFG:Zebra ;CMD:None;MDL:LP2844 ; Device URI: usb:https://Zebra/LP2844?serial=42A062401950
direct usb:https://Zebra/LP2844?serial=42A062401950 "Zebra LP2844" "Zebra LP2844" "MFG:Zebra ;CMD:None;MDL:LP2844 ;" ""

@salfter
Copy link
Author

salfter commented Oct 1, 2019

I'm going to try upgrading to CUPS 2.3.0 to see if that makes a difference.

@salfter
Copy link
Author

salfter commented Oct 1, 2019

CUPS 2.3.0 doesn't behave any differently than the older version.

@michaelrsweet
Copy link
Collaborator

@salfter I need to see whatever errors are being reported in the CUPS error_log - I suspect you have a permissions issue with the USB device files.

@salfter
Copy link
Author

salfter commented Oct 2, 2019

error_log.txt

@michaelrsweet
Copy link
Collaborator

OK, I'm not seeing any errors from the USB backend in the error_log; can you try:

sudo -u lp /usr/libexec/cups/backend/usb

to see what the USB backend does when run as the "lp" user?

@salfter
Copy link
Author

salfter commented Oct 7, 2019

That returned this:

DEBUG: Loading USB quirks from "/usr/share/cups/usb".
DEBUG: Loaded 95 quirks.
DEBUG: list_devices
DEBUG: libusb_get_device_list=9
DEBUG: Failed to open device, code: -3

Adding the lp user to the usb and lpadmin groups (possible Gentoo packaging issue?) fixed that:

DEBUG: Loading USB quirks from "/usr/share/cups/usb".
DEBUG: Loaded 95 quirks.
DEBUG: list_devices
DEBUG: libusb_get_device_list=9
DEBUG2: Printer found with device ID: MFG:Zebra ;CMD:None;MDL:LP2844 ; Device URI: usb:https://Zebra/LP2844
direct usb:https://Zebra/LP2844 "Zebra LP2844" "Zebra LP2844" "MFG:Zebra ;CMD:None;MDL:LP2844 ;" ""

lpinfo -v is unchanged, though:

network https
network ipps
network http
network beh
network lpd
network socket
network ipp
direct hp
network smb

@salfter
Copy link
Author

salfter commented Oct 7, 2019

I've also opened an issue over here for the permissions problem found so far, and to pick their brains a bit:

https://bugs.gentoo.org/696898

@michaelrsweet
Copy link
Collaborator

I should probably update the backend to send any libusb errors as ERROR: messages as well...

@michaelrsweet michaelrsweet changed the title Can't set up Zebra LP2844 with libusb, but can print to file: URL if CONFIG_USB_PRINTER is enabled in the kernel USB (libusb) backend needs to print an error message when the open fails Oct 7, 2019
@michaelrsweet michaelrsweet added priority-low and removed unable-to-reproduce Unable to reproduce investigating Investigating the issue labels Oct 7, 2019
@michaelrsweet michaelrsweet added this to the CUPS 2.2.x Updates milestone Oct 7, 2019
@salfter
Copy link
Author

salfter commented Oct 7, 2019

OK, I'm not seeing any errors from the USB backend in the error_log; can you try:

sudo -u lp /usr/libexec/cups/backend/usb
to see what the USB backend does when run as the "lp" user?

I should probably update the backend to send any libusb errors as ERROR: messages as well...

Yes, as no error messages are showing in the log.

If there's a patchset or a git commit I can pull from that'll provide extra logging, I can get it integrated with the build system for testing.

@michaelrsweet
Copy link
Collaborator

[master 99c3e9f] Change DEBUG message to ERROR for libusb_init (Issue #5658)

[branch-2.2 f5e0747] Change DEBUG message to ERROR for libusb_init issues (Issue #5658)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants