public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.5] [TRIVIAL] USB Joypad quirk
@ 2002-12-22 11:20 mdew
  2002-12-22 12:14 ` Vojtech Pavlik
  2002-12-23 19:12 ` Greg KH
  0 siblings, 2 replies; 5+ messages in thread
From: mdew @ 2002-12-22 11:20 UTC (permalink / raw)
  To: Linux Kernel; +Cc: torvalds@transmeta.com, Vojtech Pavlik, Greg KH

[-- Attachment #1: Type: text/plain, Size: 2093 bytes --]

Orginally from Vojtech Pavlik (16th June 2002 via email), to fix my
'broken' USB joypad, Fully tested in both 2.4.x and 2.5.52 (and
2.5.52-bk).

-mdew



diff -Naur a/drivers/usb/input/hid-core.c
mdew/drivers/usb/input/hid-core.c
--- a/drivers/usb/input/hid-core.c	2002-11-28 11:36:04.000000000 +1300
+++ mdew/drivers/usb/input/hid-core.c	2002-12-22 23:37:51.000000000
+1300
@@ -1317,6 +1317,9 @@
 #define USB_DEVICE_ID_ATEN_2PORTKVM    0x2204
 #define USB_DEVICE_ID_ATEN_4PORTKVM    0x2205
 
+#define USB_VENDOR_ID_TOPMAX           0x0663
+#define USB_DEVICE_ID_TOPMAX_COBRAPAD  0x0103
+
 #define USB_VENDOR_ID_MGE              0x0463
 #define USB_DEVICE_ID_MGE_UPS          0xffff
 #define USB_DEVICE_ID_MGE_UPS1         0x0001
@@ -1355,6 +1358,7 @@
 	{ USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_HIDDEV },
 	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1, HID_QUIRK_HIDDEV },
+	{ USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD,
HID_QUIRK_BADPAD },
 	{ 0, 0 }
 };
 
diff -Naur a/drivers/usb/input/hid-input.c
mdew/drivers/usb/input/hid-input.c
--- a/drivers/usb/input/hid-input.c	2002-11-28 11:35:59.000000000 +1300
+++ mdew/drivers/usb/input/hid-input.c	2002-12-22 23:41:25.000000000
+1300
@@ -357,6 +357,11 @@
 		int a = field->logical_minimum;
 		int b = field->logical_maximum;
 
+		if ((device->quirks & HID_QUIRK_BADPAD) && (usage->code == ABS_X ||
usage->code == ABS_Y)) {
+			a = field->logical_minimum = 0;
+			b = field->logical_maximum = 255;
+		}
+		
 		input->absmin[usage->code] = a;
 		input->absmax[usage->code] = b;
 		input->absfuzz[usage->code] = (b - a) >> 8;
diff -Naur a/drivers/usb/input/hid.h mdew/drivers/usb/input/hid.h
--- a/drivers/usb/input/hid.h	2002-11-28 11:35:46.000000000 +1300
+++ mdew/drivers/usb/input/hid.h	2002-12-22 23:38:49.000000000 +1300
@@ -206,6 +206,7 @@
 #define HID_QUIRK_IGNORE	0x04
 #define HID_QUIRK_NOGET		0x08
 #define HID_QUIRK_HIDDEV	0x10
