Skip to content

Commit f5cd71c

Browse files
lephilousophebentiss
authored andcommitted
HID: evision: Add preliminary support for EVision keyboards
For now only supports one model and only filters out bogus reports sent when the keyboard has been configured through hidraw. Without this, as events are not released, soft repeat floods userspace with unknown key events. Signed-off-by: Philippe Valembois <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
1 parent 7287904 commit f5cd71c

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

drivers/hid/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,13 @@ config HID_ELO
329329
Support for the ELO USB 4000/4500 touchscreens. Note that this is for
330330
different devices than those handled by CONFIG_TOUCHSCREEN_USB_ELO.
331331

332+
config HID_EVISION
333+
tristate "EVision Keyboards Support"
334+
depends on HID
335+
help
336+
Support for some EVision keyboards. Note that this is needed only when
337+
applying customization using userspace programs.
338+
332339
config HID_EZKEY
333340
tristate "Ezkey BTC 8193 keyboard"
334341
default !EXPERT

drivers/hid/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o
4545
obj-$(CONFIG_HID_ELAN) += hid-elan.o
4646
obj-$(CONFIG_HID_ELECOM) += hid-elecom.o
4747
obj-$(CONFIG_HID_ELO) += hid-elo.o
48+
obj-$(CONFIG_HID_EVISION) += hid-evision.o
4849
obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o
4950
obj-$(CONFIG_HID_FT260) += hid-ft260.o
5051
obj-$(CONFIG_HID_GEMBIRD) += hid-gembird.o

drivers/hid/hid-evision.c

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
/*
3+
* HID driver for EVision devices
4+
* For now, only ignore bogus consumer reports
5+
* sent after the keyboard has been configured
6+
*
7+
* Copyright (c) 2022 Philippe Valembois
8+
*/
9+
10+
#include <linux/device.h>
11+
#include <linux/input.h>
12+
#include <linux/hid.h>
13+
#include <linux/module.h>
14+
15+
#include "hid-ids.h"
16+
17+
static int evision_input_mapping(struct hid_device *hdev, struct hid_input *hi,
18+
struct hid_field *field, struct hid_usage *usage,
19+
unsigned long **bit, int *max)
20+
{
21+
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
22+
return 0;
23+
24+
/* Ignore key down event */
25+
if ((usage->hid & HID_USAGE) >> 8 == 0x05)
26+
return -1;
27+
/* Ignore key up event */
28+
if ((usage->hid & HID_USAGE) >> 8 == 0x06)
29+
return -1;
30+
31+
switch (usage->hid & HID_USAGE) {
32+
/* Ignore configuration saved event */
33+
case 0x0401: return -1;
34+
/* Ignore reset event */
35+
case 0x0402: return -1;
36+
}
37+
return 0;
38+
}
39+
40+
static const struct hid_device_id evision_devices[] = {
41+
{ HID_USB_DEVICE(USB_VENDOR_ID_EVISION, USB_DEVICE_ID_EVISION_ICL01) },
42+
{ }
43+
};
44+
MODULE_DEVICE_TABLE(hid, evision_devices);
45+
46+
static struct hid_driver evision_driver = {
47+
.name = "evision",
48+
.id_table = evision_devices,
49+
.input_mapping = evision_input_mapping,
50+
};
51+
module_hid_driver(evision_driver);
52+
53+
MODULE_LICENSE("GPL");

drivers/hid/hid-ids.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,9 @@
445445
#define USB_VENDOR_ID_EMS 0x2006
446446
#define USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II 0x0118
447447

448+
#define USB_VENDOR_ID_EVISION 0x320f
449+
#define USB_DEVICE_ID_EVISION_ICL01 0x5041
450+
448451
#define USB_VENDOR_ID_FLATFROG 0x25b5
449452
#define USB_DEVICE_ID_MULTITOUCH_3200 0x0002
450453

0 commit comments

Comments
 (0)