From 2b6087dcc4d9dc0f7c5812f750152dbad8a3b65a Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Sat, 17 Oct 2015 13:23:08 +0200 Subject: [PATCH] projects/WeTek_Play/patches/linux: add HID quirk for WeTek remote support Signed-off-by: Stephan Raue --- .../kodi/system/keymaps/wetek-remote.xml | 16 -- projects/WeTek_Play/linux/linux.arm.conf | 3 +- .../linux/linux-054-hbgic-remote-0.2.patch | 159 ++++++++++++++++++ 3 files changed, 161 insertions(+), 17 deletions(-) delete mode 100644 projects/WeTek_Play/filesystem/usr/share/kodi/system/keymaps/wetek-remote.xml create mode 100644 projects/WeTek_Play/patches/linux/linux-054-hbgic-remote-0.2.patch diff --git a/projects/WeTek_Play/filesystem/usr/share/kodi/system/keymaps/wetek-remote.xml b/projects/WeTek_Play/filesystem/usr/share/kodi/system/keymaps/wetek-remote.xml deleted file mode 100644 index 17f64df4d4..0000000000 --- a/projects/WeTek_Play/filesystem/usr/share/kodi/system/keymaps/wetek-remote.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - ContextMenu - ContextMenu - AspectRatio - AspectRatio - XBMC.ActivateWindow(Home) - XBMC.ActivateWindow(Home) - ActivateWindowAndFocus(MyPVR, 31,0, 10,0) - FullScreen - Screenshot - - - diff --git a/projects/WeTek_Play/linux/linux.arm.conf b/projects/WeTek_Play/linux/linux.arm.conf index a398d6a5da..3d3e446488 100644 --- a/projects/WeTek_Play/linux/linux.arm.conf +++ b/projects/WeTek_Play/linux/linux.arm.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 3.10.89 Kernel Configuration +# Linux/arm 3.10.90 Kernel Configuration # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y @@ -2856,6 +2856,7 @@ CONFIG_DRAGONRISE_FF=y # CONFIG_HID_EMS_FF is not set # CONFIG_HID_ELECOM is not set CONFIG_HID_EZKEY=y +CONFIG_HID_HBGIC=y # CONFIG_HID_HOLTEK is not set # CONFIG_HID_KEYTOUCH is not set CONFIG_HID_KYE=y diff --git a/projects/WeTek_Play/patches/linux/linux-054-hbgic-remote-0.2.patch b/projects/WeTek_Play/patches/linux/linux-054-hbgic-remote-0.2.patch new file mode 100644 index 0000000000..647081e159 --- /dev/null +++ b/projects/WeTek_Play/patches/linux/linux-054-hbgic-remote-0.2.patch @@ -0,0 +1,159 @@ +diff -Naur linux-amlogic-3.10-9df7905/drivers/hid/hid-core.c linux-amlogic-3.10-9df7905.patch/drivers/hid/hid-core.c +--- linux-amlogic-3.10-9df7905/drivers/hid/hid-core.c 2015-10-06 22:39:16.000000000 +0200 ++++ linux-amlogic-3.10-9df7905.patch/drivers/hid/hid-core.c 2015-10-15 17:00:49.982041731 +0200 +@@ -1678,6 +1678,7 @@ + { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, + { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, + { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) }, ++ { HID_USB_DEVICE(USB_VENDOR_ID_HBGIC, USB_DEVICE_ID_HBGIC_KEYBOARD) }, + { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK, USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP) }, + { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) }, + { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) }, +diff -Naur linux-amlogic-3.10-9df7905/drivers/hid/hid-hbgic-kbd.c linux-amlogic-3.10-9df7905.patch/drivers/hid/hid-hbgic-kbd.c +--- linux-amlogic-3.10-9df7905/drivers/hid/hid-hbgic-kbd.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-amlogic-3.10-9df7905.patch/drivers/hid/hid-hbgic-kbd.c 2015-10-15 16:57:28.067700413 +0200 +@@ -0,0 +1,103 @@ ++/* ++ * HID driver for "HBGIC Technology Co., Ltd. USB Keyboard Mouse" remotes ++ * ++ * Copyright (c) 2015 Stephan Raue ++ * ++ */ ++ ++/* ++ * 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 ++#include ++#include ++#include ++ ++#include "hid-ids.h" ++ ++#define hbgic_map_key(c) set_bit(EV_REP, hi->input->evbit); \ ++ hid_map_usage_clear(hi, usage, bit, max, EV_KEY, (c)) ++ ++static int hbgic_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 0x00070029: hbgic_map_key(KEY_BACK); break; ++ case 0x0007002a: hbgic_map_key(KEY_BACK); break; ++ case 0x0007003a: hbgic_map_key(KEY_BACK); break; ++ case 0x0007003b: hbgic_map_key(KEY_HOME); break; ++ case 0x0007003c: hbgic_map_key(KEY_HOMEPAGE); break; ++ case 0x0007003d: hbgic_map_key(KEY_MENU); break; ++ case 0x0007003e: hbgic_map_key(KEY_ZOOM); break; ++ case 0x0007003f: hbgic_map_key(KEY_FAVORITES); break; ++ case 0x00070040: hbgic_map_key(KEY_MENU); break; ++ case 0x00070041: hbgic_map_key(KEY_RED); break; ++ case 0x00070042: hbgic_map_key(KEY_GREEN); break; ++ case 0x00070043: hbgic_map_key(KEY_YELLOW); break; ++ case 0x00070044: hbgic_map_key(KEY_TEXT); break; ++ case 0x0007004a: hbgic_map_key(KEY_HOMEPAGE); break; ++ case 0x000700f1: hbgic_map_key(KEY_BACK); break; ++ case 0x000c00e2: hbgic_map_key(KEY_MUTE); break; ++ case 0x000c019e: hbgic_map_key(KEY_MUTE); break; ++ case 0x000c01c2: hbgic_map_key(KEY_BLUE); break; ++ case 0x000c0204: hbgic_map_key(KEY_FAVORITES); break; ++ default: ++ return 0; ++ } ++ return 1; ++} ++ ++static int hbgic_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 hbgic_devices[] = { ++ { HID_USB_DEVICE(USB_VENDOR_ID_HBGIC,USB_DEVICE_ID_HBGIC_KEYBOARD) }, ++ { } ++}; ++MODULE_DEVICE_TABLE(hid, hbgic_devices); ++ ++static struct hid_driver hbgic_driver = { ++ .name = "hbgic", ++ .id_table = hbgic_devices, ++ .input_mapping = hbgic_input_mapping, ++ .probe = hbgic_probe, ++}; ++ ++static int __init hbgic_init(void) ++{ ++ return hid_register_driver(&hbgic_driver); ++} ++ ++static void __exit hbgic_exit(void) ++{ ++ hid_unregister_driver(&hbgic_driver); ++} ++ ++module_init(hbgic_init); ++module_exit(hbgic_exit); ++MODULE_LICENSE("GPL"); +diff -Naur linux-amlogic-3.10-9df7905/drivers/hid/hid-ids.h linux-amlogic-3.10-9df7905.patch/drivers/hid/hid-ids.h +--- linux-amlogic-3.10-9df7905/drivers/hid/hid-ids.h 2015-10-15 14:26:12.536907873 +0200 ++++ linux-amlogic-3.10-9df7905.patch/drivers/hid/hid-ids.h 2015-10-15 16:57:28.068700414 +0200 +@@ -443,6 +443,9 @@ + #define USB_VENDOR_ID_ION 0x15e4 + #define USB_DEVICE_ID_ICADE 0x0132 + ++#define USB_VENDOR_ID_HBGIC 0x2252 ++#define USB_DEVICE_ID_HBGIC_KEYBOARD 0x0106 ++ + #define USB_VENDOR_ID_HOLTEK 0x1241 + #define USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP 0x5015 + +diff -Naur linux-amlogic-3.10-9df7905/drivers/hid/Kconfig linux-amlogic-3.10-9df7905.patch/drivers/hid/Kconfig +--- linux-amlogic-3.10-9df7905/drivers/hid/Kconfig 2015-10-15 14:26:12.537907875 +0200 ++++ linux-amlogic-3.10-9df7905.patch/drivers/hid/Kconfig 2015-10-15 16:57:28.457701048 +0200 +@@ -224,6 +224,12 @@ + ---help--- + Support for Ezkey BTC 8193 keyboard. + ++config HID_HBGIC ++ tristate "HBGIC Technology remote control" ++ depends on USB_HID ++ ---help--- ++ Say Y here if you have a HBGIC Technology (2252:0106) remote ++ + config HID_HOLTEK + tristate "Holtek HID devices" + depends on USB_HID +diff -Naur linux-amlogic-3.10-9df7905/drivers/hid/Makefile linux-amlogic-3.10-9df7905.patch/drivers/hid/Makefile +--- linux-amlogic-3.10-9df7905/drivers/hid/Makefile 2015-10-15 14:26:12.538907876 +0200 ++++ linux-amlogic-3.10-9df7905.patch/drivers/hid/Makefile 2015-10-15 16:57:28.458701050 +0200 +@@ -50,6 +50,7 @@ + obj-$(CONFIG_HID_ELECOM) += hid-elecom.o + obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o + obj-$(CONFIG_HID_GYRATION) += hid-gyration.o ++obj-$(CONFIG_HID_HBGIC) += hid-hbgic-kbd.o + obj-$(CONFIG_HID_HOLTEK) += hid-holtek-kbd.o + obj-$(CONFIG_HID_HOLTEK) += hid-holtekff.o + obj-$(CONFIG_HID_HYPERV_MOUSE) += hid-hyperv.o