linux (Generic): drop spinelplus - needs fixing

This commit is contained in:
MilhouseVH 2018-06-10 17:30:16 +01:00
parent d0cbdf3ca0
commit bd6aa784e5

View File

@ -1,177 +0,0 @@
From 91310f578291eabef1316eed38f79b05b8eaf568 Mon Sep 17 00:00:00 2001
From: MilhouseVH <milhouseVH.github@nmacleod.com>
Date: Mon, 19 Jun 2017 20:01:53 +0100
Subject: [PATCH] Spinel Plus remote 0.2
---
drivers/hid/Kconfig | 6 +++
drivers/hid/Makefile | 1 +
drivers/hid/hid-core.c | 4 ++
drivers/hid/hid-ids.h | 4 ++
drivers/hid/hid-spinelplus.c | 95 ++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 110 insertions(+)
create mode 100644 drivers/hid/hid-spinelplus.c
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 84500fd..6b625cf 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -808,6 +808,12 @@ config HID_STEELSERIES
---help---
Support for Steelseries SRW-S1 steering wheel
+config HID_SPINELPLUS
+ tristate "Spinel Plus remote control"
+ depends on USB_HID
+ ---help---
+ Say Y here if you have a Spinel Plus (0471:206c/20cc/0613/2168) remote
+
config HID_SUNPLUS
tristate "Sunplus wireless desktop"
depends on HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 4e22940..3205d88 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -92,6 +92,7 @@ obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o
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_STEELSERIES) += hid-steelseries.o
obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o
obj-$(CONFIG_HID_GREENASIA) += hid-gaff.o
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 32bcb50..11985b4 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2291,6 +2291,10 @@ static const struct hid_device_id hid_have_special_driver[] = {
#if IS_ENABLED(CONFIG_HID_ZYDACRON)
{ HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) },
#endif
+ { 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) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_3) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS, USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_4) },
{ }
};
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index f3cd724..b67d5e5 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -841,6 +841,10 @@
#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_DEVICE_ID_PHILIPS_SPINEL_PLUS_3 0x0613
+#define USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_4 0x2168
#define USB_VENDOR_ID_PI_ENGINEERING 0x05f3
#define USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL 0xff
diff --git a/drivers/hid/hid-spinelplus.c b/drivers/hid/hid-spinelplus.c
new file mode 100644
index 0000000..381c7b3
--- /dev/null
+++ b/drivers/hid/hid-spinelplus.c
@@ -0,0 +1,95 @@
+/*
+ * 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 0xffbc0033: spinelplus_map_key(KEY_HOME); 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) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS,USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_3) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_PHILIPS,USB_DEVICE_ID_PHILIPS_SPINEL_PLUS_4) },
+ { }
+};
+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,
+};
+
+module_hid_driver(spinelplus_driver);
+
+MODULE_LICENSE("GPL");
--
2.7.4