[PATCH] Using USB defines in usbmouse.c and usbkbd.c

Michael Opdenacker <[email protected]>
Newsgroups gmane.linux.usb.devel
Organization Free Electrons
Message-ID <[email protected]>
Hello,

The below patch proposes to use USB defines (defined in linux/hid.h) instead 
of just plain numbers in the USB_INTERFACE_INFO statements.

Isn't this cleaner and more explicit?
I know that these numbers will not change, of course...

What do you think?

	Cheers,

	Michael.

N.B. This patch can also be found on
http://free-electrons.com/pub/patches/linux/2.6.20/patch-2.6.20-usb-defines

Signed-off-by: Michael Opdenacker <[email protected]>

diff -Nurp linux-2.6.20/drivers/usb/input/usbkbd.c 
linux-2.6.20-usb-defines/drivers/usb/input/usbkbd.c
--- linux-2.6.20/drivers/usb/input/usbkbd.c	2007-02-04 19:44:54.000000000 
+0100
+++ linux-2.6.20-usb-defines/drivers/usb/input/usbkbd.c	2007-02-21 
22:31:29.000000000 +0100
@@ -31,6 +31,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/usb/input.h>
+#include <linux/hid.h>
 
 /*
  * Version Information
@@ -330,7 +331,8 @@ static void usb_kbd_disconnect(struct us
 }
 
 static struct usb_device_id usb_kbd_id_table [] = {
-	{ USB_INTERFACE_INFO(3, 1, 1) },
+	{ USB_INTERFACE_INFO(USB_INTERFACE_CLASS_HID, USB_INTERFACE_SUBCLASS_BOOT,
+		USB_INTERFACE_PROTOCOL_KEYBOARD) },
 	{ }						/* Terminating entry */
 };
 
diff -Nurp linux-2.6.20/drivers/usb/input/usbmouse.c 
linux-2.6.20-usb-defines/drivers/usb/input/usbmouse.c
--- linux-2.6.20/drivers/usb/input/usbmouse.c	2007-02-04 19:44:54.000000000 
+0100
+++ linux-2.6.20-usb-defines/drivers/usb/input/usbmouse.c	2007-02-21 
22:31:07.000000000 +0100
@@ -31,6 +31,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/usb/input.h>
+#include <linux/hid.h>
 
 /*
  * Version Information
@@ -213,7 +214,8 @@ static void usb_mouse_disconnect(struct 
 }
 
 static struct usb_device_id usb_mouse_id_table [] = {
-	{ USB_INTERFACE_INFO(3, 1, 2) },
+	{ USB_INTERFACE_INFO(USB_INTERFACE_CLASS_HID, USB_INTERFACE_SUBCLASS_BOOT,
+		USB_INTERFACE_PROTOCOL_MOUSE) },
 	{ }	/* Terminating entry */
 };
 

-- 
Michael Opdenacker, Free Electrons
Free Embedded Linux Training Materials
on http://free-electrons.com/training
(More than 1500 pages!)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.