ChangeSet 1.893.2.7, 2002/12/23 11:48:26-08:00, henning@meier-geinitz.de

[PATCH] scanner.c: Accept scanners with more than one interface

This patch allows the scanner driver to accept devices with more than
one interface. That's needed by some multi-function periphals (e.g.
scanner+printer).


diff -Nru a/drivers/usb/scanner.c b/drivers/usb/scanner.c
--- a/drivers/usb/scanner.c	Mon Jan  6 11:31:29 2003
+++ b/drivers/usb/scanner.c	Mon Jan  6 11:31:29 2003
@@ -319,11 +319,13 @@
  *      "Jaeger, Gerhard" <gerhard@gjaeger.de>, Ira Childress 
  *      <ichildress@mn.rr.com>, Till Kamppeter <till.kamppeter@gmx.net>,
  *      Ed Hamrick <EdHamrick@aol.com>, Oliver Schwartz
- *	<Oliver.Schwartz@gmx.de> and everyone else who sent ids.
+ *      <Oliver.Schwartz@gmx.de> and everyone else who sent ids.
  *    - Some Benq, Genius and Plustek ids are identified now.
  *    - Don't clutter syslog with "Unable to access minor data" messages.
  *    - Accept scanners with only one bulk (in) endpoint (thanks to Sergey
  *      Vlasov <vsu@mivlgu.murom.ru>).
+ *    - Accept devices with more than one interface. Only use interfaces that
+ *      look like belonging to scanners.
  *
  * TODO
  *    - Remove the 2/3 endpoint limitation
@@ -906,12 +908,15 @@
 		return NULL;
 	}
 
-	if (dev->config[0].bNumInterfaces != 1) {
-		info("probe_scanner: Only one device interface is supported.");
+	interface = dev->config[0].interface[ifnum].altsetting;
+
+	if (interface[0].bInterfaceClass != USB_CLASS_VENDOR_SPEC &&
+	    interface[0].bInterfaceClass != USB_CLASS_PER_INTERFACE &&
+	    interface[0].bInterfaceClass != 16) {
+		dbg("probe_scanner: This interface doesn't look like a scanner (class=0x%x).", interface[0].bInterfaceClass);
 		return NULL;
 	}
 
-	interface = dev->config[0].interface[ifnum].altsetting;
 	endpoint = interface[ifnum].endpoint;
 
 /*
