ChangeSet 1.1011, 2003/03/05 13:51:05-08:00, [EMAIL PROTECTED]

[PATCH] USB: work around for a firmware bug of some scanners

this makes Elite II scanners much more useable. It's against 2.4.
   - short command work around


 drivers/usb/hpusbscsi.c |   20 ++++++++++++++++++--
 drivers/usb/hpusbscsi.h |    1 +
 2 files changed, 19 insertions(+), 2 deletions(-)


diff -Nru a/drivers/usb/hpusbscsi.c b/drivers/usb/hpusbscsi.c
--- a/drivers/usb/hpusbscsi.c   Thu Mar  6 14:24:25 2003
+++ b/drivers/usb/hpusbscsi.c   Thu Mar  6 14:24:25 2003
@@ -127,6 +127,9 @@
        init_waitqueue_head (&new->deathrow);
        init_MUTEX(&new->lock);
        INIT_LIST_HEAD (&new->lh);
+       
+       if (id->idVendor == 0x0686 && id->idProduct == 0x4004)
+               new->need_short_workaround = 1;
 
 
 
@@ -340,7 +343,7 @@
 {
        struct hpusbscsi* hpusbscsi = (struct hpusbscsi*)(srb->host->hostdata[0]);
        usb_urb_callback usb_callback;
-       int res;
+       int res, passed_length;
 
        spin_unlock_irq(&io_request_lock);
 
@@ -359,6 +362,19 @@
                callback(srb);
                goto out;
        }
+       
+       /* otto fix - the Scan Elite II has a 5 second
+       * delay anytime the srb->cmd_len=6
+       * This causes it to run very slowly unless we
+       * pad the command length to 10 */
+        
+       if (hpusbscsi -> need_short_workaround && srb->cmd_len < 10) {
+               memset(srb->cmnd + srb->cmd_len, 0, 10 - srb->cmd_len);
+               passed_length = 10;
+       } else {
+               passed_length = srb->cmd_len;
+       }
+        
 
        /* Now we need to decide which callback to give to the urb we send the command 
with */
 
@@ -404,7 +420,7 @@
                hpusbscsi->dev,
                usb_sndbulkpipe(hpusbscsi->dev,hpusbscsi->ep_out),
                srb->cmnd,
-               srb->cmd_len,
+               passed_length,
                usb_callback,
                hpusbscsi
        );
diff -Nru a/drivers/usb/hpusbscsi.h b/drivers/usb/hpusbscsi.h
--- a/drivers/usb/hpusbscsi.h   Thu Mar  6 14:24:25 2003
+++ b/drivers/usb/hpusbscsi.h   Thu Mar  6 14:24:25 2003
@@ -20,6 +20,7 @@
         int ep_in;
         int ep_int;
         int interrupt_interval;
+       int need_short_workaround;
 
         struct Scsi_Host *host;
         Scsi_Host_Template ctempl;



-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger 
for complex code. Debugging C/C++ programs can leave you feeling lost and 
disoriented. TotalView can help you find your way. Available on major UNIX 
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to