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 driver uses backchannel, which doesn't work on NetBSD #2324

Closed
michaelrsweet opened this issue Apr 3, 2007 · 3 comments
Closed

USB driver uses backchannel, which doesn't work on NetBSD #2324

michaelrsweet opened this issue Apr 3, 2007 · 3 comments
Milestone

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.2.8
CUPS.org User: gdt

With cups 1.2.10 on NetBSD (i386, 4.0_BETA2), printing to an HP 1320 attached via USB fails. It works with 1.1.23. NetBSD's ulpt(4) driver does not support reading from USB printers, but because use_bc=1, cups tries to read and the usb driver hangs when no data is forthcoming.

With the attached patch (which is in pkgsrc/print/cups), I was able to print a test page.

Fixing this correctly is tricky; one can't assume a printer is present at configure time (especially for pkgsrc which does bulk builds for binary packages). NetBSD may in the future support the backchannel on ulpt(4). So probably the best approach is to read from the device, but with a timeout, and essentially fall back to use_bc=0 if nothing is read.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in Subversion repository.

I also changed open_device() so that it only opened the device file for writing...

@michaelrsweet
Copy link
Collaborator Author

"patch-au":

$NetBSD: patch-au,v 1.6 2007/04/02 12:11:01 gdt Exp $

--- backend/usb-unix.c.orig 2007-02-20 08:41:07.000000000 -0500
+++ backend/usb-unix.c
@@ -90,6 +90,11 @@ print_device(const char uri, / I - De
strcasecmp(hostname, "Konica Minolta") &&
strcasecmp(hostname, "Minolta");

+#ifdef NetBSD

  • /* XXX Use configure test to see if reading from ulpt(4) works. */
  • use_bc = 0;
    +#endif

if ((device_fd = open_device(uri, &use_bc)) == -1)
{
if (getenv("CLASS") != NULL)

@michaelrsweet
Copy link
Collaborator Author

"str2324.patch":

Index: usb-unix.c

--- usb-unix.c (revision 6436)
+++ usb-unix.c (working copy)
@@ -80,7 +80,16 @@

do
{
+#ifdef NetBSD
/*

  • * NetBSD's ulpt driver currently does not support the
  • * back-channel...
  • */
  • use_bc = 0;

+#else

  • /*

  • Disable backchannel data when printing to Brother, Canon, or

  • Minolta USB printers - apparently these printers will return

  • the IEEE-1284 device ID over and over and over when they get
    @@ -91,6 +100,7 @@
    strcasecmp(hostname, "Canon") &&
    strcasecmp(hostname, "Konica Minolta") &&
    strcasecmp(hostname, "Minolta");
    +#endif /* NetBSD */

    if ((device_fd = open_device(uri, &use_bc)) == -1)
    {
    @@ -519,7 +529,12 @@
    }
    #else
    {

  • if ((fd = open(uri + 4, O_RDWR | O_EXCL)) < 0)

  • if (use_bc)

  •  fd = open(uri + 4, O_RDWR | O_EXCL);
    
  • else

  •  fd = -1;
    
  • if (fd < 0)
    {
    fd = open(uri + 4, O_WRONLY | O_EXCL);
    *use_bc = 0;

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