ChangeSet 1.1118, 2003/04/18 14:57:33-07:00, henning@meier-geinitz.de

[PATCH] USB: scanner.c endpoint detection fix

This patch fixes the endpoint numbers. They were numbered from 1 to n
but that assumption is not correct in all cases.


 drivers/usb/scanner.c |   11 ++++++++---
 drivers/usb/scanner.h |    2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)


diff -Nru a/drivers/usb/scanner.c b/drivers/usb/scanner.c
--- a/drivers/usb/scanner.c	Fri Apr 18 15:00:19 2003
+++ b/drivers/usb/scanner.c	Fri Apr 18 15:00:19 2003
@@ -357,6 +357,11 @@
  *      Fujitsu, Hewlett-Packard, Lexmark, LG Electronics, Medion, Microtek,
  *      Primax, Prolink,  Plustek, SYSCAN, Trust and UMAX scanners.
  *
+ * 0.4.12  2003-04-16
+ *    - Fixed endpoint detection. The endpoints were numbered from 1 to n but
+ *      that assumption is not correct in all cases.
+ *
+ *
  * TODO
  *    - Performance
  *    - Select/poll methods
@@ -913,7 +918,7 @@
 				info ("probe_scanner: ignoring additional bulk_in_ep:%d", ep_cnt);
 				continue;
 			}
-			have_bulk_in = ep_cnt;
+			have_bulk_in = endpoint[ep_cnt - 1].bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
 			dbg("probe_scanner: bulk_in_ep:%d", have_bulk_in);
 			continue;
 		}
@@ -924,7 +929,7 @@
 				info ("probe_scanner: ignoring additional bulk_out_ep:%d", ep_cnt);
 				continue;
 			}
-			have_bulk_out = ep_cnt;
+			have_bulk_out = endpoint[ep_cnt - 1].bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
 			dbg("probe_scanner: bulk_out_ep:%d", have_bulk_out);
 			continue;
 		}
@@ -935,7 +940,7 @@
 				info ("probe_scanner: ignoring additional intr_ep:%d", ep_cnt);
 				continue;
 			}
-			have_intr = ep_cnt;
+			have_intr = endpoint[ep_cnt - 1].bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
 			dbg("probe_scanner: intr_ep:%d", have_intr);
 			continue;
 		}
diff -Nru a/drivers/usb/scanner.h b/drivers/usb/scanner.h
--- a/drivers/usb/scanner.h	Fri Apr 18 15:00:19 2003
+++ b/drivers/usb/scanner.h	Fri Apr 18 15:00:19 2003
@@ -44,7 +44,7 @@
 
 // #define DEBUG
 
-#define DRIVER_VERSION "0.4.11"
+#define DRIVER_VERSION "0.4.12"
 #define DRIVER_DESC "USB Scanner Driver"
 
 #include <linux/usb.h>
