HID: add support for Skycable 0x3f07 wireless presenter
Jiri Kosina [Mon, 21 Mar 2011 12:54:22 +0000 (13:54 +0100)]
This device contains the very same bug in report descriptor as the
Ortek ones do (i.e. LogicalMinimum == 1, which is wrong for the key
array).

As we have more reports for the Ortek devices, we are keeping the driver
name for now. Apparently there is a chip producer which sells chip with
this buggy descriptor to multiple vendors. Thus if such reports start
to come at highger frequency, we'll either have to rename the driver
accordingly, or come up with more generic workaround.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>

drivers/hid/Kconfig
drivers/hid/hid-core.c
drivers/hid/hid-ids.h
drivers/hid/hid-ortek.c

index b7ec405..111da3c 100644 (file)
@@ -340,10 +340,17 @@ config HID_NTRIG
        Support for N-Trig touch screen.
 
 config HID_ORTEK
-       tristate "Ortek PKB-1700/WKB-2000 wireless keyboard and mouse trackpad"
+       tristate "Ortek PKB-1700/WKB-2000/Skycable wireless keyboard and mouse trackpad"
        depends on USB_HID
        ---help---
-       Support for Ortek PKB-1700/WKB-2000 wireless keyboard + mouse trackpad.
+       There are certain devices which have LogicalMaximum wrong in the keyboard
+       usage page of their report descriptor. The most prevailing ones so far
+       are manufactured by Ortek, thus the name of the driver. Currently
+       supported devices by this driver are
+
+          - Ortek PKB-1700
+          - Ortek WKB-2000
+          - Skycable wireless presenter
 
 config HID_PANTHERLORD
        tristate "Pantherlord/GreenAsia game controller"
index c3d6626..9809b58 100644 (file)
@@ -1448,6 +1448,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
index d485894..56e8e4a 100644 (file)
 #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE        0x0001
 #define USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE       0x0600
 
+#define USB_VENDOR_ID_SKYCABLE                 0x1223
+#define        USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER       0x3F07
+
 #define USB_VENDOR_ID_SONY                     0x054c
 #define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE      0x024b
 #define USB_DEVICE_ID_SONY_PS3_CONTROLLER      0x0268
index f9b7dd4..0ffa1d2 100644 (file)
@@ -1,8 +1,14 @@
 /*
- *  HID driver for Ortek PKB-1700/WKB-2000 (wireless keyboard + mouse trackpad).
- *  Fixes LogicalMaximum error in HID report description.
+ *  HID driver for various devices which are apparently based on the same chipset
+ *  from certain vendor which produces chips that contain wrong LogicalMaximum
+ *  value in their HID report descriptor. Currently supported devices are:
+ *
+ *    Ortek PKB-1700
+ *    Ortek WKB-2000
+ *    Skycable wireless presenter
  *
  *  Copyright (c) 2010 Johnathon Harris <jmharris@gmail.com>
+ *  Copyright (c) 2011 Jiri Kosina
  */
 
 /*
@@ -22,8 +28,11 @@ static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
                unsigned int *rsize)
 {
        if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) {
-               hid_info(hdev, "Fixing up Ortek WKB-2000 report descriptor\n");
+               hid_info(hdev, "Fixing up logical minimum in report descriptor (Ortek)\n");
                rdesc[55] = 0x92;
+       } else if (*rsize >= 54 && rdesc[52] == 0x25 && rdesc[53] == 0x01) {
+               hid_info(hdev, "Fixing up logical minimum in report descriptor (Skycable)\n");
+               rdesc[53] = 0x65;
        }
        return rdesc;
 }
@@ -31,6 +40,7 @@ static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 static const struct hid_device_id ortek_devices[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) },
        { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
        { }
 };
 MODULE_DEVICE_TABLE(hid, ortek_devices);