Root/
1 | /* |
2 | * HID driver for TiVo Slide Bluetooth remote |
3 | * |
4 | * Copyright (c) 2011 Jarod Wilson <jarod@redhat.com> |
5 | * based on the hid-topseed driver, which is in turn, based on hid-cherry... |
6 | */ |
7 | |
8 | /* |
9 | * This program is free software; you can redistribute it and/or modify it |
10 | * under the terms of the GNU General Public License as published by the Free |
11 | * Software Foundation; either version 2 of the License, or (at your option) |
12 | * any later version. |
13 | */ |
14 | |
15 | #include <linux/device.h> |
16 | #include <linux/hid.h> |
17 | #include <linux/module.h> |
18 | |
19 | #include "hid-ids.h" |
20 | |
21 | #define HID_UP_TIVOVENDOR 0xffff0000 |
22 | #define tivo_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ |
23 | EV_KEY, (c)) |
24 | |
25 | static int tivo_input_mapping(struct hid_device *hdev, struct hid_input *hi, |
26 | struct hid_field *field, struct hid_usage *usage, |
27 | unsigned long **bit, int *max) |
28 | { |
29 | switch (usage->hid & HID_USAGE_PAGE) { |
30 | case HID_UP_TIVOVENDOR: |
31 | switch (usage->hid & HID_USAGE) { |
32 | /* TiVo button */ |
33 | case 0x3d: tivo_map_key_clear(KEY_MEDIA); break; |
34 | /* Live TV */ |
35 | case 0x3e: tivo_map_key_clear(KEY_TV); break; |
36 | /* Red thumbs down */ |
37 | case 0x41: tivo_map_key_clear(KEY_KPMINUS); break; |
38 | /* Green thumbs up */ |
39 | case 0x42: tivo_map_key_clear(KEY_KPPLUS); break; |
40 | default: |
41 | return 0; |
42 | } |
43 | break; |
44 | case HID_UP_CONSUMER: |
45 | switch (usage->hid & HID_USAGE) { |
46 | /* Enter/Last (default mapping: KEY_LAST) */ |
47 | case 0x083: tivo_map_key_clear(KEY_ENTER); break; |
48 | /* Info (default mapping: KEY_PROPS) */ |
49 | case 0x209: tivo_map_key_clear(KEY_INFO); break; |
50 | default: |
51 | return 0; |
52 | } |
53 | break; |
54 | default: |
55 | return 0; |
56 | } |
57 | |
58 | /* This means we found a matching mapping here, else, look in the |
59 | * standard hid mappings in hid-input.c */ |
60 | return 1; |
61 | } |
62 | |
63 | static const struct hid_device_id tivo_devices[] = { |
64 | /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */ |
65 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, |
66 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, |
67 | { } |
68 | }; |
69 | MODULE_DEVICE_TABLE(hid, tivo_devices); |
70 | |
71 | static struct hid_driver tivo_driver = { |
72 | .name = "tivo_slide", |
73 | .id_table = tivo_devices, |
74 | .input_mapping = tivo_input_mapping, |
75 | }; |
76 | module_hid_driver(tivo_driver); |
77 | |
78 | MODULE_LICENSE("GPL"); |
79 | MODULE_AUTHOR("Jarod Wilson <jarod@redhat.com>"); |
80 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9