From: Volker Mische <[EMAIL PROTECTED]>

If the device ID of a printer was already read out properly, usblp won't try
it again.

Signed-off-by: Volker Mische <[EMAIL PROTECTED]>
---
This fixes a bug with my printer (Kyocera FS-820), which didn't work with cups
anymore, as the printer timeouts when you try to get the device ID several
times (with cups only one priting job got really finished, the usb backend
(/usr/lib/cups/backends-available/usb) can be called 2-4 times, and leads then
to an IO-error).

I tested the bugfix with my system with plugging the printer in and out, but
I'm not sure if there aren't any side effects e.g. if you plug a printer out
and another one in.
It can be applied to current git (2006-09-06) and 2.6.17.11.


diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 48dee4b..a93408a 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -1116,12 +1116,20 @@ static int usblp_cache_device_id_string(
  {
         int err, length;

-       err = usblp_get_id(usblp, 0, usblp->device_id_string, 
USBLP_DEVICE_ID_SIZE - 1);
+       /* if the device_id_string was already set,
+        * there's no need to set it again */
+       if (usblp->device_id_string[0] == 0
+                       && usblp->device_id_string[1] == 0) {
+               err = usblp_get_id(usblp, 0, usblp->device_id_string,
+                       USBLP_DEVICE_ID_SIZE - 1);
+
         if (err < 0) {
-               dbg("usblp%d: error = %d reading IEEE-1284 Device ID string",
-                       usblp->minor, err);
-               usblp->device_id_string[0] = usblp->device_id_string[1] = '\0';
+                       dbg("usblp%d: error = %d reading IEEE-1284 Device "
+                                           "ID string", usblp->minor, err);
+                       usblp->device_id_string[0] =
+                               usblp->device_id_string[1] = '\0';
                 return -EIO;
+               }
         }

         /* First two bytes are length in big-endian.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to