-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
Fix listing devices via "devices" subcommand #262
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes Issue #253 When running a Printer Application (ex. ps-printer-app) as server and doing the client call ps-printer-app devices the use of custom backends (schemes, like "cups:" for CUPS backends in pappl-retrofit) was not taken into account, as simply papplDeviceList() was called, with neither a system created nor the devices list polled from the running server. One could create the system before to get the custom scheme definitions in place, but the server is usually running as root and the client doing the request as the calling user. As some backends, independent of being PAPPL's own backends or any custom backends, discover devices only as root, letting the client call producing a different usually incomplete result. Therefore we do an IPP_OP_PAPPL_FIND_DEVICES IPP request to the server to let the server auto-discover the available devices and report back the results. There is also a bug in the server's IPP_OP_PAPPL_FIND_DEVICES (and IPP_OP_PAPPL_CREATE_PRINTERS) operation. The device list callback function _papplDeviceInfoCallback() returns "true" and not "false" after outputting an item, making the device listing process stop on the first item. making only the first discovered device listed (or only the first discovered printer set up). This is also corrected in this commit. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # On branch master # Your branch is up to date with 'origin/master'. # # Changes to be committed: # modified: pappl/device.c # modified: pappl/mainloop-subcommands.c #
This was referenced Mar 5, 2023
michaelrsweet
requested changes
Mar 5, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally I like this, just needs some cleanup.
- Corrected coding style, especially description of all variables - Use cups_len_t type - Removed unnecessary NULL checks - Free IPP response when erroring out - Simplified error handling
michaelrsweet
approved these changes
Mar 7, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes issue #253
When running a Printer Application (ex. ps-printer-app) as server and doing the client call
the use of custom backends (schemes, like "
cups:
" for CUPS backends in pappl-retrofit) was not taken into account, as simplypapplDeviceList()
was called, with neither a system created nor the devices list polled from the running server.One could create the system before to get the custom scheme definitions in place, but the server is usually running as root and the client doing the request as the calling user. As some backends, independent of being PAPPL's own backends or any custom backends, discover devices only as root, letting the client call producing a different usually incomplete result.
Therefore we do an
IPP_OP_PAPPL_FIND_DEVICES
IPP request to the server to let the server auto-discover the available devices and report back the results.There is also a bug in the server's
IPP_OP_PAPPL_FIND_DEVICES
(andIPP_OP_PAPPL_CREATE_PRINTERS
) operation. The device list callback function_papplDeviceInfoCallback()
returns "true
" and not "false
" after outputting an item, making the device listing process stop on the first item. making only the first discovered device listed (or only the first discovered printer set up). This is also corrected in this commit.