Skip to content

cupshelpers: let PPDs with a blank MFG match their device - #448

Open
codewiz wants to merge 2 commits into
OpenPrinting:masterfrom
codewiz:blank-mfg-match
Open

cupshelpers: let PPDs with a blank MFG match their device#448
codewiz wants to merge 2 commits into
OpenPrinting:masterfrom
codewiz:blank-mfg-match

Conversation

@codewiz

@codewiz codewiz commented Jul 14, 2026

Copy link
Copy Markdown

Fixes #445.

_init_ids() drops every PPD whose device ID has an empty MFG, while
getPPDNamesFromDeviceID() looks the device's (also empty) MFG up in
that same table, so a printer reporting a blank MFG can never match its
PPD - it ends up on textonly.ppd. This indexes such PPDs under the empty
make instead; a non-empty MDL is still required.

Tested on Fedora 45 with a Phomemo PM-241-BT
(MFG: ;CMD:XPP,XL;MDL:PM-241-BT;...): with the patch,
system-config-printer, KDE printer settings and GetBestDrivers all pick
the right PPD with fit exact-cmd.

Assisted-by: Claude:claude-fable-5 [Claude Code]

Some printers report an empty MFG in their IEEE 1284 device ID. Index
those PPDs under the empty make instead of dropping them, so the exact
match becomes symmetric with the lookup side. MDL is still required.

Fixes OpenPrinting#445

Assisted-by: Claude:claude-fable-5 [Claude Code]
@codewiz

codewiz commented Aug 2, 2026

Copy link
Copy Markdown
Author

Is this ok to merge?

@zdohnal

zdohnal commented Aug 3, 2026

Copy link
Copy Markdown
Member

Tbh it looks to me more like firmware issue of the printer, but I don't have any standard at hand as evidence, but logically any device usually has to report its manufacturer and model name via device id.

My concern here is that it would match with different model as well (meaning the model name would be the same), but probably this is really narrow corner case.

@zdohnal zdohnal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one small concern about hitting a corner case of the same model name of different mfg which has empty mfg as well, but IMO it is acceptable.

It would be great to at least log that mfg is empty.

Comment thread cupshelpers/ppds.py
lmdl = id_dict['MDL'].lower ()

bad = False
if len (lmfg) == 0:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind adding at least debugprint call if the MFG is empty? Just to be sure.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Output looks like this:


 PM-241-BT
4 PPDs with empty MFG in their device ID, indexed under the empty make
**** Device ID has an empty MFG field; matching on MDL alone
Trying make/model names
init_makes: 0.170s
mfgl: pm 241 bt
mdll:
make: None
Checking CMD field
exact-cmd: PM-241-BT-open.ppd
Removed set() due to CMD mis-match
Valid driver types for this printer in priority order: ['driverless', 'manufacturer-cmd', 'foomatic-recommended-nonpostscript', 'manufacturer-ricoh-ps', 'manufacturer-ricoh-pxl', 'manufacturer', 'pdf', 'foomatic-recommended-postscript', 'hpcups', 'splix', 'foomatic-postscript', 'gutenprint-simplified', 'gutenprint-expert', 'foomatic-gutenprint', 'foomatic', 'cups', 'generic-postscript', 'generic-foomatic-recommended', 'generic-pcl6', 'generic-pcl5e', 'generic-pcl5', 'generic-pcl', 'generic-escp', 'ghostscript', 'generic', 'foomatic-recommended-hpijs', 'hpijs', 'foomatic-hpijs', 'hpcups-plugin', 'hpijs-plugin', 'turboprint']
PPDs with assigned driver types in priority order: [('manufacturer-cmd', 'PM-241-BT-open.ppd')]
Resulting PPD list in priority order: ['PM-241-BT-open.ppd']
DESTROY: <asyncconn.Connection object at 0x7fffdb6b5d10>
DESTROY: <asyncpk1.PK1Connection object at 0x7fffdb6b5f90>
DESTROY: <asyncipp.IPPAuthConnection object at 0x7fffdb6b6490>
Stopping worker thread
Next task: None
Thread exiting
-<asyncipp._IPPAuthOperation object at 0x7fffdb6b6990>
<ppdsloader.PPDsLoader object at 0x7fffdb697840 (ppdsloader+PPDsLoader at 0x555556d59c70)>: stored error is None
DESTROY: <ppdsloader.PPDsLoader object at 0x7fffdb697840 (ppdsloader+PPDsLoader at 0x555556d59c70)>
Loaded PPDs this time; try nextNPTab again...
Next clicked on page 1

 PM-241-BT
**** Device ID has an empty MFG field; matching on MDL alone
Trying make/model names
mfgl: pm 241 bt
mdll:
make: None
Checking CMD field
exact-cmd: PM-241-BT-open.ppd
Removed set() due to CMD mis-match
Suitable PPDs found: {'PM-241-BT-open.ppd': 'exact-cmd'}

@codewiz codewiz Aug 17, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also note the annoying blank space before the human readable printer name (" PM-241-BT"). We might want to add a strip() somewhere.

codewiz added a commit to codewiz/system-config-printer that referenced this pull request Aug 17, 2026
Requested in review of PR OpenPrinting#448.

Assisted-by: Claude:claude-fable-5 [Claude Code]
Requested in review of PR OpenPrinting#448. Log a single count of the PPDs
indexed under the empty make: logging each one would repeat the
message once per foomatic driver (1649 times on Fedora 45).

Assisted-by: Claude:claude-fable-5 [Claude Code]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cupshelpers: devices with an empty MFG in their IEEE 1284 device ID can never match any PPD

2 participants