summaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-tivo.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-20 21:11:42 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-20 21:11:42 -0700
commitd464c92b5234227c1698862a1906827e2e398ae0 (patch)
tree85bfa3a222fd04ab6bee19d0143426c7080553d4 /drivers/hid/hid-tivo.c
parent3b59bf081622b6446db77ad06c93fe23677bc533 (diff)
parent4a247a4119ee932e06e985e0a95a13c3eed4715b (diff)
downloadlinux-d464c92b5234227c1698862a1906827e2e398ae0.tar.bz2
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID updates from Jiri Kosina: "It contains HID driver updates all over the place -- a lot of new hardware support especially in the multitouch area, including generic handling of all multitouch devices by the hid-multitiouch driver automatically." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (42 commits) HID: multitouch: add PID for Fructel product HID: wacom: Add reporting of wheel for Intuos4 WL HID: wacom: Replace __set_bit with input_set_capability HID: tivo: add support for BT-version (0x1200) HID: wacom: Reset stylus buttons - Intuos4 WL HID: multitouch: detect serial protocol HID: handle all multitouch devices through hid-multitouch HID: multitouch: fix handling of buggy reports descriptors for Dell ST2220T HID: make it possible to force hid-core claim the device HID: multitouch: add support for eGalax 0x722a HID: usbhid: add quirk no_get for quanta 3008 devices HID: multitouch: add more eGalax devices HID: multitouch: add new PID from Ideacom HID: multitouch: add support for Atmel maXTouch 03eb:2118 HID: waltop: Add support for tablet with PID 0038 HID: waltop: Replace original rdescs with links HID: uclogic: Replace original rdescs with links HID: wacom: Add pad buttons reporting on Intuos4 WL HID: wacom: report distance for Intuos4 WL HID: kye: Add support for 3 tablets ...
Diffstat (limited to 'drivers/hid/hid-tivo.c')
-rw-r--r--drivers/hid/hid-tivo.c90
1 files changed, 90 insertions, 0 deletions
diff --git a/drivers/hid/hid-tivo.c b/drivers/hid/hid-tivo.c
new file mode 100644
index 000000000000..de47039c708c
--- /dev/null
+++ b/drivers/hid/hid-tivo.c
@@ -0,0 +1,90 @@
+/*
+ * HID driver for TiVo Slide Bluetooth remote
+ *
+ * Copyright (c) 2011 Jarod Wilson <jarod@redhat.com>
+ * based on the hid-topseed driver, which is in turn, based on hid-cherry...
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+
+#include <linux/device.h>
+#include <linux/hid.h>
+#include <linux/module.h>
+
+#include "hid-ids.h"
+
+#define HID_UP_TIVOVENDOR 0xffff0000
+#define tivo_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
+ EV_KEY, (c))
+
+static int tivo_input_mapping(struct hid_device *hdev, struct hid_input *hi,
+ struct hid_field *field, struct hid_usage *usage,
+ unsigned long **bit, int *max)
+{
+ switch (usage->hid & HID_USAGE_PAGE) {
+ case HID_UP_TIVOVENDOR:
+ switch (usage->hid & HID_USAGE) {
+ /* TiVo button */
+ case 0x3d: tivo_map_key_clear(KEY_MEDIA); break;
+ /* Live TV */
+ case 0x3e: tivo_map_key_clear(KEY_TV); break;
+ /* Red thumbs down */
+ case 0x41: tivo_map_key_clear(KEY_KPMINUS); break;
+ /* Green thumbs up */
+ case 0x42: tivo_map_key_clear(KEY_KPPLUS); break;
+ default:
+ return 0;
+ }
+ break;
+ case HID_UP_CONSUMER:
+ switch (usage->hid & HID_USAGE) {
+ /* Enter/Last (default mapping: KEY_LAST) */
+ case 0x083: tivo_map_key_clear(KEY_ENTER); break;
+ /* Info (default mapping: KEY_PROPS) */
+ case 0x209: tivo_map_key_clear(KEY_INFO); break;
+ default:
+ return 0;
+ }
+ break;
+ default:
+ return 0;
+ }
+
+ /* This means we found a matching mapping here, else, look in the
+ * standard hid mappings in hid-input.c */
+ return 1;
+}
+
+static const struct hid_device_id tivo_devices[] = {
+ /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */
+ { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) },
+ { }
+};
+MODULE_DEVICE_TABLE(hid, tivo_devices);
+
+static struct hid_driver tivo_driver = {
+ .name = "tivo_slide",
+ .id_table = tivo_devices,
+ .input_mapping = tivo_input_mapping,
+};
+
+static int __init tivo_init(void)
+{
+ return hid_register_driver(&tivo_driver);
+}
+
+static void __exit tivo_exit(void)
+{
+ hid_unregister_driver(&tivo_driver);
+}
+
+module_init(tivo_init);
+module_exit(tivo_exit);
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Jarod Wilson <jarod@redhat.com>");