linux: add patch to support various SpinelPlus remote receivers

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2012-01-06 21:07:37 +01:00
parent 30d8ac84ca
commit 5ed0b489f2
11 changed files with 165 additions and 10 deletions

View File

@ -0,0 +1,145 @@
diff -Naur linux-3.2/drivers/hid/hid-ids.h linux-3.2.patch/drivers/hid/hid-ids.h
--- linux-3.2/drivers/hid/hid-ids.h 2012-01-05 00:55:44.000000000 +0100
+++ linux-3.2.patch/drivers/hid/hid-ids.h 2012-01-05 20:09:15.707390369 +0100
@@ -567,6 +567,8 @@
#define USB_VENDOR_ID_PHILIPS 0x0471
#define USB_DEVICE_ID_PHILIPS_IEEE802154_DONGLE 0x0617
+#define USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_1 0x206c
+#define USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_2 0x20cc
#define USB_VENDOR_ID_PI_ENGINEERING 0x05f3
#define USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL 0xff
diff -Naur linux-3.2/drivers/hid/hid-spinelplus.c linux-3.2.patch/drivers/hid/hid-spinelplus.c
--- linux-3.2/drivers/hid/hid-spinelplus.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-3.2.patch/drivers/hid/hid-spinelplus.c 2012-01-06 20:23:30.709596152 +0100
@@ -0,0 +1,102 @@
+/*
+ * HID driver for "PHILIPS MCE USB IR Receiver- Spinel plus" remotes
+ *
+ * Copyright (c) 2010 Panagiotis Skintzos
+ *
+ * Renamed to Spinel, cleanup and modified to also support
+ * Spinel Plus 0471:20CC by Stephan Raue 2012.
+ */
+
+/*
+ * 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/input.h>
+#include <linux/hid.h>
+#include <linux/module.h>
+
+#include "hid-ids.h"
+
+#define spinelplus_map_key(c) set_bit(EV_REP, hi->input->evbit); \
+ hid_map_usage_clear(hi, usage, bit, max, EV_KEY, (c))
+
+static int spinelplus_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) {
+ case 0xffbc000d: spinelplus_map_key(KEY_MEDIA); break;
+ case 0xffbc0024: spinelplus_map_key(KEY_MEDIA); break;
+ case 0xffbc0027: spinelplus_map_key(KEY_ZOOM); break;
+ case 0xffbc0035: spinelplus_map_key(KEY_CAMERA); break;
+ case 0xffbc0036: spinelplus_map_key(KEY_EPG); break;
+ case 0xffbc0037: spinelplus_map_key(KEY_DVD); break;
+ case 0xffbc0038: spinelplus_map_key(KEY_HOME); break;
+ case 0xffbc0039: spinelplus_map_key(KEY_MP3); break;
+ case 0xffbc003a: spinelplus_map_key(KEY_VIDEO); break;
+ case 0xffbc005a: spinelplus_map_key(KEY_TEXT); break;
+ case 0xffbc005b: spinelplus_map_key(KEY_RED); break;
+ case 0xffbc005c: spinelplus_map_key(KEY_GREEN); break;
+ case 0xffbc005d: spinelplus_map_key(KEY_YELLOW); break;
+ case 0xffbc005e: spinelplus_map_key(KEY_BLUE); break;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
+static int spinelplus_probe(struct hid_device *hdev,
+ const struct hid_device_id *id)
+{
+ int ret;
+ /* Connect only to hid input (not hiddev & hidraw)*/
+ unsigned int cmask = HID_CONNECT_HIDINPUT;
+
+ ret = hid_parse(hdev);
+ if (ret) {
+ dev_err(&hdev->dev, "parse failed\n");
+ goto err_free;
+ }
+
+ ret = hid_hw_start(hdev, cmask);
+ if (ret) {
+ dev_err(&hdev->dev, "hw start failed\n");
+ goto err_free;
+ }
+
+ return 0;
+err_free:
+ return ret;
+}
+
+static const struct hid_device_id spinelplus_devices[] = {
+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS,USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_1) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS,USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_2) },
+ { }
+};
+MODULE_DEVICE_TABLE(hid, spinelplus_devices);
+
+static struct hid_driver spinelplus_driver = {
+ .name = "SpinelPlus",
+ .id_table = spinelplus_devices,
+ .input_mapping = spinelplus_input_mapping,
+ .probe = spinelplus_probe,
+};
+
+static int __init spinelplus_init(void)
+{
+ return hid_register_driver(&spinelplus_driver);
+}
+
+static void __exit spinelplus_exit(void)
+{
+ hid_unregister_driver(&spinelplus_driver);
+}
+
+module_init(spinelplus_init);
+module_exit(spinelplus_exit);
+MODULE_LICENSE("GPL");
diff -Naur linux-3.2/drivers/hid/Kconfig linux-3.2.patch/drivers/hid/Kconfig
--- linux-3.2/drivers/hid/Kconfig 2012-01-05 00:55:44.000000000 +0100
+++ linux-3.2.patch/drivers/hid/Kconfig 2012-01-06 15:57:41.506995453 +0100
@@ -538,6 +538,12 @@
---help---
Support for Speedlink Vicious and Divine Cezanne mouse.
+config HID_SPINELPLUS
+ tristate "Spinel Plus remote control"
+ depends on USB_HID
+ ---help---
+ Say Y here if you have a Spinel Plus (0471:206c or 0471:20cc) remote
+
config HID_SUNPLUS
tristate "Sunplus wireless desktop"
depends on USB_HID
diff -Naur linux-3.2/drivers/hid/Makefile linux-3.2.patch/drivers/hid/Makefile
--- linux-3.2/drivers/hid/Makefile 2012-01-05 00:55:44.000000000 +0100
+++ linux-3.2.patch/drivers/hid/Makefile 2012-01-06 15:57:20.878623877 +0100
@@ -67,6 +67,7 @@
obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o
obj-$(CONFIG_HID_SONY) += hid-sony.o
obj-$(CONFIG_HID_SPEEDLINK) += hid-speedlink.o
+obj-$(CONFIG_HID_SPINELPLUS) += hid-spinelplus.o
obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o
obj-$(CONFIG_HID_GREENASIA) += hid-gaff.o
obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/i386 3.2.0-rc7 Kernel Configuration
# Linux/i386 3.2.0 Kernel Configuration
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
@ -2110,6 +2110,7 @@ CONFIG_HID_ORTEK=y
# CONFIG_HID_SAMSUNG is not set
CONFIG_HID_SONY=y
# CONFIG_HID_SPEEDLINK is not set
CONFIG_HID_SPINELPLUS=y
CONFIG_HID_SUNPLUS=y
# CONFIG_HID_GREENASIA is not set
# CONFIG_HID_SMARTJOYPLUS is not set

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/i386 3.2.0-rc7 Kernel Configuration
# Linux/i386 3.2.0 Kernel Configuration
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
@ -2388,6 +2388,7 @@ CONFIG_HID_ORTEK=y
# CONFIG_HID_SAMSUNG is not set
CONFIG_HID_SONY=y
# CONFIG_HID_SPEEDLINK is not set
CONFIG_HID_SPINELPLUS=y
CONFIG_HID_SUNPLUS=y
# CONFIG_HID_GREENASIA is not set
# CONFIG_HID_SMARTJOYPLUS is not set

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 3.2.0-rc7 Kernel Configuration
# Linux/x86_64 3.2.0 Kernel Configuration
#
CONFIG_64BIT=y
# CONFIG_X86_32 is not set
@ -2338,6 +2338,7 @@ CONFIG_HID_ORTEK=y
# CONFIG_HID_SAMSUNG is not set
CONFIG_HID_SONY=y
# CONFIG_HID_SPEEDLINK is not set
CONFIG_HID_SPINELPLUS=y
CONFIG_HID_SUNPLUS=y
# CONFIG_HID_GREENASIA is not set
# CONFIG_HID_SMARTJOYPLUS is not set

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/i386 3.2.0-rc7 Kernel Configuration
# Linux/i386 3.2.0 Kernel Configuration
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
@ -2517,6 +2517,7 @@ CONFIG_HID_ORTEK=y
# CONFIG_HID_SAMSUNG is not set
CONFIG_HID_SONY=y
# CONFIG_HID_SPEEDLINK is not set
CONFIG_HID_SPINELPLUS=y
CONFIG_HID_SUNPLUS=y
# CONFIG_HID_GREENASIA is not set
# CONFIG_HID_SMARTJOYPLUS is not set

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/i386 3.2.0-rc7 Kernel Configuration
# Linux/i386 3.2.0 Kernel Configuration
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
@ -2517,6 +2517,7 @@ CONFIG_HID_ORTEK=y
# CONFIG_HID_SAMSUNG is not set
CONFIG_HID_SONY=y
# CONFIG_HID_SPEEDLINK is not set
CONFIG_HID_SPINELPLUS=y
CONFIG_HID_SUNPLUS=y
# CONFIG_HID_GREENASIA is not set
# CONFIG_HID_SMARTJOYPLUS is not set

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/i386 3.2.0-rc7 Kernel Configuration
# Linux/i386 3.2.0 Kernel Configuration
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
@ -2363,6 +2363,7 @@ CONFIG_HID_ORTEK=y
# CONFIG_HID_SAMSUNG is not set
CONFIG_HID_SONY=y
# CONFIG_HID_SPEEDLINK is not set
CONFIG_HID_SPINELPLUS=y
CONFIG_HID_SUNPLUS=y
# CONFIG_HID_GREENASIA is not set
# CONFIG_HID_SMARTJOYPLUS is not set

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 3.2.0-rc7 Kernel Configuration
# Linux/x86_64 3.2.0 Kernel Configuration
#
CONFIG_64BIT=y
# CONFIG_X86_32 is not set
@ -2305,6 +2305,7 @@ CONFIG_HID_ORTEK=y
# CONFIG_HID_SAMSUNG is not set
CONFIG_HID_SONY=y
# CONFIG_HID_SPEEDLINK is not set
CONFIG_HID_SPINELPLUS=y
CONFIG_HID_SUNPLUS=y
# CONFIG_HID_GREENASIA is not set
# CONFIG_HID_SMARTJOYPLUS is not set

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/i386 3.2.0-rc7 Kernel Configuration
# Linux/i386 3.2.0 Kernel Configuration
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
@ -2417,6 +2417,7 @@ CONFIG_HID_ORTEK=y
# CONFIG_HID_SAMSUNG is not set
CONFIG_HID_SONY=y
# CONFIG_HID_SPEEDLINK is not set
CONFIG_HID_SPINELPLUS=y
CONFIG_HID_SUNPLUS=y
# CONFIG_HID_GREENASIA is not set
# CONFIG_HID_SMARTJOYPLUS is not set

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 3.2.0-rc7 Kernel Configuration
# Linux/x86_64 3.2.0 Kernel Configuration
#
CONFIG_64BIT=y
# CONFIG_X86_32 is not set
@ -2360,6 +2360,7 @@ CONFIG_HID_ORTEK=y
# CONFIG_HID_SAMSUNG is not set
CONFIG_HID_SONY=y
# CONFIG_HID_SPEEDLINK is not set
CONFIG_HID_SPINELPLUS=y
CONFIG_HID_SUNPLUS=y
# CONFIG_HID_GREENASIA is not set
# CONFIG_HID_SMARTJOYPLUS is not set

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 3.2.0-rc7 Kernel Configuration
# Linux/x86_64 3.2.0 Kernel Configuration
#
CONFIG_64BIT=y
# CONFIG_X86_32 is not set
@ -2179,6 +2179,7 @@ CONFIG_HID_ORTEK=y
# CONFIG_HID_SAMSUNG is not set
CONFIG_HID_SONY=y
# CONFIG_HID_SPEEDLINK is not set
CONFIG_HID_SPINELPLUS=y
CONFIG_HID_SUNPLUS=y
# CONFIG_HID_GREENASIA is not set
# CONFIG_HID_SMARTJOYPLUS is not set