michaelrsweet / pappl

PAPPL - Printer Application Framework
https://www.msweet.org/pappl
Apache License 2.0
309 stars 49 forks source link

"autoadd" via command line works but gives 3 times "ps-printer-app: Unable to get IEEE-1284 device ID: Pipe error" #156

Closed tillkamppeter closed 3 years ago

tillkamppeter commented 3 years ago

I have the PostScript Printer Application running and want to auto-add a USB printer. So I run

./ps-printer-app autoadd

The queue gets actually added (exit value of the command is 0 and the queue appears in the web interface) and absolutely as expected, with the correct driver (make/model in this case) auto-selected.

The only problem is that on stderr appear three identical messages:

ps-printer-app: Unable to get IEEE-1284 device ID: Pipe error
ps-printer-app: Unable to get IEEE-1284 device ID: Pipe error
ps-printer-app: Unable to get IEEE-1284 device ID: Pipe error

The device ID must have been read out correctly from the printer though as the auto-selection of the driver worked.

The fact that the message appears three times perhaps is caused by having three devices:

$ ./ps-printer-app devices
dnssd://HP%5C032OfficeJet%5C032Pro%5C0328730%5C032%5C09108C229%5C093._pdl-datastream._tcp.local/
snmp://HP08C229
usb://HP/HP%20OfficeJet%20Pro%208730?serial=CN783F60W1
ps-printer-app: Unable to get IEEE-1284 device ID: Pipe error
ps-printer-app: Unable to get IEEE-1284 device ID: Pipe error
ps-printer-app: Unable to get IEEE-1284 device ID: Pipe error
$

Note that this command also shows the errors, so it seems to be caused by the device discovery procedure of PAPPL.

The three times of the error message and the presence of three devices is actually a coincidence, as when I disconnect the printer from USB the message does not show at all, so all the three come from USB.

michaelrsweet commented 3 years ago

@tillkamppeter Can you add the following to the top of the device-usb.c source file:

#define DEBUG 1

and then attach the output you get then?

tillkamppeter commented 3 years ago

Here we go: device-usb-debug-log-20210222.txt

michaelrsweet commented 3 years ago

OK, I can reproduce this with testpappl but I'm not sure what is going wrong. Investigating further...

michaelrsweet commented 3 years ago

OK, so there were a couple small issues with the USB device iterator - basically, once a particular device had a match we'd try to access the device ID string for the rest of the interface descriptors for that device. I also updated the code to exclude IPP-USB interfaces.

[master 73778fa] Fix bogus USB error reporting (Issue #156)

[v1.0.x 8ffbcb9] Fix bogus USB error reporting (Issue #156)

tillkamppeter commented 3 years ago

The strange error messages are gone. Thank you very much.