From 4d9008f0dff048e407020f524fb6cd6f4006ff26 Mon Sep 17 00:00:00 2001 From: Bernie Innocenti Date: Tue, 14 Jul 2026 10:59:22 +0900 Subject: [PATCH 1/2] cupshelpers: let PPDs with a blank MFG match their device 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 #445 Assisted-by: Claude:claude-fable-5 [Claude Code] --- cupshelpers/ppds.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/cupshelpers/ppds.py b/cupshelpers/ppds.py index dac4d9fad..4ee611cdf 100755 --- a/cupshelpers/ppds.py +++ b/cupshelpers/ppds.py @@ -1157,12 +1157,9 @@ def _init_ids (self): lmfg = id_dict['MFG'].lower () lmdl = id_dict['MDL'].lower () - bad = False - if len (lmfg) == 0: - bad = True + # A blank MFG is legal (some devices report one); index the + # PPD under the empty make so blank-MFG device IDs can match. if len (lmdl) == 0: - bad = True - if bad: continue if lmfg not in ids: From 07fea9bbc1a7018fb0f137c819086acf75593a7a Mon Sep 17 00:00:00 2001 From: Bernie Innocenti Date: Mon, 17 Aug 2026 11:33:09 +0900 Subject: [PATCH 2/2] cupshelpers: log when MFG is empty Requested in review of PR #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] --- cupshelpers/ppds.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cupshelpers/ppds.py b/cupshelpers/ppds.py index 4ee611cdf..ddc1ff791 100755 --- a/cupshelpers/ppds.py +++ b/cupshelpers/ppds.py @@ -577,6 +577,10 @@ def getPPDNamesFromDeviceID (self, mfg, mdl, description="", mfgl = mfg.lower () mdll = mdl.lower () + if mfgl == "": + _debugprint ("**** Device ID has an empty MFG field; " + "matching on MDL alone") + id_matched = False try: for each in self.ids[mfgl][mdll]: @@ -1148,6 +1152,7 @@ def _init_ids (self): return ids = {} + blank_mfg = 0 for ppdname, ppddict in self.ppds.items (): id = _singleton (ppddict.get ('ppd-device-id')) if not id: @@ -1162,6 +1167,9 @@ def _init_ids (self): if len (lmdl) == 0: continue + if len (lmfg) == 0: + blank_mfg += 1 + if lmfg not in ids: ids[lmfg] = {} @@ -1170,6 +1178,9 @@ def _init_ids (self): ids[lmfg][lmdl].append (ppdname) + if blank_mfg: + _debugprint ("%d PPDs with empty MFG in their device ID, " + "indexed under the empty make" % blank_mfg) self.ids = ids def _show_help():