]> err.no Git - linux-2.6/commitdiff
HID: support for Petalynx Maxter remote control
authorJiri Kosina <jkosina@suse.cz>
Mon, 18 Jun 2007 11:30:11 +0000 (13:30 +0200)
committerJiri Kosina <jkosina@suse.cz>
Mon, 9 Jul 2007 12:13:33 +0000 (14:13 +0200)
Petalynx Maxter remote control [1] 0x18b1/0x0037 emits 0xfa and 0xfc from
consumer page (reserved in HUT 1.12) for back and more keys. It also emits
a few usages from LOGIVENDOR page, which need adding.

Also, this device has broken report descriptor - the reported maximum is too
low - it doesn't contain the range for 'back' and 'more' keys, so we need to
bump it up before the report descriptor is being parsed.

Besides all this, it also requires NOGET quirk.

This patch does so.

[1] http://www.elmak.pl/index.php?option=com_phpshop&page=shop.browse&category_id=14&ext=opis&lang=en

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-input.c
drivers/hid/usbhid/hid-core.c
drivers/hid/usbhid/hid-quirks.c
include/linux/hid.h

index 6cb884638fda668015a63e8cd2841eb9a0459cc8..1b8b3334140830121f1869521220c242188b6c22 100644 (file)
@@ -566,6 +566,11 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
                                case 0x0e5: map_key_clear(KEY_BASSBOOST);       break;
                                case 0x0e9: map_key_clear(KEY_VOLUMEUP);        break;
                                case 0x0ea: map_key_clear(KEY_VOLUMEDOWN);      break;
+
+                               /* reserved in HUT 1.12. Reported on Petalynx remote */
+                               case 0x0f6: map_key_clear(KEY_NEXT);            break;
+                               case 0x0fa: map_key_clear(KEY_BACK);            break;
+
                                case 0x183: map_key_clear(KEY_CONFIG);          break;
                                case 0x184: map_key_clear(KEY_WORDPROCESSOR);   break;
                                case 0x185: map_key_clear(KEY_EDITOR);          break;
@@ -727,10 +732,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
                        }
                        break;
 
-               case HID_UP_LOGIVENDOR: /* Reported on Logitech Ultra X Media Remote */
-
+               case HID_UP_LOGIVENDOR:
                        set_bit(EV_REP, input->evbit);
                        switch(usage->hid & HID_USAGE) {
+                               /* Reported on Logitech Ultra X Media Remote */
                                case 0x004: map_key_clear(KEY_AGAIN);           break;
                                case 0x00d: map_key_clear(KEY_HOME);            break;
                                case 0x024: map_key_clear(KEY_SHUFFLE);         break;
@@ -748,6 +753,14 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
                                case 0x04d: map_key_clear(KEY_SUBTITLE);        break;
                                case 0x051: map_key_clear(KEY_RED);             break;
                                case 0x052: map_key_clear(KEY_CLOSE);           break;
+
+                               /* Reported on Petalynx Maxter remote */
+                               case 0x05a: map_key_clear(KEY_TEXT);            break;
+                               case 0x05b: map_key_clear(KEY_RED);             break;
+                               case 0x05c: map_key_clear(KEY_GREEN);           break;
+                               case 0x05d: map_key_clear(KEY_YELLOW);          break;
+                               case 0x05e: map_key_clear(KEY_BLUE);            break;
+
                                default:    goto ignore;
                        }
                        break;
index 093abb5c98796643f4254e0def4e2d52a27a749f..ef7b881aab3ab8f124ef79161fd8193728a68404 100644 (file)
@@ -688,6 +688,21 @@ static void hid_fixup_logitech_descriptor(unsigned char *rdesc, int rsize)
        }
 }
 
+/* Petalynx Maxter Remote has maximum for consumer page set too low */
+static void hid_fixup_petalynx_descriptor(unsigned char *rdesc, int rsize)
+{
+       if (rsize >= 60 && rdesc[39] == 0x2a
+                       && rdesc[40] == 0xf5
+                       && rdesc[41] == 0x00
+                       && rdesc[59] == 0x26
+                       && rdesc[60] == 0xf9
+                       && rdesc[61] == 0x00) {
+               info("Fixing up Petalynx Maxter Remote report descriptor");
+               rdesc[60] = 0xfa;
+               rdesc[40] = 0xfa;
+       }
+}
+
 /*
  * Some USB barcode readers from cypress have usage min and usage max in
  * the wrong order
@@ -781,6 +796,9 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf)
        if (quirks & HID_QUIRK_SWAPPED_MIN_MAX)
                hid_fixup_cypress_descriptor(rdesc, rsize);
 
+       if (quirks & HID_QUIRK_PETALYNX_DESCRIPTOR)
+               hid_fixup_petalynx_descriptor(rdesc, rsize);
+
 #ifdef CONFIG_HID_DEBUG
        printk(KERN_DEBUG __FILE__ ": report descriptor (size %u, read %d) = ", rsize, n);
        for (n = 0; n < rsize; n++)
index a320c24ea6e8677488a818bf1046e16eecab1d39..ad8a4ac8e43c7aabcdf07b3ecf2d76dc1355f6b1 100644 (file)
 #define USB_VENDOR_ID_PANTHERLORD      0x0810
 #define USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK    0x0001
 
+#define USB_VENDOR_ID_PETALYNX         0x18b1
+#define USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE   0x0037
+
 #define USB_VENDOR_ID_PLAYDOTCOM       0x0b43
 #define USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII     0x0003
 
@@ -426,6 +429,8 @@ static const struct hid_blacklist {
        { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS },
        { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT },
 
+       { USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE, HID_QUIRK_PETALYNX_DESCRIPTOR | HID_QUIRK_NOGET },
+
        { USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER, HID_QUIRK_SONY_PS3_CONTROLLER },
 
        { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM, HID_QUIRK_NOGET },
index 6e45d1056e1be7ee8332cf4e46fbb159dbfec0b2..e41067951dd9f82df743409263c1a58cc27d3ca9 100644 (file)
@@ -277,6 +277,7 @@ struct hid_item {
 #define HID_QUIRK_RESET_LEDS                   0x00400000
 #define HID_QUIRK_SWAPPED_MIN_MAX              0x00800000
 #define HID_QUIRK_HIDINPUT                     0x01000000
+#define HID_QUIRK_PETALYNX_DESCRIPTOR          0x02000000
 
 /*
  * This is the global environment of the parser. This information is