patch-2.3.99-pre7 linux/drivers/usb/hid.c

Next file: linux/drivers/usb/hub.c
Previous file: linux/drivers/usb/audio.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre6/linux/drivers/usb/hid.c linux/drivers/usb/hid.c
@@ -78,7 +78,7 @@
 static struct {
 	__s32 x;
 	__s32 y;
-}  hid_hat_to_axis[] = {{ 0, 0}, { 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}};
+}  hid_hat_to_axis[] = {{ 0,-1}, { 1,-1}, { 1, 0}, { 1, 1}, { 0, 1}, {-1, 1}, {-1, 0}, {-1,-1}, { 0, 0}};
 
 /*
  * Register a new report for a device.
@@ -948,7 +948,8 @@
 	hid_dump_input(usage, value);
 
 	if (usage->hat) {
-		if (usage->hat == 2) value = value * 2 - 1;
+		if (usage->hat == 2) value = value * 2;
+		if (value > 8) value = 8;
 		input_event(input, usage->type, usage->code    , hid_hat_to_axis[value].x);
 		input_event(input, usage->type, usage->code + 1, hid_hat_to_axis[value].y);
 		return;
@@ -1431,7 +1432,8 @@
 
 	printk(KERN_INFO "input%d: USB HID v%x.%02x %s\n",
 		hid->input.number, hid->version >> 8, hid->version & 0xff,
-		(hid->application & 0xffff) <= 8 ? hid_name[hid->application & 0xffff] : "device");
+		((hid->application >= 0x00010000) && (hid->application <= 0x00010008)) ?
+			hid_name[hid->application & 0xffff] : "device");
 
 	return hid;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)