ChangeSet 1.1241, 2003/06/18 16:54:16-07:00, bcollins@debian.org [PATCH] USB: Happ UGCI added as BADPAD for workaround Greg, I sent these patches to Vojtech, and haven't heard anything back, but they are straight forward. One simply backports the BADPAD handling to 2.4, and both patches add Happ UGCI joysticks under the BADPAD workaround. drivers/usb/hid-core.c | 12 ++++++++++++ drivers/usb/hid-input.c | 14 ++++++++++++-- drivers/usb/hid.h | 8 +++++--- 3 files changed, 29 insertions(+), 5 deletions(-) diff -Nru a/drivers/usb/hid-core.c b/drivers/usb/hid-core.c --- a/drivers/usb/hid-core.c Wed Jun 18 17:35:23 2003 +++ b/drivers/usb/hid-core.c Wed Jun 18 17:35:23 2003 @@ -1089,6 +1089,14 @@ #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_HAPP 0x078b +#define USB_DEVICE_ID_UGCI_DRIVING 0x0010 +#define USB_DEVICE_ID_UGCI_FLYING 0x0020 +#define USB_DEVICE_ID_UGCI_FIGHTING 0x0030 + #define USB_VENDOR_ID_GRIFFIN 0x077d #define USB_DEVICE_ID_POWERMATE 0x0410 /* Griffin PowerMate */ #define USB_DEVICE_ID_SOUNDKNOB 0x04AA /* Griffin SoundKnob */ @@ -1137,6 +1145,10 @@ { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET }, { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD, HID_QUIRK_BADPAD }, + { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD }, + { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING, HID_QUIRK_BADPAD }, + { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING, HID_QUIRK_BADPAD }, { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 100, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 200, HID_QUIRK_IGNORE }, diff -Nru a/drivers/usb/hid-input.c b/drivers/usb/hid-input.c --- a/drivers/usb/hid-input.c Wed Jun 18 17:35:23 2003 +++ b/drivers/usb/hid-input.c Wed Jun 18 17:35:23 2003 @@ -280,10 +280,20 @@ 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; - input->absflat[usage->code] = (b - a) >> 4; + input->absfuzz[usage->code] = 0; + input->absflat[usage->code] = 0; + + if (field->application == HID_GD_GAMEPAD || field->application == HID_GD_JOYSTICK) { + input->absfuzz[usage->code] = (b - a) >> 8; + input->absflat[usage->code] = (b - a) >> 4; + } } if (usage->hat_min != usage->hat_max) { diff -Nru a/drivers/usb/hid.h b/drivers/usb/hid.h --- a/drivers/usb/hid.h Wed Jun 18 17:35:23 2003 +++ b/drivers/usb/hid.h Wed Jun 18 17:35:23 2003 @@ -186,10 +186,12 @@ #define HID_QUIRK_NOTOUCH 0x02 #define HID_QUIRK_IGNORE 0x04 #define HID_QUIRK_NOGET 0x08 +#define HID_QUIRK_HIDDEV 0x10 +#define HID_QUIRK_BADPAD 0x20 /* - * This is the global enviroment of the parser. This information is - * persistent for main-items. The global enviroment can be saved and + * This is the global environment of the parser. This information is + * persistent for main-items. The global environment can be saved and * restored with PUSH/POP statements. */ @@ -207,7 +209,7 @@ }; /* - * This is the local enviroment. It is resistent up the next main-item. + * This is the local environment. It is persistent up the next main-item. */ #define HID_MAX_DESCRIPTOR_SIZE 4096