+#define HID_QUIRK_BADPAD        0x12
 
 /*
  * This is the global enviroment of the parser. This information is


[-- Attachment #2: hid_quirk_badpad-2.5.diff --]
[-- Type: text/x-patch, Size: 1985 bytes --]

diff -Naur a/drivers/usb/input/hid-core.c mdew/drivers/usb/input/hid-core.c
--- a/drivers/usb/input/hid-core.c	2002-11-28 11:36:04.000000000 +1300
+++ mdew/drivers/usb/input/hid-core.c	2002-12-22 23:37:51.000000000 +1300
@@ -1317,6 +1317,9 @@
 #define USB_DEVICE_ID_ATEN_2PORTKVM    0x2204
 #define USB_DEVICE_ID_ATEN_4PORTKVM    0x2205
 
+#define USB_VENDOR_ID_TOPMAX           0x0663
+#define USB_DEVICE_ID_TOPMAX_COBRAPAD  0x0103
+
 #define USB_VENDOR_ID_MGE              0x0463
 #define USB_DEVICE_ID_MGE_UPS          0xffff
 #define USB_DEVICE_ID_MGE_UPS1         0x0001
@@ -1355,6 +1358,7 @@
 	{ USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_HIDDEV },
 	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1, HID_QUIRK_HIDDEV },
+	{ USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD },
 	{ 0, 0 }
 };
 
diff -Naur a/drivers/usb/input/hid-input.c mdew/drivers/usb/input/hid-input.c
--- a/drivers/usb/input/hid-input.c	2002-11-28 11:35:59.000000000 +1300
+++ mdew/drivers/usb/input/hid-input.c	2002-12-22 23:41:25.000000000 +1300
@@ -357,6 +357,11 @@
 		int a = field->logical_minimum;
 		int b = field->logical_maximum;
 
+		if ((device->quirks & HID_QUIRK_BADPAD) && (usage->code == ABS_X || usage->code == ABS_Y)) {
+			a = field->logical_minimum = 0;
+			b = field->logical_maximum = 255;
+		}
+		
 		input->absmin[usage->code] = a;
 		input->absmax[usage->code] = b;
 		input->absfuzz[usage->code] = (b - a) >> 8;
diff -Naur a/drivers/usb/input/hid.h mdew/drivers/usb/input/hid.h
--- a/drivers/usb/input/hid.h	2002-11-28 11:35:46.000000000 +1300
+++ mdew/drivers/usb/input/hid.h	2002-12-22 23:38:49.000000000 +1300
@@ -206,6 +206,7 @@
 #define HID_QUIRK_IGNORE	0x04
 #define HID_QUIRK_NOGET		0x08
 #define HID_QUIRK_HIDDEV	0x10
+#define HID_QUIRK_BADPAD        0x12
 
 /*
  * This is the global enviroment of the parser. This information is

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2.5] [TRIVIAL] USB Joypad quirk
  2002-12-22 11:20 [PATCH 2.5] [TRIVIAL] USB Joypad quirk mdew
@ 2002-12-22 12:14 ` Vojtech Pavlik
  2002-12-23 19:12 ` Greg KH
  1 sibling, 0 replies; 5+ messages in thread
From: Vojtech Pavlik @ 2002-12-22 12:14 UTC (permalink / raw)
  To: mdew; +Cc: Linux Kernel, torvalds@transmeta.com, Vojtech Pavlik, Greg KH

On Mon, Dec 23, 2002 at 12:20:30AM +1300, mdew wrote:
> Orginally from Vojtech Pavlik (16th June 2002 via email), to fix my
> 'broken' USB joypad, Fully tested in both 2.4.x and 2.5.52 (and
> 2.5.52-bk).

Yes, Greg, this can go in.

> 
> -mdew
> 
> 
> 
> diff -Naur a/drivers/usb/input/hid-core.c
> mdew/drivers/usb/input/hid-core.c
> --- a/drivers/usb/input/hid-core.c	2002-11-28 11:36:04.000000000 +1300
> +++ mdew/drivers/usb/input/hid-core.c	2002-12-22 23:37:51.000000000
> +1300
> @@ -1317,6 +1317,9 @@
>  #define USB_DEVICE_ID_ATEN_2PORTKVM    0x2204
>  #define USB_DEVICE_ID_ATEN_4PORTKVM    0x2205
>  
> +#define USB_VENDOR_ID_TOPMAX           0x0663
> +#define USB_DEVICE_ID_TOPMAX_COBRAPAD  0x0103
> +
>  #define USB_VENDOR_ID_MGE              0x0463
>  #define USB_DEVICE_ID_MGE_UPS          0xffff
>  #define USB_DEVICE_ID_MGE_UPS1         0x0001
> @@ -1355,6 +1358,7 @@
>  	{ USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET },
>  	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_HIDDEV },
>  	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1, HID_QUIRK_HIDDEV },
> +	{ USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD,
> HID_QUIRK_BADPAD },
>  	{ 0, 0 }
>  };
>  
> diff -Naur a/drivers/usb/input/hid-input.c
> mdew/drivers/usb/input/hid-input.c
> --- a/drivers/usb/input/hid-input.c	2002-11-28 11:35:59.000000000 +1300
> +++ mdew/drivers/usb/input/hid-input.c	2002-12-22 23:41:25.000000000
> +1300
> @@ -357,6 +357,11 @@
>  		int a = field->logical_minimum;
>  		int b = field->logical_maximum;
>  
> +		if ((device->quirks & HID_QUIRK_BADPAD) && (usage->code == ABS_X ||
> usage->code == ABS_Y)) {
> +			a = field->logical_minimum = 0;
> +			b = field->logical_maximum = 255;
> +		}
> +		
>  		input->absmin[usage->code] = a;
>  		input->absmax[usage->code] = b;
>  		input->absfuzz[usage->code] = (b - a) >> 8;
> diff -Naur a/drivers/usb/input/hid.h mdew/drivers/usb/input/hid.h
> --- a/drivers/usb/input/hid.h	2002-11-28 11:35:46.000000000 +1300
> +++ mdew/drivers/usb/input/hid.h	2002-12-22 23:38:49.000000000 +1300
> @@ -206,6 +206,7 @@
>  #define HID_QUIRK_IGNORE	0x04
>  #define HID_QUIRK_NOGET		0x08
>  #define HID_QUIRK_HIDDEV	0x10
> +#define HID_QUIRK_BADPAD        0x12
>  
>  /*
>   * This is the global enviroment of the parser. This information is
> 



-- 
Vojtech Pavlik
SuSE Labs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2.5] [TRIVIAL] USB Joypad quirk
  2002-12-22 11:20 [PATCH 2.5] [TRIVIAL] USB Joypad quirk mdew
  2002-12-22 12:14 ` Vojtech Pavlik
@ 2002-12-23 19:12 ` Greg KH
  2002-12-23 21:04   ` mdew
  1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2002-12-23 19:12 UTC (permalink / raw)
  To: mdew; +Cc: Linux Kernel, torvalds@transmeta.com, Vojtech Pavlik

On Mon, Dec 23, 2002 at 12:20:30AM +1300, mdew wrote:
> Orginally from Vojtech Pavlik (16th June 2002 via email), to fix my
> 'broken' USB joypad, Fully tested in both 2.4.x and 2.5.52 (and
> 2.5.52-bk).

Applied to my 2.5 tree, thanks.

Can you also send a 2.4 version, as this one does not work for that
tree?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2.5] [TRIVIAL] USB Joypad quirk
  2002-12-23 19:12 ` Greg KH
@ 2002-12-23 21:04   ` mdew
  2002-12-23 22:41     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: mdew @ 2002-12-23 21:04 UTC (permalink / raw)
  To: Greg KH; +Cc: Linux Kernel, torvalds@transmeta.com, Vojtech Pavlik

[-- Attachment #1: Type: text/plain, Size: 2477 bytes --]

On Tue, 2002-12-24 at 08:12, Greg KH wrote:
> On Mon, Dec 23, 2002 at 12:20:30AM +1300, mdew wrote:
> > Orginally from Vojtech Pavlik (16th June 2002 via email), to fix my
> > 'broken' USB joypad, Fully tested in both 2.4.x and 2.5.52 (and
> > 2.5.52-bk).
> 
> Applied to my 2.5 tree, thanks.
> 
> Can you also send a 2.4 version, as this one does not work for that
> tree?

sure

diff -Naur linux-2.4.19/drivers/usb/hid-core.c
mdew/drivers/usb/hid-core.c
--- linux-2.4.19/drivers/usb/hid-core.c 2002-08-03 12:39:44.000000000
+1200
+++ mdew/drivers/usb/hid-core.c 2002-12-24 09:53:52.000000000 +1300
@@ -1086,6 +1086,9 @@
 #define USB_DEVICE_ID_ATEN_2PORTKVM    0x2204
 #define USB_DEVICE_ID_ATEN_4PORTKVM    0x2205

+#define USB_VENDOR_ID_TOPMAX           0x0663
+#define USB_DEVICE_ID_TOPMAX_COBRAPAD  0x0103
+
 struct hid_blacklist {
        __u16 idVendor;
        __u16 idProduct;
@@ -1115,6 +1118,7 @@
        { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS124U, HID_QUIRK_NOGET
},
        { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM,
HID_QUIRK_NOGET },
        { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM,
HID_QUIRK_NOGET },
+       { USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD,
HID_QUIRK_BADPAD },
        { 0, 0 }
 };

diff -Naur linux-2.4.19/drivers/usb/hid-input.c
mdew/drivers/usb/hid-input.c
--- linux-2.4.19/drivers/usb/hid-input.c        2001-11-12
07:09:37.000000000 +1300
+++ mdew/drivers/usb/hid-input.c        2002-12-24 09:53:52.000000000
+1300
@@ -280,6 +280,11 @@
                int a = field->logical_minimum;
                int b = field->logical_maximum;

+               if ((device->quirks & HID_QUIRK_BADPAD) && (usage->code
== ABS_X || usage->code == ABS_Y)) {
+                               a = field->logical_minimum = 0;
+                               b = field->logical_maximum = 255;
+                 }
+
                input->absmin[usage->code] = a;
                input->absmax[usage->code] = b;
                input->absfuzz[usage->code] = (b - a) >> 8;
diff -Naur linux-2.4.19/drivers/usb/hid.h mdew/drivers/usb/hid.h
--- linux-2.4.19/drivers/usb/hid.h      2002-08-03 12:39:44.000000000
+1200
+++ mdew/drivers/usb/hid.h      2002-12-24 09:53:47.000000000 +1300
@@ -186,6 +186,7 @@
 #define HID_QUIRK_NOTOUCH      0x02
 #define HID_QUIRK_IGNORE       0x04
 #define HID_QUIRK_NOGET                0x08
+#define HID_QUIRK_BADPAD       0x10

 /*
  * This is the global enviroment of the parser. This information is


[-- Attachment #2: hid_quirk_badpad-2.4.diff --]
[-- Type: text/x-patch, Size: 1947 bytes --]

diff -Naur linux-2.4.19/drivers/usb/hid-core.c mdew/drivers/usb/hid-core.c
--- linux-2.4.19/drivers/usb/hid-core.c	2002-08-03 12:39:44.000000000 +1200
+++ mdew/drivers/usb/hid-core.c	2002-12-24 09:53:52.000000000 +1300
@@ -1086,6 +1086,9 @@
 #define USB_DEVICE_ID_ATEN_2PORTKVM	0x2204
 #define USB_DEVICE_ID_ATEN_4PORTKVM	0x2205
 
+#define USB_VENDOR_ID_TOPMAX		0x0663
+#define USB_DEVICE_ID_TOPMAX_COBRAPAD	0x0103
+
 struct hid_blacklist {
 	__u16 idVendor;
 	__u16 idProduct;
@@ -1115,6 +1118,7 @@
 	{ USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS124U, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET },
+	{ USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD },
 	{ 0, 0 }
 };
 
diff -Naur linux-2.4.19/drivers/usb/hid-input.c mdew/drivers/usb/hid-input.c
--- linux-2.4.19/drivers/usb/hid-input.c	2001-11-12 07:09:37.000000000 +1300
+++ mdew/drivers/usb/hid-input.c	2002-12-24 09:53:52.000000000 +1300
@@ -280,6 +280,11 @@
 		int a = field->logical_minimum;
 		int b = field->logical_maximum;
 
+		if ((device->quirks & HID_QUIRK_BADPAD) && (usage->code == ABS_X || usage->code == ABS_Y)) {
+                       	a = field->logical_minimum = 0;
+                       	b = field->logical_maximum = 255;
+                 }      
+
 		input->absmin[usage->code] = a;
 		input->absmax[usage->code] = b;
 		input->absfuzz[usage->code] = (b - a) >> 8;
diff -Naur linux-2.4.19/drivers/usb/hid.h mdew/drivers/usb/hid.h
--- linux-2.4.19/drivers/usb/hid.h	2002-08-03 12:39:44.000000000 +1200
+++ mdew/drivers/usb/hid.h	2002-12-24 09:53:47.000000000 +1300
@@ -186,6 +186,7 @@
 #define HID_QUIRK_NOTOUCH	0x02
 #define HID_QUIRK_IGNORE	0x04
 #define HID_QUIRK_NOGET		0x08
+#define HID_QUIRK_BADPAD	0x10
 
 /*
  * This is the global enviroment of the parser. This information is

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2.5] [TRIVIAL] USB Joypad quirk
  2002-12-23 21:04   ` mdew
@ 2002-12-23 22:41     ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2002-12-23 22:41 UTC (permalink / raw)
  To: mdew; +Cc: Linux Kernel

On Tue, Dec 24, 2002 at 10:04:30AM +1300, mdew wrote:
> On Tue, 2002-12-24 at 08:12, Greg KH wrote:
> > On Mon, Dec 23, 2002 at 12:20:30AM +1300, mdew wrote:
> > > Orginally from Vojtech Pavlik (16th June 2002 via email), to fix my
> > > 'broken' USB joypad, Fully tested in both 2.4.x and 2.5.52 (and
> > > 2.5.52-bk).
> > 
> > Applied to my 2.5 tree, thanks.
> > 
> > Can you also send a 2.4 version, as this one does not work for that
> > tree?
> 
> sure

Sorry, but this does not apply to 2.4.21-pre2, can you try again?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-12-23 22:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-22 11:20 [PATCH 2.5] [TRIVIAL] USB Joypad quirk mdew
2002-12-22 12:14 ` Vojtech Pavlik
2002-12-23 19:12 ` Greg KH
2002-12-23 21:04   ` mdew
2002-12-23 22:41     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox