You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
The short version is that the USB backend always goes into an infinite loop in backendRunLoop().
The somewhat more long winded explaination is that the usbprn driver doesn't support poll (unless using ugen(7D)) causing select() on the device FD to always fail with errno set to ENXIO. Since the USB backend calls backendRunLoop() with use_bc set to 1 and and a side_cb, the device is added to the list of FDs to select on.
This can be "fixed" by patching usb-unix.c to always pass use_bc=0 and size_cb=NULL when calling backendRunLoop(). Perhaps not an ideal fix, but a workable one. When CUPS goes to 1.4 and the USB backend supports libusb, that will be the preferred method of communicating with USB printers. That should avoid the issue all together, though I haven't verified that yet.
Hmm, the problem is that we also use select() to know when the device can accept more data. So, does the driver just not support backchannel select() or select in general?
If so, we'll just have to drop Solaris USB prn support in 1.3.x and rely on the new libusb stuff from 1.4 instead.
usbprn(7d) on Solaris only supports poll when using the ugen interface, so basically, if you are just using /dev/printers/* or /dev/usb/printer*, select(3C) doesn't work. However, you shouldn't need to select on the device fd. The write to the printer should block if it's not ready for data. Not exactly ideal, but it still appears to be functional.
We can't block on writes and still support back-channel or side-channel stuff... Similarly, we don't want to use non-blocking IO as that kills performance.
Can you point me at the ugen interface information? Is it something we can use directly as a character device for printing, or is it the generic USB interface that we'd ultimately be using via libusb?
Like I said, we might just need to drop usbprn support on Solaris...
I have filed a bug against the usbprn driver asking for poll support and it's been picked up the the USB driver owner, so the support may ultimately be added. As far as the ugen interface goes, the following link describes it's use http://developers.sun.com/solaris/developer/support/driver/docs/usbups_whitepaper.html The easier and more portable way to use it appears to be to use libusb instead of ugen directly.
Activity
michaelrsweet commentedon Dec 2, 2008
CUPS.org User: mike
Hmm, the problem is that we also use select() to know when the device can accept more data. So, does the driver just not support backchannel select() or select in general?
If so, we'll just have to drop Solaris USB prn support in 1.3.x and rely on the new libusb stuff from 1.4 instead.
michaelrsweet commentedon Dec 2, 2008
CUPS.org User: njacobs
usbprn(7d) on Solaris only supports poll when using the ugen interface, so basically, if you are just using /dev/printers/* or /dev/usb/printer*, select(3C) doesn't work. However, you shouldn't need to select on the device fd. The write to the printer should block if it's not ready for data. Not exactly ideal, but it still appears to be functional.
michaelrsweet commentedon Dec 3, 2008
CUPS.org User: mike
We can't block on writes and still support back-channel or side-channel stuff... Similarly, we don't want to use non-blocking IO as that kills performance.
Can you point me at the ugen interface information? Is it something we can use directly as a character device for printing, or is it the generic USB interface that we'd ultimately be using via libusb?
Like I said, we might just need to drop usbprn support on Solaris...
michaelrsweet commentedon Dec 3, 2008
CUPS.org User: njacobs
I have filed a bug against the usbprn driver asking for poll support and it's been picked up the the USB driver owner, so the support may ultimately be added. As far as the ugen interface goes, the following link describes it's use http://developers.sun.com/solaris/developer/support/driver/docs/usbups_whitepaper.html The easier and more portable way to use it appears to be to use libusb instead of ugen directly.
michaelrsweet commentedon Dec 5, 2008
CUPS.org User: mike
Fixed in Subversion repository.
The attached fix is a little different from yours - we want to make the use_bc choice earlier so that we just open the USB device write-only...
michaelrsweet commentedon Dec 5, 2008
"08-usb-hack.patch":
*** backend/usb-unix.c.orig Tue Nov 25 12:32:12 2008
--- backend/usb-unix.c Wed Nov 26 00:19:33 2008
*** 173,179 ****
--- 173,188 ----
lseek(print_fd, 0, SEEK_SET);
}
#ifdef __sun
/*
#else
tbytes = backendRunLoop(print_fd, device_fd, use_bc, side_cb);
#endif
if (print_fd != 0 && tbytes >= 0)
_cupsLangPrintf(stderr,
michaelrsweet commentedon Dec 5, 2008
"str3028-1.3.patch":
Index: backend/usb-unix.c
--- backend/usb-unix.c (revision 8154)
+++ backend/usb-unix.c (working copy)
@@ -80,6 +80,14 @@
+#elif defined(__sun)
#else
/*
@@ -173,7 +181,17 @@
lseek(print_fd, 0, SEEK_SET);
}
+#ifdef __sun
+#else
tbytes = backendRunLoop(print_fd, device_fd, use_bc, side_cb);
+#endif /* __sun */
if (print_fd != 0 && tbytes >= 0)
_cupsLangPrintf(stderr,