HID: Support Jess/Saitek Color Rumble Pad
authorMichael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
Thu, 17 Jan 2013 10:06:09 +0000 (11:06 +0100)
committerJiri Kosina <jkosina@suse.cz>
Thu, 17 Jan 2013 10:06:09 +0000 (11:06 +0100)
Add support for another gamepad to the hid-pl driver.  The "color rumble pad
P580" marketed using the "Saitek" brand in Germany, and using a USB Vendor ID
attributed to "Jess" seems to be electronically identical to the 4-field
variant of the "Green Asia" gamepad.

The pad has been tested to support rumble strengths up to 255, not just 127.

Signed-off-by: Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-core.c
drivers/hid/hid-ids.h
drivers/hid/hid-pl.c

index eb2ee11b6412ac43e9baa08596b881d92c8430e3..aad2627273008996af2b0a207f83d04a50df4d6d 100644 (file)
@@ -1599,6 +1599,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) },
        { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK, USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP) },
        { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) },
        { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) },
        { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) },
index 4dfa605e2d14417203e734c4a68dc2447e86f5c2..3a493345ded0db744a17a4b64c077ad7c5ff0453 100644 (file)
 #define USB_VENDOR_ID_JESS             0x0c45
 #define USB_DEVICE_ID_JESS_YUREX       0x1010
 
+#define USB_VENDOR_ID_JESS2            0x0f30
+#define USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD 0x0111
+
 #define USB_VENDOR_ID_KBGEAR           0x084e
 #define USB_DEVICE_ID_KBGEAR_JAMSTUDIO 0x1001
 
index 123977e5aeee6d5023c18bc755506259ff8e62ae..b0199d27787b69a328d09488e5802f6e51b781a2 100644 (file)
@@ -14,6 +14,8 @@
  *  0e8f:0003 "GASIA USB Gamepad"
  *   - another version of the König gamepad
  *
+ *  0f30:0111 "Saitek Color Rumble Pad"
+ *
  *  Copyright (c) 2007, 2009 Anssi Hannula <anssi.hannula@gmail.com>
  */
 
@@ -51,6 +53,7 @@
 
 struct plff_device {
        struct hid_report *report;
+       s32 maxval;
        s32 *strong;
        s32 *weak;
 };
@@ -66,8 +69,8 @@ static int hid_plff_play(struct input_dev *dev, void *data,
        right = effect->u.rumble.weak_magnitude;
        debug("called with 0x%04x 0x%04x", left, right);
 
-       left = left * 0x7f / 0xffff;
-       right = right * 0x7f / 0xffff;
+       left = left * plff->maxval / 0xffff;
+       right = right * plff->maxval / 0xffff;
 
        *plff->strong = left;
        *plff->weak = right;
@@ -87,6 +90,7 @@ static int plff_init(struct hid_device *hid)
        struct list_head *report_ptr = report_list;
        struct input_dev *dev;
        int error;
+       s32 maxval;
        s32 *strong;
        s32 *weak;
 
@@ -123,6 +127,7 @@ static int plff_init(struct hid_device *hid)
                        return -ENODEV;
                }
 
+               maxval = 0x7f;
                if (report->field[0]->report_count >= 4) {
                        report->field[0]->value[0] = 0x00;
                        report->field[0]->value[1] = 0x00;
@@ -135,6 +140,8 @@ static int plff_init(struct hid_device *hid)
                        report->field[1]->value[0] = 0x00;
                        strong = &report->field[2]->value[0];
                        weak = &report->field[3]->value[0];
+                       if (hid->vendor == USB_VENDOR_ID_JESS2)
+                               maxval = 0xff;
                        debug("detected 4-field device");
                } else {
                        hid_err(hid, "not enough fields or values\n");
@@ -158,6 +165,7 @@ static int plff_init(struct hid_device *hid)
                plff->report = report;
                plff->strong = strong;
                plff->weak = weak;
+               plff->maxval = maxval;
 
                *strong = 0x00;
                *weak = 0x00;
@@ -207,6 +215,7 @@ static const struct hid_device_id pl_devices[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR),
                .driver_data = 1 }, /* Twin USB Joystick */
        { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003), },
+       { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD), },
        { }
 };
 MODULE_DEVICE_TABLE(hid, pl_devices);