#ifdef __linux
/*
* Show the printer status before we send the file; normally, we'd
* do this while we write data to the printer, however at least some
* Linux kernels have buggy USB drivers which don't like to be
* queried while sending data to the printer...
*/
if (ioctl(fd, LPGETSTATUS, &status) == 0)
{
fprintf(stderr, "DEBUG: LPGETSTATUS returned a port status of
%02X...\n", status);
if (status & LP_NOPA)
fputs("WARNING: Media tray empty!\n", stderr);
else if (status & LP_ERR)
fputs("WARNING: Printer fault!\n", stderr);
else if (status & LP_OFFL)
fputs("WARNING: Printer off-line.\n", stderr);
}
#endif /* __linux */
LP_NOPA, LP_ERR and LP_OFFL are from the POSIX-Part.
> | Obviously, this leads the cups usb-backend to incorrectly report an
> | empty media tray when the printer is online, idle and has enough paper.
> |
> | This doesn't seem to be something serious, its just a wrong message in
> | cups log-file.
>
> The (Linux 2.4.20) kernel drivers/char/lp.c and drivers/usb/printer.c
> modules use the 8255 parallel port definitions to read/test the status
> port. This matches the USB printer spec (I'm looking at the USB
> v1.1 printer spec).
> USB & parport then return that 8-bit value to userspace via an
> ioctl (LPGETSTATUS). Is CUPS using a different ioctl, possibly
> LPGETFLAGS?
>
See the code piece above - its using LPGETSTATUS
> | PS: Since two different specifications are mixed up, this problem could
> | also be a kernel problem.
>
> Um, it would have been a good thing if a "standard" interface were used
> for this instead of one that just matches some device's registers,
> as long as the standard interface weren't severe overkill.
I agree.
Greetings
Alex
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/