Thomas Gleixner | 2874c5f | 2019-05-27 08:55:01 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Lev Babiev | f14f526 | 2009-01-04 00:36:56 +0100 | [diff] [blame] | 2 | /* |
| 3 | * HID driver for TopSeed Cyberlink remote |
| 4 | * |
| 5 | * Copyright (c) 2008 Lev Babiev |
| 6 | * based on hid-cherry driver |
Wayne Thomas | bf28062 | 2010-04-29 00:45:01 +0200 | [diff] [blame] | 7 | * |
| 8 | * Modified to also support BTC "Emprex 3009URF III Vista MCE Remote" by |
| 9 | * Wayne Thomas 2010. |
Kees Bakker | 5400108 | 2010-07-13 22:50:51 +0200 | [diff] [blame] | 10 | * |
| 11 | * Modified to support Conceptronic CLLRCMCE by |
| 12 | * Kees Bakker 2010. |
Lev Babiev | f14f526 | 2009-01-04 00:36:56 +0100 | [diff] [blame] | 13 | */ |
| 14 | |
| 15 | /* |
Lev Babiev | f14f526 | 2009-01-04 00:36:56 +0100 | [diff] [blame] | 16 | */ |
| 17 | |
| 18 | #include <linux/device.h> |
| 19 | #include <linux/hid.h> |
| 20 | #include <linux/module.h> |
| 21 | |
| 22 | #include "hid-ids.h" |
| 23 | |
| 24 | #define ts_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ |
| 25 | EV_KEY, (c)) |
| 26 | static int ts_input_mapping(struct hid_device *hdev, struct hid_input *hi, |
| 27 | struct hid_field *field, struct hid_usage *usage, |
| 28 | unsigned long **bit, int *max) |
| 29 | { |
Wayne Thomas | bf28062 | 2010-04-29 00:45:01 +0200 | [diff] [blame] | 30 | if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR) |
Lev Babiev | f14f526 | 2009-01-04 00:36:56 +0100 | [diff] [blame] | 31 | return 0; |
| 32 | |
| 33 | switch (usage->hid & HID_USAGE) { |
Hans de Goede | aa2d495 | 2019-02-01 16:18:07 +0100 | [diff] [blame] | 34 | case 0x00c: ts_map_key_clear(KEY_WLAN); break; |
Wayne Thomas | bf28062 | 2010-04-29 00:45:01 +0200 | [diff] [blame] | 35 | case 0x00d: ts_map_key_clear(KEY_MEDIA); break; |
Hans de Goede | aa2d495 | 2019-02-01 16:18:07 +0100 | [diff] [blame] | 36 | case 0x010: ts_map_key_clear(KEY_ZOOM); break; |
Wayne Thomas | bf28062 | 2010-04-29 00:45:01 +0200 | [diff] [blame] | 37 | case 0x024: ts_map_key_clear(KEY_MENU); break; |
| 38 | case 0x025: ts_map_key_clear(KEY_TV); break; |
Kees Bakker | 5400108 | 2010-07-13 22:50:51 +0200 | [diff] [blame] | 39 | case 0x027: ts_map_key_clear(KEY_MODE); break; |
Wayne Thomas | bf28062 | 2010-04-29 00:45:01 +0200 | [diff] [blame] | 40 | case 0x031: ts_map_key_clear(KEY_AUDIO); break; |
| 41 | case 0x032: ts_map_key_clear(KEY_TEXT); break; |
| 42 | case 0x033: ts_map_key_clear(KEY_CHANNEL); break; |
| 43 | case 0x047: ts_map_key_clear(KEY_MP3); break; |
| 44 | case 0x048: ts_map_key_clear(KEY_TV2); break; |
| 45 | case 0x049: ts_map_key_clear(KEY_CAMERA); break; |
| 46 | case 0x04a: ts_map_key_clear(KEY_VIDEO); break; |
| 47 | case 0x04b: ts_map_key_clear(KEY_ANGLE); break; |
| 48 | case 0x04c: ts_map_key_clear(KEY_LANGUAGE); break; |
| 49 | case 0x04d: ts_map_key_clear(KEY_SUBTITLE); break; |
| 50 | case 0x050: ts_map_key_clear(KEY_RADIO); break; |
| 51 | case 0x05a: ts_map_key_clear(KEY_TEXT); break; |
| 52 | case 0x05b: ts_map_key_clear(KEY_RED); break; |
| 53 | case 0x05c: ts_map_key_clear(KEY_GREEN); break; |
| 54 | case 0x05d: ts_map_key_clear(KEY_YELLOW); break; |
| 55 | case 0x05e: ts_map_key_clear(KEY_BLUE); break; |
Lev Babiev | f14f526 | 2009-01-04 00:36:56 +0100 | [diff] [blame] | 56 | default: |
| 57 | return 0; |
| 58 | } |
| 59 | |
| 60 | return 1; |
| 61 | } |
| 62 | |
| 63 | static const struct hid_device_id ts_devices[] = { |
| 64 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, |
Wayne Thomas | bf28062 | 2010-04-29 00:45:01 +0200 | [diff] [blame] | 65 | { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, |
Jiri Kosina | c3dc66d | 2010-08-30 15:43:25 +0200 | [diff] [blame] | 66 | { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, |
Kees Bakker | 5400108 | 2010-07-13 22:50:51 +0200 | [diff] [blame] | 67 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, |
Dennis Kügler | b9e4b1e | 2010-11-23 21:40:09 +0100 | [diff] [blame] | 68 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, |
Hans de Goede | aa2d495 | 2019-02-01 16:18:07 +0100 | [diff] [blame] | 69 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TOSHIBA_WT10A) }, |
Lev Babiev | f14f526 | 2009-01-04 00:36:56 +0100 | [diff] [blame] | 70 | { } |
| 71 | }; |
| 72 | MODULE_DEVICE_TABLE(hid, ts_devices); |
| 73 | |
| 74 | static struct hid_driver ts_driver = { |
| 75 | .name = "topseed", |
| 76 | .id_table = ts_devices, |
| 77 | .input_mapping = ts_input_mapping, |
| 78 | }; |
H Hartley Sweeten | f425458 | 2012-12-17 15:28:26 -0700 | [diff] [blame] | 79 | module_hid_driver(ts_driver); |
Lev Babiev | f14f526 | 2009-01-04 00:36:56 +0100 | [diff] [blame] | 80 | |
Lev Babiev | f14f526 | 2009-01-04 00:36:56 +0100 | [diff] [blame] | 81 | MODULE_LICENSE("GPL"); |