blob: 2eebdcc57bcf50278a509a081658e2a3e566c40a [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.
Lev Babievf14f5262009-01-04 00:36:56 +01009 */
10
11/*
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the Free
14 * Software Foundation; either version 2 of the License, or (at your option)
15 * any later version.
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))
26static 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 Thomasbf280622010-04-29 00:45:01 +020030 if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
Lev Babievf14f5262009-01-04 00:36:56 +010031 return 0;
32
33 switch (usage->hid & HID_USAGE) {
Wayne Thomasbf280622010-04-29 00:45:01 +020034 case 0x00d: ts_map_key_clear(KEY_MEDIA); break;
35 case 0x024: ts_map_key_clear(KEY_MENU); break;
36 case 0x025: ts_map_key_clear(KEY_TV); break;
37 case 0x031: ts_map_key_clear(KEY_AUDIO); break;
38 case 0x032: ts_map_key_clear(KEY_TEXT); break;
39 case 0x033: ts_map_key_clear(KEY_CHANNEL); break;
40 case 0x047: ts_map_key_clear(KEY_MP3); break;
41 case 0x048: ts_map_key_clear(KEY_TV2); break;
42 case 0x049: ts_map_key_clear(KEY_CAMERA); break;
43 case 0x04a: ts_map_key_clear(KEY_VIDEO); break;
44 case 0x04b: ts_map_key_clear(KEY_ANGLE); break;
45 case 0x04c: ts_map_key_clear(KEY_LANGUAGE); break;
46 case 0x04d: ts_map_key_clear(KEY_SUBTITLE); break;
47 case 0x050: ts_map_key_clear(KEY_RADIO); break;
48 case 0x05a: ts_map_key_clear(KEY_TEXT); break;
49 case 0x05b: ts_map_key_clear(KEY_RED); break;
50 case 0x05c: ts_map_key_clear(KEY_GREEN); break;
51 case 0x05d: ts_map_key_clear(KEY_YELLOW); break;
52 case 0x05e: ts_map_key_clear(KEY_BLUE); break;
Lev Babievf14f5262009-01-04 00:36:56 +010053 default:
54 return 0;
55 }
56
57 return 1;
58}
59
60static const struct hid_device_id ts_devices[] = {
61 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) },
Wayne Thomasbf280622010-04-29 00:45:01 +020062 { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
Lev Babievf14f5262009-01-04 00:36:56 +010063 { }
64};
65MODULE_DEVICE_TABLE(hid, ts_devices);
66
67static struct hid_driver ts_driver = {
68 .name = "topseed",
69 .id_table = ts_devices,
70 .input_mapping = ts_input_mapping,
71};
72
Peter Huewea24f4232009-07-02 19:08:38 +020073static int __init ts_init(void)
Lev Babievf14f5262009-01-04 00:36:56 +010074{
75 return hid_register_driver(&ts_driver);
76}
77
Peter Huewea24f4232009-07-02 19:08:38 +020078static void __exit ts_exit(void)
Lev Babievf14f5262009-01-04 00:36:56 +010079{
80 hid_unregister_driver(&ts_driver);
81}
82
83module_init(ts_init);
84module_exit(ts_exit);
85MODULE_LICENSE("GPL");