Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions cupshelpers/ppds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down Expand Up @@ -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:
Expand All @@ -1157,14 +1162,14 @@ def _init_ids (self):
lmfg = id_dict['MFG'].lower ()
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.

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 len (lmfg) == 0:
blank_mfg += 1

if lmfg not in ids:
ids[lmfg] = {}

Expand All @@ -1173,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():
Expand Down