backend/ipp: Fix report_attr() to handle localized and octetString IPP tags#1510
Open
g0r3 wants to merge 2 commits intoOpenPrinting:masterfrom
Open
backend/ipp: Fix report_attr() to handle localized and octetString IPP tags#1510g0r3 wants to merge 2 commits intoOpenPrinting:masterfrom
g0r3 wants to merge 2 commits intoOpenPrinting:masterfrom
Conversation
Member
|
OK, so first you can't use Will review this in more detail when I have a chance... |
Author
|
OK, thanks for the heads-up. I've removed it from the fall-through cases. |
This file contains hidden or 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
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.
I've started using the the IPP Everywhere driver with my Brother MFC-L3750CDW, as I had problems using the proprietary driver on Nixos. And while IPP Everywhere resolves that problem and works great for printing, I found that it doesn't provide the toner status.
lpstatshowed no toner levels even thoughipptoolshowed the data was there. I have programming experience, but I am not a versed C guy, so I used the help of an LLM to trace the code path and identify the problem. Not sure if this is accepted.The error description and fix according to the LLM:
What's happening
ippFindAttribute()correctly matches localized types to their basetypes (e.g.,
NAMELANG→NAME) incups/ipp.c. Butreport_attr()switches on
attr->value_tag(the actual tag, e.g.,NAMELANG), andits switch only covers
INTEGER,TEXT,NAME, andKEYWORD. Theunhandled tag falls through to
default: return;, silently droppingthe data.
Fix
Add
IPP_TAG_TEXTLANG,IPP_TAG_NAMELANG, andIPP_TAG_STRINGasfall-through cases. They use the same
string.textunion member, sono additional logic is needed.
I've tested the patch locally with my Brother MCF-L3750CDW with IPP Everywhere.
After applying the patch the toner levels are correctly reported in
lpstatand (in my case) the KDE printer settings.