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

On non Darwin OS configure script ignores --disable-libusb flag #4439

Closed
michaelrsweet opened this issue Jun 18, 2014 · 7 comments
Closed

On non Darwin OS configure script ignores --disable-libusb flag #4439

michaelrsweet opened this issue Jun 18, 2014 · 7 comments

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.7.1
CUPS.org User: raycic

On any OS except Darwin configure script ignores --disable-libusb flag and does libusb autodetection.

At least on Linux this cause problems with printing on usb multifunctional devices.
If cups uses libusb then it tries access printer through /dev/bus/usb/... device. But offen this device is ocuppied by scanner software and device is assigned to scanner group but not lp group which is default for cups, so cups in this configuration do not have access to printer.

In this situation cups should be compiled with --disable-libusb flag, and cups should acces printer only through /dev/usblp devices

IMHO this problem affects not only 1.7.1 version of cups but all recent versions

I attached patch which fixes problem for me, but I am not 100% sure it is correct.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

That isn't the correct fix, but instead we should be checking that the value is not "no" (i.e. nothing specified or --enable-libusb) and we are not running on Darwin/OS X (which uses IOKit instead).

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

And FWIW there are problems having both the legacy usblp kernel driver and scanner software use an MFP - sounds like your Linux distribution of choice needs to provide a common group for printing and scanning...

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: raycic

IMHO behavior of libusb flag should be following:

no libusb flag: libusb auto-detection (like now)

--disable-libusb: libusb support should be disabled

--enable-libusb: libusb support should be enabled and presence of libusb should be checked. If there is no libusb on system or libusb exists but wrong version then configure script should fail

Unfortunately I do not have knowledge about auto-tools and m4 to make such changes.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: jsmeix.suse

FWIW regarding "provide a common group for printing and scanning":

At openSUSE I use the "lp" group as common group for printing
and scanning.

Reasoning:
See in the openSUSE sane-backends package the sane-backends.spec file:

https://build.opensuse.org/package/view_file/graphics/sane-backends/sane-backends.spec?expand=1


Regarding udev:

Modify the generated tools/udev/libsane.rules file as follows:

All GROUP="scanner" are replaced by GROUP="lp".

There is no group "scanner" in /etc/group for openSUSE.

For all-in-one devices (i.e. printer + scanner, e.g. "EPSON Stylus" devices)

the group must be "lp" so that the CUPS usb backend which runs

as user "lp" (who is member of the group "lp") can send printing data

to the printer unit (i.e. the printer interface of the USB device).

It is sufficiently secure and reasonable easy to use by default

the same group "lp" for printers and scanners because both kind of devices

usually require physical user access (to get the printed paper or

to place a paper on the scanner) so that both kind of devices

should usually require the same kind of security.

sed -i -e 's/GROUP="scanner"/GROUP="lp"/' tools/udev/libsane.rules

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in Subversion repository.

@michaelrsweet
Copy link
Collaborator Author

"cups-1.7.1-fix-libusb-detection.patch":

diff -ur cups-1.7.1.old/config-scripts/cups-common.m4 cups-1.7.1/config-scripts/cups-common.m4
--- cups-1.7.1.old/config-scripts/cups-common.m4 2014-01-08 18:26:26.000000000 +0200
+++ cups-1.7.1/config-scripts/cups-common.m4 2014-06-18 18:43:31.888127038 +0300
@@ -230,7 +230,7 @@
AC_SUBST(USBQUIRKS)

if test "x$PKGCONFIG" != x; then

  • if test x$enable_libusb = xyes -o $uname != Darwin; then
  • if test x$enable_libusb = xyes -a $uname != Darwin; then
    AC_MSG_CHECKING(for libusb-1.0)
    if $PKGCONFIG --exists libusb-1.0; then
    AC_MSG_RESULT(yes)

@michaelrsweet
Copy link
Collaborator Author

"str4439.patch":

Index: config-scripts/cups-common.m4

--- config-scripts/cups-common.m4 (revision 11949)
+++ config-scripts/cups-common.m4 (working copy)
@@ -231,7 +231,7 @@
AC_SUBST(USBQUIRKS)

if test "x$PKGCONFIG" != x; then

  • if test x$enable_libusb = xyes -o $uname != Darwin; then
  • if test x$enable_libusb != xno -a $uname != Darwin; then
    AC_MSG_CHECKING(for libusb-1.0)
    if $PKGCONFIG --exists libusb-1.0; then
    AC_MSG_RESULT(yes)
    @@ -241,6 +241,9 @@
    USBQUIRKS="$(DATADIR)/usb"
    else
    AC_MSG_RESULT(no)
  •       if test x$enable_libusb = xyes; then
    
  •           AC_MSG_ERROR(libusb required for --enable-libusb.)
    
  •       fi
    fi
    
    fi
    elif test x$enable_libusb = xyes; then

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

1 participant