ChangeSet 1.954.1.3, 2003/01/08 08:36:06-08:00, henning@meier-geinitz.de

[PATCH] scanner.c: remove "magic" number for interface

On Tue, Dec 24, 2002 at 12:40:06AM +0100, Oliver Neukum wrote:
>
> > Well, the reason I didn't use one was that I didn't found one in
> > usb.h/usb_ch9.h for 16. It's also not listed on www.usb.org.
> >
> > lsusb calls it "Data". However, I'm not sure if this is a hex/dec
> > error and they really mean "Data" = dec 10, not 0x10 (=dec 16).
> >
> > Shall I define a local symbolic name (e.g.
> > STRANGE_HP_SCANJET_INTERFACE_CLASS)? But I really don't know what this
> > class is. I only know that it's used by a Hewlett-Packard ScanJet
> > 3300c and Genius HR6 USB - Vivid III.
>
> Better that than a bare number.

Patch attached.


diff -Nru a/drivers/usb/scanner.c b/drivers/usb/scanner.c
--- a/drivers/usb/scanner.c	Thu Jan 16 10:52:16 2003
+++ b/drivers/usb/scanner.c	Thu Jan 16 10:52:16 2003
@@ -907,7 +907,7 @@
 
 	if (interface[0].bInterfaceClass != USB_CLASS_VENDOR_SPEC &&
 	    interface[0].bInterfaceClass != USB_CLASS_PER_INTERFACE &&
-	    interface[0].bInterfaceClass != 16) {
+	    interface[0].bInterfaceClass != SCN_CLASS_SCANJET) {
 		dbg("probe_scanner: This interface doesn't look like a scanner (class=0x%x).", interface[0].bInterfaceClass);
 		return NULL;
 	}
diff -Nru a/drivers/usb/scanner.h b/drivers/usb/scanner.h
--- a/drivers/usb/scanner.h	Thu Jan 16 10:52:16 2003
+++ b/drivers/usb/scanner.h	Thu Jan 16 10:52:16 2003
@@ -278,6 +278,9 @@
 /* send/recv a control message to the scanner */
 #define SCANNER_IOCTL_CTRLMSG _IOWR('U', 0x22, struct usb_ctrlrequest )
 
+/* USB bInterfaceClass used by Hewlett-Packard ScanJet 3300c and Genius HR6
+   USB - Vivid III */
+#define SCN_CLASS_SCANJET 16
 
 #define SCN_MAX_MNR 16		/* We're allocated 16 minors */
 #define SCN_BASE_MNR 48		/* USB Scanners start at minor 48 */
