mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-25 19:56:43 +00:00
Merge pull request #9498 from HiassofT/le13-linux-patches-cleanup
linux: drop ancient patches that never went upstream
This commit is contained in:
commit
ec5fe8c8d3
@ -1,206 +0,0 @@
|
|||||||
commit 5a596921a4636e62843a59b7eab7b87b70a6d296
|
|
||||||
Author: Lukas Rusak <lorusak@gmail.com>
|
|
||||||
Date: Sun May 6 22:03:11 2018 -0700
|
|
||||||
|
|
||||||
HID: add ouya HID driver
|
|
||||||
|
|
||||||
This driver is a simple implementation to get the controller working and mapped properly.
|
|
||||||
This driver does not include functionality for the touchpad (yet). The original driver
|
|
||||||
was taken from from the ouya linux tree and has been simplified. It seems there may have
|
|
||||||
been other versions of the controller present that had a broken report descriptor. I have
|
|
||||||
removed that for now.
|
|
||||||
|
|
||||||
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
|
|
||||||
index 60252fd796f6..6be2c454e72e 100644
|
|
||||||
--- a/drivers/hid/Kconfig
|
|
||||||
+++ b/drivers/hid/Kconfig
|
|
||||||
@@ -659,6 +659,12 @@ config HID_ORTEK
|
|
||||||
- Ortek WKB-2000
|
|
||||||
- Skycable wireless presenter
|
|
||||||
|
|
||||||
+config HID_OUYA
|
|
||||||
+ tristate "OUYA Game Controller"
|
|
||||||
+ depends on USB_HID
|
|
||||||
+ help
|
|
||||||
+ Support for OUYA Game Controller.
|
|
||||||
+
|
|
||||||
config HID_PANTHERLORD
|
|
||||||
tristate "Pantherlord/GreenAsia game controller"
|
|
||||||
depends on HID
|
|
||||||
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
|
|
||||||
index 17a8bd97da9d..4425890934e4 100644
|
|
||||||
--- a/drivers/hid/Makefile
|
|
||||||
+++ b/drivers/hid/Makefile
|
|
||||||
@@ -71,6 +71,7 @@ obj-$(CONFIG_HID_MULTITOUCH) += hid-multitouch.o
|
|
||||||
obj-$(CONFIG_HID_NTI) += hid-nti.o
|
|
||||||
obj-$(CONFIG_HID_NTRIG) += hid-ntrig.o
|
|
||||||
obj-$(CONFIG_HID_ORTEK) += hid-ortek.o
|
|
||||||
+obj-$(CONFIG_HID_OUYA) += hid-ouya.o
|
|
||||||
obj-$(CONFIG_HID_PRODIKEYS) += hid-prodikeys.o
|
|
||||||
obj-$(CONFIG_HID_PANTHERLORD) += hid-pl.o
|
|
||||||
obj-$(CONFIG_HID_PENMOUNT) += hid-penmount.o
|
|
||||||
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
|
|
||||||
index 0b5cc910f62e..0528efb825fa 100644
|
|
||||||
--- a/drivers/hid/hid-ids.h
|
|
||||||
+++ b/drivers/hid/hid-ids.h
|
|
||||||
@@ -859,6 +859,9 @@
|
|
||||||
#define USB_DEVICE_ID_ORTEK_WKB2000 0x2000
|
|
||||||
#define USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S 0x8003
|
|
||||||
|
|
||||||
+#define USB_VENDOR_ID_OUYA 0x2836
|
|
||||||
+#define USB_DEVICE_ID_OUYA_CONTROLLER 0x0001
|
|
||||||
+
|
|
||||||
#define USB_VENDOR_ID_PLANTRONICS 0x047f
|
|
||||||
|
|
||||||
#define USB_VENDOR_ID_PANASONIC 0x04da
|
|
||||||
diff --git a/drivers/hid/hid-ouya.c b/drivers/hid/hid-ouya.c
|
|
||||||
new file mode 100644
|
|
||||||
index 000000000000..4344a47b40af
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/drivers/hid/hid-ouya.c
|
|
||||||
@@ -0,0 +1,131 @@
|
|
||||||
+/*
|
|
||||||
+ * HID driver for OUYA Game Controller(s)
|
|
||||||
+ *
|
|
||||||
+ * Copyright (c) 2013 OUYA
|
|
||||||
+ * Copyright (c) 2013 Gregorios Leach <optikflux@gmail.com>
|
|
||||||
+ * Copyright (c) 2018 Lukas Rusak <lorusak@gmail.com>
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#include <linux/device.h>
|
|
||||||
+#include <linux/hid.h>
|
|
||||||
+#include <linux/input.h>
|
|
||||||
+#include <linux/module.h>
|
|
||||||
+
|
|
||||||
+#include "hid-ids.h"
|
|
||||||
+
|
|
||||||
+static const unsigned int ouya_absmap[] = {
|
|
||||||
+ [0x30] = ABS_X, /* left stick X */
|
|
||||||
+ [0x31] = ABS_Y, /* left stick Y */
|
|
||||||
+ [0x32] = ABS_Z, /* L2 */
|
|
||||||
+ [0x33] = ABS_RX, /* right stick X */
|
|
||||||
+ [0x34] = ABS_RY, /* right stick Y */
|
|
||||||
+ [0x35] = ABS_RZ, /* R2 */
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static const unsigned int ouya_keymap[] = {
|
|
||||||
+ [0x1] = BTN_SOUTH, /* O */
|
|
||||||
+ [0x2] = BTN_WEST, /* U */
|
|
||||||
+ [0x3] = BTN_NORTH, /* Y */
|
|
||||||
+ [0x4] = BTN_EAST, /* A */
|
|
||||||
+ [0x5] = BTN_TL, /* L1 */
|
|
||||||
+ [0x6] = BTN_TR, /* R1 */
|
|
||||||
+ [0x7] = BTN_THUMBL, /* L3 */
|
|
||||||
+ [0x8] = BTN_THUMBR, /* R3 */
|
|
||||||
+ [0x9] = BTN_DPAD_UP, /* Up */
|
|
||||||
+ [0xa] = BTN_DPAD_DOWN, /* Down */
|
|
||||||
+ [0xb] = BTN_DPAD_LEFT, /* Left */
|
|
||||||
+ [0xc] = BTN_DPAD_RIGHT, /* Right */
|
|
||||||
+ [0xd] = BTN_TL2, /* L2 */
|
|
||||||
+ [0xe] = BTN_TR2, /* R2 */
|
|
||||||
+ [0xf] = BTN_MODE, /* Power */
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static int ouya_input_mapping(struct hid_device *hdev, struct hid_input *hi,
|
|
||||||
+ struct hid_field *field, struct hid_usage *usage,
|
|
||||||
+ unsigned long **bit, int *max)
|
|
||||||
+{
|
|
||||||
+ if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) {
|
|
||||||
+ unsigned int key = usage->hid & HID_USAGE;
|
|
||||||
+
|
|
||||||
+ if (key >= ARRAY_SIZE(ouya_keymap))
|
|
||||||
+ return -1;
|
|
||||||
+
|
|
||||||
+ key = ouya_keymap[key];
|
|
||||||
+ hid_map_usage_clear(hi, usage, bit, max, EV_KEY, key);
|
|
||||||
+
|
|
||||||
+ return 1;
|
|
||||||
+
|
|
||||||
+ } else if ((usage->hid & HID_USAGE_PAGE) == HID_UP_GENDESK) {
|
|
||||||
+ unsigned int abs = usage->hid & HID_USAGE;
|
|
||||||
+
|
|
||||||
+ if (abs >= ARRAY_SIZE(ouya_absmap))
|
|
||||||
+ return -1;
|
|
||||||
+
|
|
||||||
+ abs = ouya_absmap[abs];
|
|
||||||
+ hid_map_usage_clear(hi, usage, bit, max, EV_ABS, abs);
|
|
||||||
+
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int ouya_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
|
||||||
+{
|
|
||||||
+ int ret;
|
|
||||||
+
|
|
||||||
+ ret = hid_parse(hdev);
|
|
||||||
+ if (ret) {
|
|
||||||
+ hid_err(hdev, "parse failed\n");
|
|
||||||
+ goto err_free;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | HID_CONNECT_HIDDEV_FORCE);
|
|
||||||
+ if (ret) {
|
|
||||||
+ hid_err(hdev, "hw start failed\n");
|
|
||||||
+ goto err_free;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+err_free:
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void ouya_remove(struct hid_device *hdev)
|
|
||||||
+{
|
|
||||||
+ hid_hw_stop(hdev);
|
|
||||||
+ kfree(hid_get_drvdata(hdev));
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static const struct hid_device_id ouya_devices[] = {
|
|
||||||
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_OUYA, USB_DEVICE_ID_OUYA_CONTROLLER) },
|
|
||||||
+ { }
|
|
||||||
+};
|
|
||||||
+MODULE_DEVICE_TABLE(hid, ouya_devices);
|
|
||||||
+
|
|
||||||
+static struct hid_driver ouya_driver = {
|
|
||||||
+ .name = "ouya",
|
|
||||||
+ .id_table = ouya_devices,
|
|
||||||
+ .input_mapping = ouya_input_mapping,
|
|
||||||
+ .probe = ouya_probe,
|
|
||||||
+ .remove = ouya_remove,
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static int __init ouya_init(void)
|
|
||||||
+{
|
|
||||||
+ return hid_register_driver(&ouya_driver);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void __exit ouya_exit(void)
|
|
||||||
+{
|
|
||||||
+ hid_unregister_driver(&ouya_driver);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+module_init(ouya_init);
|
|
||||||
+module_exit(ouya_exit);
|
|
||||||
+
|
|
||||||
+MODULE_LICENSE("GPL");
|
|
||||||
+MODULE_AUTHOR("Lukas Rusak <lorusak@gmail.com>");
|
|
||||||
+MODULE_AUTHOR("Gregorios Leach <optikflux@gmail.com>");
|
|
||||||
+MODULE_DESCRIPTION("Ouya Controller Driver");
|
|
||||||
diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
|
|
||||||
index 587e2681a53f..b5adc13e0df1 100644
|
|
||||||
--- a/drivers/hid/hid-quirks.c
|
|
||||||
+++ b/drivers/hid/hid-quirks.c
|
|
||||||
@@ -538,6 +538,9 @@ static const struct hid_device_id hid_have_special_driver[] = {
|
|
||||||
{ HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S) },
|
|
||||||
{ HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
|
|
||||||
#endif
|
|
||||||
+#if IS_ENABLED(CONFIG_HID_OUYA)
|
|
||||||
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_OUYA, USB_DEVICE_ID_OUYA_CONTROLLER) },
|
|
||||||
+#endif
|
|
||||||
#if IS_ENABLED(CONFIG_HID_PANTHERLORD)
|
|
||||||
{ HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) },
|
|
||||||
{ HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) },
|
|
@ -1,72 +0,0 @@
|
|||||||
From 7051422474e4c4e302ede3d07ffd8ef2682e07a2 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Stefan Saraev <stefan@saraev.ca>
|
|
||||||
Date: Tue, 22 Apr 2014 16:05:14 +0300
|
|
||||||
Subject: [PATCH] [RFC] hid/sony: add autorepeat for PS3 remotes
|
|
||||||
|
|
||||||
adapted to 6.10
|
|
||||||
|
|
||||||
Betreff: [RFC] hid/sony: add autorepeat for PS3 remotes
|
|
||||||
Von: David Dillow <dave@thedillows.org>
|
|
||||||
Datum: 28.06.2013 04:28
|
|
||||||
An: linux-input@vger.kernel.org
|
|
||||||
Kopie (CC): Stephan Raue <stephan@openelec.tv>
|
|
||||||
|
|
||||||
Some applications using the PS3 remote would like to have autorepeat
|
|
||||||
from the device. Use the input subsystem's software emulation to provide
|
|
||||||
this capability, and enable those that don't need it to turn it off.
|
|
||||||
---
|
|
||||||
I'm not sure this is the correct approach, or if it is even appropriate
|
|
||||||
for a remote to do autorepeat. However, the media/rc subsystem does do
|
|
||||||
it by default, and it's been requested by users, so there is at least
|
|
||||||
some demand.
|
|
||||||
|
|
||||||
This compiled against the hid-sony driver with the PS3 remote changes
|
|
||||||
merged, but I have done no testing of it. If the approach seems
|
|
||||||
reasonable, I'll try to test it when the MythTV is idle.
|
|
||||||
|
|
||||||
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
|
|
||||||
---
|
|
||||||
drivers/hid/hid-sony.c | 21 +++++++++++++++++++++
|
|
||||||
1 file changed, 21 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
|
|
||||||
index 310436a..84f7f41 100644
|
|
||||||
--- a/drivers/hid/hid-sony.c
|
|
||||||
+++ b/drivers/hid/hid-sony.c
|
|
||||||
@@ -743,6 +743,25 @@ static int ps3remote_mapping(struct hid_device *hdev, struct hid_input *hi,
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static int ps3remote_setup_repeat(struct hid_device *hdev)
|
|
||||||
+{
|
|
||||||
+ struct hid_input *hidinput = list_first_entry(&hdev->inputs,
|
|
||||||
+ struct hid_input, list);
|
|
||||||
+ struct input_dev *input = hidinput->input;
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * Set up autorepeat defaults per the remote control subsystem;
|
|
||||||
+ * this must be done after hid_hw_start(), as having these non-zero
|
|
||||||
+ * at the time of input_register_device() tells the input system that
|
|
||||||
+ * the hardware does the autorepeat, and the PS3 remote does not.
|
|
||||||
+ */
|
|
||||||
+ set_bit(EV_REP, input->evbit);
|
|
||||||
+ input->rep[REP_DELAY] = 500;
|
|
||||||
+ input->rep[REP_PERIOD] = 125;
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
static u8 *sony_report_fixup(struct hid_device *hdev, u8 *rdesc,
|
|
||||||
unsigned int *rsize)
|
|
||||||
{
|
|
||||||
@@ -2015,6 +2034,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
|
||||||
|
|
||||||
} else if (sc->quirks & MOTION_CONTROLLER) {
|
|
||||||
sony_init_output_report(sc, motion_send_output_report);
|
|
||||||
+ } else if (sc->quirks & PS3REMOTE) {
|
|
||||||
+ ret = ps3remote_setup_repeat(hdev);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sc->quirks & SONY_LED_SUPPORT) {
|
|
||||||
--
|
|
||||||
2.5.0
|
|
@ -1,206 +0,0 @@
|
|||||||
commit 5a596921a4636e62843a59b7eab7b87b70a6d296
|
|
||||||
Author: Lukas Rusak <lorusak@gmail.com>
|
|
||||||
Date: Sun May 6 22:03:11 2018 -0700
|
|
||||||
|
|
||||||
HID: add ouya HID driver
|
|
||||||
|
|
||||||
This driver is a simple implementation to get the controller working and mapped properly.
|
|
||||||
This driver does not include functionality for the touchpad (yet). The original driver
|
|
||||||
was taken from from the ouya linux tree and has been simplified. It seems there may have
|
|
||||||
been other versions of the controller present that had a broken report descriptor. I have
|
|
||||||
removed that for now.
|
|
||||||
|
|
||||||
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
|
|
||||||
index 60252fd796f6..6be2c454e72e 100644
|
|
||||||
--- a/drivers/hid/Kconfig
|
|
||||||
+++ b/drivers/hid/Kconfig
|
|
||||||
@@ -659,6 +659,12 @@ config HID_ORTEK
|
|
||||||
- Ortek WKB-2000
|
|
||||||
- Skycable wireless presenter
|
|
||||||
|
|
||||||
+config HID_OUYA
|
|
||||||
+ tristate "OUYA Game Controller"
|
|
||||||
+ depends on USB_HID
|
|
||||||
+ help
|
|
||||||
+ Support for OUYA Game Controller.
|
|
||||||
+
|
|
||||||
config HID_PANTHERLORD
|
|
||||||
tristate "Pantherlord/GreenAsia game controller"
|
|
||||||
depends on HID
|
|
||||||
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
|
|
||||||
index 17a8bd97da9d..4425890934e4 100644
|
|
||||||
--- a/drivers/hid/Makefile
|
|
||||||
+++ b/drivers/hid/Makefile
|
|
||||||
@@ -71,6 +71,7 @@ obj-$(CONFIG_HID_MULTITOUCH) += hid-multitouch.o
|
|
||||||
obj-$(CONFIG_HID_NTI) += hid-nti.o
|
|
||||||
obj-$(CONFIG_HID_NTRIG) += hid-ntrig.o
|
|
||||||
obj-$(CONFIG_HID_ORTEK) += hid-ortek.o
|
|
||||||
+obj-$(CONFIG_HID_OUYA) += hid-ouya.o
|
|
||||||
obj-$(CONFIG_HID_PRODIKEYS) += hid-prodikeys.o
|
|
||||||
obj-$(CONFIG_HID_PANTHERLORD) += hid-pl.o
|
|
||||||
obj-$(CONFIG_HID_PENMOUNT) += hid-penmount.o
|
|
||||||
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
|
|
||||||
index 0b5cc910f62e..0528efb825fa 100644
|
|
||||||
--- a/drivers/hid/hid-ids.h
|
|
||||||
+++ b/drivers/hid/hid-ids.h
|
|
||||||
@@ -859,6 +859,9 @@
|
|
||||||
#define USB_DEVICE_ID_ORTEK_WKB2000 0x2000
|
|
||||||
#define USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S 0x8003
|
|
||||||
|
|
||||||
+#define USB_VENDOR_ID_OUYA 0x2836
|
|
||||||
+#define USB_DEVICE_ID_OUYA_CONTROLLER 0x0001
|
|
||||||
+
|
|
||||||
#define USB_VENDOR_ID_PLANTRONICS 0x047f
|
|
||||||
|
|
||||||
#define USB_VENDOR_ID_PANASONIC 0x04da
|
|
||||||
diff --git a/drivers/hid/hid-ouya.c b/drivers/hid/hid-ouya.c
|
|
||||||
new file mode 100644
|
|
||||||
index 000000000000..4344a47b40af
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/drivers/hid/hid-ouya.c
|
|
||||||
@@ -0,0 +1,131 @@
|
|
||||||
+/*
|
|
||||||
+ * HID driver for OUYA Game Controller(s)
|
|
||||||
+ *
|
|
||||||
+ * Copyright (c) 2013 OUYA
|
|
||||||
+ * Copyright (c) 2013 Gregorios Leach <optikflux@gmail.com>
|
|
||||||
+ * Copyright (c) 2018 Lukas Rusak <lorusak@gmail.com>
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#include <linux/device.h>
|
|
||||||
+#include <linux/hid.h>
|
|
||||||
+#include <linux/input.h>
|
|
||||||
+#include <linux/module.h>
|
|
||||||
+
|
|
||||||
+#include "hid-ids.h"
|
|
||||||
+
|
|
||||||
+static const unsigned int ouya_absmap[] = {
|
|
||||||
+ [0x30] = ABS_X, /* left stick X */
|
|
||||||
+ [0x31] = ABS_Y, /* left stick Y */
|
|
||||||
+ [0x32] = ABS_Z, /* L2 */
|
|
||||||
+ [0x33] = ABS_RX, /* right stick X */
|
|
||||||
+ [0x34] = ABS_RY, /* right stick Y */
|
|
||||||
+ [0x35] = ABS_RZ, /* R2 */
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static const unsigned int ouya_keymap[] = {
|
|
||||||
+ [0x1] = BTN_SOUTH, /* O */
|
|
||||||
+ [0x2] = BTN_WEST, /* U */
|
|
||||||
+ [0x3] = BTN_NORTH, /* Y */
|
|
||||||
+ [0x4] = BTN_EAST, /* A */
|
|
||||||
+ [0x5] = BTN_TL, /* L1 */
|
|
||||||
+ [0x6] = BTN_TR, /* R1 */
|
|
||||||
+ [0x7] = BTN_THUMBL, /* L3 */
|
|
||||||
+ [0x8] = BTN_THUMBR, /* R3 */
|
|
||||||
+ [0x9] = BTN_DPAD_UP, /* Up */
|
|
||||||
+ [0xa] = BTN_DPAD_DOWN, /* Down */
|
|
||||||
+ [0xb] = BTN_DPAD_LEFT, /* Left */
|
|
||||||
+ [0xc] = BTN_DPAD_RIGHT, /* Right */
|
|
||||||
+ [0xd] = BTN_TL2, /* L2 */
|
|
||||||
+ [0xe] = BTN_TR2, /* R2 */
|
|
||||||
+ [0xf] = BTN_MODE, /* Power */
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static int ouya_input_mapping(struct hid_device *hdev, struct hid_input *hi,
|
|
||||||
+ struct hid_field *field, struct hid_usage *usage,
|
|
||||||
+ unsigned long **bit, int *max)
|
|
||||||
+{
|
|
||||||
+ if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) {
|
|
||||||
+ unsigned int key = usage->hid & HID_USAGE;
|
|
||||||
+
|
|
||||||
+ if (key >= ARRAY_SIZE(ouya_keymap))
|
|
||||||
+ return -1;
|
|
||||||
+
|
|
||||||
+ key = ouya_keymap[key];
|
|
||||||
+ hid_map_usage_clear(hi, usage, bit, max, EV_KEY, key);
|
|
||||||
+
|
|
||||||
+ return 1;
|
|
||||||
+
|
|
||||||
+ } else if ((usage->hid & HID_USAGE_PAGE) == HID_UP_GENDESK) {
|
|
||||||
+ unsigned int abs = usage->hid & HID_USAGE;
|
|
||||||
+
|
|
||||||
+ if (abs >= ARRAY_SIZE(ouya_absmap))
|
|
||||||
+ return -1;
|
|
||||||
+
|
|
||||||
+ abs = ouya_absmap[abs];
|
|
||||||
+ hid_map_usage_clear(hi, usage, bit, max, EV_ABS, abs);
|
|
||||||
+
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int ouya_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
|
||||||
+{
|
|
||||||
+ int ret;
|
|
||||||
+
|
|
||||||
+ ret = hid_parse(hdev);
|
|
||||||
+ if (ret) {
|
|
||||||
+ hid_err(hdev, "parse failed\n");
|
|
||||||
+ goto err_free;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT | HID_CONNECT_HIDDEV_FORCE);
|
|
||||||
+ if (ret) {
|
|
||||||
+ hid_err(hdev, "hw start failed\n");
|
|
||||||
+ goto err_free;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+
|
|
||||||
+err_free:
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void ouya_remove(struct hid_device *hdev)
|
|
||||||
+{
|
|
||||||
+ hid_hw_stop(hdev);
|
|
||||||
+ kfree(hid_get_drvdata(hdev));
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static const struct hid_device_id ouya_devices[] = {
|
|
||||||
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_OUYA, USB_DEVICE_ID_OUYA_CONTROLLER) },
|
|
||||||
+ { }
|
|
||||||
+};
|
|
||||||
+MODULE_DEVICE_TABLE(hid, ouya_devices);
|
|
||||||
+
|
|
||||||
+static struct hid_driver ouya_driver = {
|
|
||||||
+ .name = "ouya",
|
|
||||||
+ .id_table = ouya_devices,
|
|
||||||
+ .input_mapping = ouya_input_mapping,
|
|
||||||
+ .probe = ouya_probe,
|
|
||||||
+ .remove = ouya_remove,
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static int __init ouya_init(void)
|
|
||||||
+{
|
|
||||||
+ return hid_register_driver(&ouya_driver);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static void __exit ouya_exit(void)
|
|
||||||
+{
|
|
||||||
+ hid_unregister_driver(&ouya_driver);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+module_init(ouya_init);
|
|
||||||
+module_exit(ouya_exit);
|
|
||||||
+
|
|
||||||
+MODULE_LICENSE("GPL");
|
|
||||||
+MODULE_AUTHOR("Lukas Rusak <lorusak@gmail.com>");
|
|
||||||
+MODULE_AUTHOR("Gregorios Leach <optikflux@gmail.com>");
|
|
||||||
+MODULE_DESCRIPTION("Ouya Controller Driver");
|
|
||||||
diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
|
|
||||||
index 587e2681a53f..b5adc13e0df1 100644
|
|
||||||
--- a/drivers/hid/hid-quirks.c
|
|
||||||
+++ b/drivers/hid/hid-quirks.c
|
|
||||||
@@ -538,6 +538,9 @@ static const struct hid_device_id hid_have_special_driver[] = {
|
|
||||||
{ HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S) },
|
|
||||||
{ HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
|
|
||||||
#endif
|
|
||||||
+#if IS_ENABLED(CONFIG_HID_OUYA)
|
|
||||||
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_OUYA, USB_DEVICE_ID_OUYA_CONTROLLER) },
|
|
||||||
+#endif
|
|
||||||
#if IS_ENABLED(CONFIG_HID_PANTHERLORD)
|
|
||||||
{ HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) },
|
|
||||||
{ HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) },
|
|
@ -1,72 +0,0 @@
|
|||||||
From 7051422474e4c4e302ede3d07ffd8ef2682e07a2 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Stefan Saraev <stefan@saraev.ca>
|
|
||||||
Date: Tue, 22 Apr 2014 16:05:14 +0300
|
|
||||||
Subject: [PATCH] [RFC] hid/sony: add autorepeat for PS3 remotes
|
|
||||||
|
|
||||||
adapted to 4.6
|
|
||||||
|
|
||||||
Betreff: [RFC] hid/sony: add autorepeat for PS3 remotes
|
|
||||||
Von: David Dillow <dave@thedillows.org>
|
|
||||||
Datum: 28.06.2013 04:28
|
|
||||||
An: linux-input@vger.kernel.org
|
|
||||||
Kopie (CC): Stephan Raue <stephan@openelec.tv>
|
|
||||||
|
|
||||||
Some applications using the PS3 remote would like to have autorepeat
|
|
||||||
from the device. Use the input subsystem's software emulation to provide
|
|
||||||
this capability, and enable those that don't need it to turn it off.
|
|
||||||
---
|
|
||||||
I'm not sure this is the correct approach, or if it is even appropriate
|
|
||||||
for a remote to do autorepeat. However, the media/rc subsystem does do
|
|
||||||
it by default, and it's been requested by users, so there is at least
|
|
||||||
some demand.
|
|
||||||
|
|
||||||
This compiled against the hid-sony driver with the PS3 remote changes
|
|
||||||
merged, but I have done no testing of it. If the approach seems
|
|
||||||
reasonable, I'll try to test it when the MythTV is idle.
|
|
||||||
|
|
||||||
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
|
|
||||||
---
|
|
||||||
drivers/hid/hid-sony.c | 21 +++++++++++++++++++++
|
|
||||||
1 file changed, 21 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
|
|
||||||
index 310436a..84f7f41 100644
|
|
||||||
--- a/drivers/hid/hid-sony.c
|
|
||||||
+++ b/drivers/hid/hid-sony.c
|
|
||||||
@@ -1120,6 +1120,25 @@ static int ps3remote_mapping(struct hid_device *hdev, struct hid_input *hi,
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static int ps3remote_setup_repeat(struct hid_device *hdev)
|
|
||||||
+{
|
|
||||||
+ struct hid_input *hidinput = list_first_entry(&hdev->inputs,
|
|
||||||
+ struct hid_input, list);
|
|
||||||
+ struct input_dev *input = hidinput->input;
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * Set up autorepeat defaults per the remote control subsystem;
|
|
||||||
+ * this must be done after hid_hw_start(), as having these non-zero
|
|
||||||
+ * at the time of input_register_device() tells the input system that
|
|
||||||
+ * the hardware does the autorepeat, and the PS3 remote does not.
|
|
||||||
+ */
|
|
||||||
+ set_bit(EV_REP, input->evbit);
|
|
||||||
+ input->rep[REP_DELAY] = 500;
|
|
||||||
+ input->rep[REP_PERIOD] = 125;
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
static u8 *sony_report_fixup(struct hid_device *hdev, u8 *rdesc,
|
|
||||||
unsigned int *rsize)
|
|
||||||
{
|
|
||||||
@@ -2372,6 +2391,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
|
||||||
sony_init_output_report(sc, dualshock4_send_output_report);
|
|
||||||
} else if (sc->quirks & MOTION_CONTROLLER) {
|
|
||||||
sony_init_output_report(sc, motion_send_output_report);
|
|
||||||
+ } else if (sc->quirks & PS3REMOTE) {
|
|
||||||
+ ret = ps3remote_setup_repeat(hdev);
|
|
||||||
} else {
|
|
||||||
ret = 0;
|
|
||||||
}
|
|
||||||
--
|
|
||||||
2.5.0
|
|
Loading…
x
Reference in New Issue
Block a user