Bug 228505 - Epson Stylus D78 gets wrong driver for queue
Summary: Epson Stylus D78 gets wrong driver for queue
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: system-config-printer
Version: 6
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: FC6Update 228506
TreeView+ depends on / blocked
 
Reported: 2007-02-13 12:50 UTC by Tim Waugh
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version: 0.7.52-1.fc6
Clone Of:
Environment:
Last Closed: 2007-02-15 09:55:37 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Tim Waugh 2007-02-13 12:50:59 UTC
Description of problem:
When trying to create a queue for an Epson Stylus D78 (which is not in the
foomatic database yet), the close-match logic in foomatic.py ends up choosing
Epson Stylus Pro 10000 because

a) when scanning through the list, it isn't sorted in model order, and
b) the 'how many characters match' logic is slightly wrong

Version-Release number of selected component (if applicable):
system-config-printer-0.7.50-1.fc6

How reproducible:
100%

Steps to Reproduce:
1. Run this Python program:

#!/usr/bin/python
import sys
sys.path.append ('/usr/share/system-config-printer')
import foomatic
f=foomatic.Foomatic()
mfg='EPSON'
mdl='Stylus D78'
cmd=['ESCPL2','BDC','D4','D4PX']
print f.getPrinterFromDeviceID(mfg,mdl,commandsets=cmd)
  
Actual results:
Writing new pickle
Please report a bug in Bugzilla against 'foomatic':
  https://bugzilla.redhat.com/bugzilla
Include this complete message.
Guessing Epson-Stylus_Pro_10000 from IEEE 1284 ID:
      <manufacturer>EPSON</manufacturer>
      <model>Stylus D78</model>
      <description></description>
      <commandset>ESCPL2,BDC,D4,D4PX</commandset>
Epson-Stylus_Pro_10000

Expected results:
Writing new pickle
Please report a bug in Bugzilla against 'foomatic':
  https://bugzilla.redhat.com/bugzilla
Include this complete message.
Guessing Epson-Stylus_D68 from IEEE 1284 ID:
      <manufacturer>EPSON</manufacturer>
      <model>Stylus D78</model>
      <description></description>
      <commandset>ESCPL2,BDC,D4,D4PX</commandset>
Epson-Stylus_D68

Additional info:
Fix is:

Index: foomatic.py
===================================================================
RCS file: /usr/local/CVS/system-config-printer/foomatic.py,v
retrieving revision 1.52
diff -d -u -r1.52 foomatic.py
--- foomatic.py 8 Jan 2007 15:59:52 -0000       1.52
+++ foomatic.py 13 Feb 2007 12:49:17 -0000
@@ -776,12 +776,17 @@
             # Try to find the best match (case-insensitive)
             best_matchlen = 0
             mdll = mdl.lower ()
-            for (name, id) in mdls.iteritems():
-                name = name.lower ()
+            mdlnames = mdls.keys ()
+            mdlnames.sort (cups.modelSort)
+            mdlitems = map (lambda x: (x.lower (), mdls[x]), mdlnames)
+            for (name, id) in mdlitems:
                 if mdll[:1 + best_matchlen] == name[:1 + best_matchlen]:
-                    extra = 2
-                    while (mdll[1 + best_matchlen:extra + best_matchlen] ==
-                           name[1 + best_matchlen:extra + best_matchlen]):
+                    # We know we've got one more character matching.
+                    # Can we match any more on this entry?
+                    extra = 1
+                    while (mdll[1 + best_matchlen:1 + best_matchlen + extra] ==
+                           name[1 + best_matchlen:1 + best_matchlen + extra]):
+                        # Yes!  Try another!
                         extra += 1
                         if extra + best_matchlen >= len (name):
                             break

Comment 1 Tim Waugh 2007-02-13 12:56:14 UTC
Fixed in CVS.

Comment 2 Tim Waugh 2007-02-13 13:23:46 UTC
FC6 test update: 0.7.52-1.fc6.

Comment 3 Tim Waugh 2007-02-14 13:32:02 UTC
Fix verified.

Comment 4 Fedora Update System 2007-02-14 20:01:14 UTC
Fixed in update: system-config-printer-0.7.52-1.fc6


Note You need to log in before you can comment on or make changes to this bug.