HID: add support for BTC Emprex 3009URF III Vista MCE Remote
Wayne Thomas [Wed, 28 Apr 2010 22:45:01 +0000 (00:45 +0200)]
The Behavior Tech. Computer Corp. (BTC) remote branded as "Emprex 3009URF III
Vista Remote Controller" uses non-standard mappings for all of its 'special
purpose' keys (0xffbc usage page).  This patch modifies the existing
hid-topseed quirky driver to support both remotes in order to prevent
proliferation of in-kernel quirky drivers until such a time that udev remapping
works with these devices.  Tested successfully with both the "Emprex" remote
and the "CyberLink" remote originally supported by the hid-topseed driver.

Signed-off-by: Wayne Thomas <waynethomas69@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

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

index 8e1b505..631ede6 100644 (file)
@@ -332,7 +332,7 @@ config HID_TOPSEED
        depends on USB_HID
        default !EMBEDDED
        ---help---
-       Say Y if you have a TopSeed Cyberlink remote control.
+       Say Y if you have a TopSeed Cyberlink or BTC Emprex remote control.
 
 config HID_THRUSTMASTER
        tristate "ThrustMaster devices support" if EMBEDDED
index 34429d7..b9f99f9 100644 (file)
@@ -1294,6 +1294,7 @@ static const struct hid_device_id hid_blacklist[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
        { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
        { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
        { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) },
        { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
index 0786bbd..9791d0a 100644 (file)
 #define USB_VENDOR_ID_BERKSHIRE                0x0c98
 #define USB_DEVICE_ID_BERKSHIRE_PCWD   0x1140
 
+#define USB_VENDOR_ID_BTC              0x046e
+#define USB_DEVICE_ID_BTC_EMPREX_REMOTE        0x5578
+
 #define USB_VENDOR_ID_CH               0x068e
 #define USB_DEVICE_ID_CH_PRO_PEDALS    0x00f2
 #define USB_DEVICE_ID_CH_COMBATSTICK   0x00f4
index 6925eda..2eebdcc 100644 (file)
@@ -3,6 +3,9 @@
  *
  *  Copyright (c) 2008 Lev Babiev
  *  based on hid-cherry driver
+ *
+ *  Modified to also support BTC "Emprex 3009URF III Vista MCE Remote" by
+ *  Wayne Thomas 2010.
  */
 
 /*
@@ -24,23 +27,29 @@ static int ts_input_mapping(struct hid_device *hdev, struct hid_input *hi,
                struct hid_field *field, struct hid_usage *usage,
                unsigned long **bit, int *max)
 {
-       if ((usage->hid & HID_USAGE_PAGE) != 0x0ffbc0000)
+       if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
                return 0;
 
        switch (usage->hid & HID_USAGE) {
-        case 0x00d: ts_map_key_clear(KEY_HOME);           break;
-        case 0x024: ts_map_key_clear(KEY_MENU);           break;
-        case 0x025: ts_map_key_clear(KEY_TV);             break;
-        case 0x048: ts_map_key_clear(KEY_RED);            break;
-        case 0x047: ts_map_key_clear(KEY_GREEN);          break;
-        case 0x049: ts_map_key_clear(KEY_YELLOW);         break;
-        case 0x04a: ts_map_key_clear(KEY_BLUE);           break;
-        case 0x04b: ts_map_key_clear(KEY_ANGLE);          break;
-        case 0x04c: ts_map_key_clear(KEY_LANGUAGE);       break;
-        case 0x04d: ts_map_key_clear(KEY_SUBTITLE);       break;
-        case 0x031: ts_map_key_clear(KEY_AUDIO);          break;
-        case 0x032: ts_map_key_clear(KEY_TEXT);           break;
-        case 0x033: ts_map_key_clear(KEY_CHANNEL);        break;
+       case 0x00d: ts_map_key_clear(KEY_MEDIA);        break;
+       case 0x024: ts_map_key_clear(KEY_MENU);         break;
+       case 0x025: ts_map_key_clear(KEY_TV);           break;
+       case 0x031: ts_map_key_clear(KEY_AUDIO);        break;
+       case 0x032: ts_map_key_clear(KEY_TEXT);         break;
+       case 0x033: ts_map_key_clear(KEY_CHANNEL);      break;
+       case 0x047: ts_map_key_clear(KEY_MP3);          break;
+       case 0x048: ts_map_key_clear(KEY_TV2);          break;
+       case 0x049: ts_map_key_clear(KEY_CAMERA);       break;
+       case 0x04a: ts_map_key_clear(KEY_VIDEO);        break;
+       case 0x04b: ts_map_key_clear(KEY_ANGLE);        break;
+       case 0x04c: ts_map_key_clear(KEY_LANGUAGE);     break;
+       case 0x04d: ts_map_key_clear(KEY_SUBTITLE);     break;
+       case 0x050: ts_map_key_clear(KEY_RADIO);        break;
+       case 0x05a: ts_map_key_clear(KEY_TEXT);         break;
+       case 0x05b: ts_map_key_clear(KEY_RED);          break;
+       case 0x05c: ts_map_key_clear(KEY_GREEN);        break;
+       case 0x05d: ts_map_key_clear(KEY_YELLOW);       break;
+       case 0x05e: ts_map_key_clear(KEY_BLUE);         break;
        default:
                return 0;
        }
@@ -50,6 +59,7 @@ static int ts_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 
 static const struct hid_device_id ts_devices[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
        { }
 };
 MODULE_DEVICE_TABLE(hid, ts_devices);