blob: 8a5b843e9dd6f904618ff790c872d48ff07a2aea [file] [log] [blame]
Lev Babievf14f5262009-01-04 00:36:56 +01001/*
2 * HID driver for TopSeed Cyberlink remote
3 *
4 * Copyright (c) 2008 Lev Babiev
5 * based on hid-cherry driver
Wayne Thomasbf280622010-04-29 00:45:01 +02006 *
7 * Modified to also support BTC "Emprex 3009URF III Vista MCE Remote" by
8 * Wayne Thomas 2010.
Kees Bakker54001082010-07-13 22:50:51 +02009 *
10 * Modified to support Conceptronic CLLRCMCE by
11 * Kees Bakker 2010.
Lev Babievf14f5262009-01-04 00:36:56 +010012 */
13
14/*
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the Free
17 * Software Foundation; either version 2 of the License, or (at your option)
18 * any later version.
19 */
20
21#include <linux/device.h>
22#include <linux/hid.h>
23#include <linux/module.h>
24
25#include "hid-ids.h"
26
27#define ts_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
28 EV_KEY, (c))
29static int ts_input_mapping(struct hid_device *hdev, struct hid_input *hi,
30 struct hid_field *field, struct hid_usage *usage,
31 unsigned long **bit, int *max)
32{
Wayne Thomasbf280622010-04-29 00:45:01 +020033 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
Lev Babievf14f5262009-01-04 00:36:56 +010034 return 0;
35
36 switch (usage->hid & HID_USAGE) {
Wayne Thomasbf280622010-04-29 00:45:01 +020037 case 0x00d: ts_map_key_clear(KEY_MEDIA); break;
38 case 0x024: ts_map_key_clear(KEY_MENU); break;
39 case 0x025: ts_map_key_clear(KEY_TV); break;
Kees Bakker54001082010-07-13 22:50:51 +020040 case 0x027: ts_map_key_clear(KEY_MODE); break;
Wayne Thomasbf280622010-04-29 00:45:01 +020041 case 0x031: ts_map_key_clear(KEY_AUDIO); break;
42 case 0x032: ts_map_key_clear(KEY_TEXT); break;
43 case 0x033: ts_map_key_clear(KEY_CHANNEL); break;
44 case 0x047: ts_map_key_clear(KEY_MP3); break;
45 case 0x048: ts_map_key_clear(KEY_TV2); break;
46 case 0x049: ts_map_key_clear(KEY_CAMERA); break;
47 case 0x04a: ts_map_key_clear(KEY_VIDEO); break;
48 case 0x04b: ts_map_key_clear(KEY_ANGLE); break;
49 case 0x04c: ts_map_key_clear(KEY_LANGUAGE); break;
50 case 0x04d: ts_map_key_clear(KEY_SUBTITLE); break;
51 case 0x050: ts_map_key_clear(KEY_RADIO); break;
52 case 0x05a: ts_map_key_clear(KEY_TEXT); break;
53 case 0x05b: ts_map_key_clear(KEY_RED); break;
54 case 0x05c: ts_map_key_clear(KEY_GREEN); break;
55 case 0x05d: ts_map_key_clear(KEY_YELLOW); break;
56 case 0x05e: ts_map_key_clear(KEY_BLUE); break;
Lev Babievf14f5262009-01-04 00:36:56 +010057 default:
58 return 0;
59 }
60
61 return 1;
62}
63
64static const struct hid_device_id ts_devices[] = {
65 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) },
Wayne Thomasbf280622010-04-29 00:45:01 +020066 { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
Jiri Kosinac3dc66d2010-08-30 15:43:25 +020067 { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) },
Kees Bakker54001082010-07-13 22:50:51 +020068 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) },
Dennis Küglerb9e4b1e2010-11-23 21:40:09 +010069 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) },
Lev Babievf14f5262009-01-04 00:36:56 +010070 { }
71};
72MODULE_DEVICE_TABLE(hid, ts_devices);
73
74static struct hid_driver ts_driver = {
75 .name = "topseed",
76 .id_table = ts_devices,
77 .input_mapping = ts_input_mapping,
78};
H Hartley Sweetenf4254582012-12-17 15:28:26 -070079module_hid_driver(ts_driver);
Lev Babievf14f5262009-01-04 00:36:56 +010080
Lev Babievf14f5262009-01-04 00:36:56 +010081MODULE_LICENSE("GPL");