cupshelpers: let PPDs with a blank MFG match their device - #448
Conversation
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]
|
Is this ok to merge? |
|
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
left a comment
There was a problem hiding this comment.
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.
| lmdl = id_dict['MDL'].lower () | ||
|
|
||
| bad = False | ||
| if len (lmfg) == 0: |
There was a problem hiding this comment.
Would you mind adding at least debugprint call if the MFG is empty? Just to be sure.
There was a problem hiding this comment.
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'}
There was a problem hiding this comment.
Also note the annoying blank space before the human readable printer name (" PM-241-BT"). We might want to add a strip() somewhere.
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]
b103212 to
07fea9b
Compare
Fixes #445.
_init_ids()drops every PPD whose device ID has an empty MFG, whilegetPPDNamesFromDeviceID()looks the device's (also empty) MFG up inthat 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]