HID: evision: Add preliminary support for EVision keyboards
PATCH 1/1 HID: evision: Add preliminary support for EVision keyboards
From: Philippe Valembois <[email protected]>
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.
--- drivers/hid/Kconfig | 7 ++++ drivers/hid/Makefile | 1 + drivers/hid/hid-evision.c | 79 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 drivers/hid/hid-evision.c
drivers/hid/Kconfig +7 -0
@@ -329,6 +329,13 @@ config HID_ELO Support for the ELO USB 4000/4500 touchscreens. Note that this is for different devices than those handled by CONFIG_TOUCHSCREEN_USB_ELO. +config HID_EVISION + tristate "EVision Keyboards Support" + depends on USB_HID + help + Support for some EVision keyboards. Note that this is needed only when + applying customization using userspace programs. + config HID_EZKEY tristate "Ezkey BTC 8193 keyboard" default !EXPERT
drivers/hid/Makefile +1 -0
@@ -45,6 +45,7 @@ obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o obj-$(CONFIG_HID_ELAN) += hid-elan.o obj-$(CONFIG_HID_ELECOM) += hid-elecom.o obj-$(CONFIG_HID_ELO) += hid-elo.o +obj-$(CONFIG_HID_EVISION) += hid-evision.o obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o obj-$(CONFIG_HID_FT260) += hid-ft260.o obj-$(CONFIG_HID_GEMBIRD) += hid-gembird.o
drivers/hid/hid-evision.c new file +79 -0
79 lines not on this page · raw message
Signature · 1 line
2.38.2
Quoted 2 lines · Philippe Valembois
From: Philippe Valembois <[email protected]>
Jiri, I have a doubt. Do we accept emails from users.noreply.github.com?
Quoted 19 lines
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]>--- drivers/hid/Kconfig | 7 ++++ drivers/hid/Makefile | 1 + drivers/hid/hid-evision.c | 79 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 drivers/hid/hid-evision.cdrivers/hid/Kconfig +0
-0
drivers/hid/Kconfig config HID_ELO · line 334
Quoted 6 lines
drivers/hid/Kconfig +3
-0@@ -329,6 +329,13 @@ config HID_ELO Support for the ELO USB 4000/4500 touchscreens. Note that this is for different devices than those handled by CONFIG_TOUCHSCREEN_USB_ELO. +config HID_EVISION + tristate "EVision Keyboards Support" + depends on USB_HID
AFAICT, the driver only uses pure HID API, so you should be able to depend on HID, not just USB_HID.
Quoted 29 lines
drivers/hid/Kconfig +4
-0+ help + Support for some EVision keyboards. Note that this is needed only when + applying customization using userspace programs. + config HID_EZKEY tristate "Ezkey BTC 8193 keyboard" default !EXPERTdrivers/hid/Makefile +1
-0@@ -45,6 +45,7 @@ obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o obj-$(CONFIG_HID_ELAN) += hid-elan.o obj-$(CONFIG_HID_ELECOM) += hid-elecom.o obj-$(CONFIG_HID_ELO) += hid-elo.o +obj-$(CONFIG_HID_EVISION) += hid-evision.o obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o obj-$(CONFIG_HID_FT260) += hid-ft260.o obj-$(CONFIG_HID_GEMBIRD) += hid-gembird.odrivers/hid/hid-evision.c new file +4
-0@@ -0,0 +1,79 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* HID driver for EVision devices +* For now, only ignore bogus consumer reports
drivers/hid/hid-evision.c line 14
Quoted 10 lines
drivers/hid/hid-evision.c new file +10
-0+* sent after the keyboard has been configured +* +* Copyright (c) 2022 Philippe Valembois +*/ + +#include <linux/device.h> +#include <linux/input.h> +#include <linux/hid.h> +#include <linux/module.h> +#include <linux/usb.h>
Outside of hid_is_usb(), you are not using anything USB related, so this can be dropped
drivers/hid/hid-evision.c line 18
Quoted 4 lines
drivers/hid/hid-evision.c new file +4
-0+ + +#define USB_VENDOR_ID_EVISION 0x320f +#define USB_DEVICE_ID_EVISION_ICL01 0x5041
We tend to add those variables in drivers/hid/hid-ids.h
drivers/hid/hid-evision.c line 27
Quoted 9 lines
drivers/hid/hid-evision.c new file +9
-0+ +static int evision_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_CONSUMER ) +return 0 ; + +// Ignore key down event
No C++ comments style please, use /* */ instead
drivers/hid/hid-evision.c line 30
Quoted 3 lines
drivers/hid/hid-evision.c new file +3
-0+if ((usage->hid &HID_USAGE ) >>8 ==0x05 ) +return -1 ; +// Ignore key up event
Same (and for any other // below).
Quoted 8 lines
drivers/hid/hid-evision.c new file +8
-0+if ((usage->hid &HID_USAGE ) >>8 ==0x06 ) +return -1 ; + +switch (usage->hid &HID_USAGE ) { +// Ignore configuration saved event +case 0x0401 :return -1 ; +// Ignore reset event +case 0x0402 :return -1 ;
drivers/hid/hid-evision.c line 48
Quoted 10 lines
drivers/hid/hid-evision.c new file +10
-0+ } +return 0 ; +} + +static int evision_probe (struct hid_device *hdev,const struct hid_device_id *id) +{ +int ret; + +if (!hid_is_usb (hdev)) +return -EINVAL ;
This can be dropped...
Quoted 4 lines
drivers/hid/hid-evision.c new file +4
-0+ + ret =hid_parse (hdev); +if (ret) { +hid_err (hdev,"EVision hid parse failed: %d\n" , ret);
drivers/hid/hid-evision.c line 62
Quoted 10 lines
drivers/hid/hid-evision.c new file +10
-0+return ret; + } + + ret =hid_hw_start (hdev,HID_CONNECT_DEFAULT ); +if (ret) { +hid_err (hdev,"EVision hw start failed: %d\n" , ret); +return ret; + } + +return 0 ;
... which means the probe is the default one, meaning it can also be dropped from the patch :)
drivers/hid/hid-evision.c line 75
Quoted 13 lines
drivers/hid/hid-evision.c new file +13
-0+} + +static const struct hid_device_id evision_devices[] = { + {HID_USB_DEVICE (USB_VENDOR_ID_EVISION ,USB_DEVICE_ID_EVISION_ICL01 ) }, + { } +}; +MODULE_DEVICE_TABLE (hid, evision_devices); + +static struct hid_driver evision_driver = { + .name ="evision" , + .id_table = evision_devices, + .input_mapping = evision_input_mapping, + .probe = evision_probe,
Just for completeness, remove that .probe line and your driver will behave the same and be smaller :)
Quoted 7 lines
drivers/hid/hid-evision.c new file +4
-1+}; +module_hid_driver (evision_driver); + +MODULE_LICENSE ("GPL" ); --2.38.2
Cheers,
Benjamin
PATCH v2 1/1 HID: evision: Add preliminary support for EVision keyboards
From: Philippe Valembois <[email protected]>
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.
--- drivers/hid/Kconfig | 7 ++++++ drivers/hid/Makefile | 1 + drivers/hid/hid-evision.c | 53 +++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-ids.h | 3 +++ 4 files changed, 64 insertions(+) create mode 100644 drivers/hid/hid-evision.c
drivers/hid/Kconfig +7 -0
@@ -329,6 +329,13 @@ config HID_ELO Support for the ELO USB 4000/4500 touchscreens. Note that this is for different devices than those handled by CONFIG_TOUCHSCREEN_USB_ELO. +config HID_EVISION + tristate "EVision Keyboards Support" + depends on HID + help + Support for some EVision keyboards. Note that this is needed only when + applying customization using userspace programs. + config HID_EZKEY tristate "Ezkey BTC 8193 keyboard" default !EXPERT
drivers/hid/Makefile +1 -0
@@ -45,6 +45,7 @@ obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o obj-$(CONFIG_HID_ELAN) += hid-elan.o obj-$(CONFIG_HID_ELECOM) += hid-elecom.o obj-$(CONFIG_HID_ELO) += hid-elo.o +obj-$(CONFIG_HID_EVISION) += hid-evision.o obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o obj-$(CONFIG_HID_FT260) += hid-ft260.o obj-$(CONFIG_HID_GEMBIRD) += hid-gembird.o
drivers/hid/hid-evision.c new file +53 -0
53 lines not on this page · raw message
drivers/hid/hid-ids.h +3 -0
@@ -445,6 +445,9 @@#define USB_VENDOR_ID_EMS 0x2006#define USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II 0x0118 +#define USB_VENDOR_ID_EVISION 0x320f +#define USB_DEVICE_ID_EVISION_ICL01 0x5041 +#define USB_VENDOR_ID_FLATFROG 0x25b5#define USB_DEVICE_ID_MULTITOUCH_3200 0x0002
Signature · 1 line
2.39.1
PATCH v3 1/1 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.
--- drivers/hid/Kconfig | 7 ++++++ drivers/hid/Makefile | 1 + drivers/hid/hid-evision.c | 53 +++++++++++++++++++++++++++++++++++++++ drivers/hid/hid-ids.h | 3 +++ 4 files changed, 64 insertions(+) create mode 100644 drivers/hid/hid-evision.c
drivers/hid/Kconfig +7 -0
@@ -329,6 +329,13 @@ config HID_ELO Support for the ELO USB 4000/4500 touchscreens. Note that this is for different devices than those handled by CONFIG_TOUCHSCREEN_USB_ELO. +config HID_EVISION + tristate "EVision Keyboards Support" + depends on HID + help + Support for some EVision keyboards. Note that this is needed only when + applying customization using userspace programs. + config HID_EZKEY tristate "Ezkey BTC 8193 keyboard" default !EXPERT
drivers/hid/Makefile +1 -0
@@ -45,6 +45,7 @@ obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o obj-$(CONFIG_HID_ELAN) += hid-elan.o obj-$(CONFIG_HID_ELECOM) += hid-elecom.o obj-$(CONFIG_HID_ELO) += hid-elo.o +obj-$(CONFIG_HID_EVISION) += hid-evision.o obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o obj-$(CONFIG_HID_FT260) += hid-ft260.o obj-$(CONFIG_HID_GEMBIRD) += hid-gembird.o
drivers/hid/hid-evision.c new file +53 -0
53 lines not on this page · raw message
drivers/hid/hid-ids.h +3 -0
@@ -445,6 +445,9 @@#define USB_VENDOR_ID_EMS 0x2006#define USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II 0x0118 +#define USB_VENDOR_ID_EVISION 0x320f +#define USB_DEVICE_ID_EVISION_ICL01 0x5041 +#define USB_VENDOR_ID_FLATFROG 0x25b5#define USB_DEVICE_ID_MULTITOUCH_3200 0x0002
Signature · 1 line
2.39.1
Benjamin Tissoires
AppliedQuoted 6 lines · Philippe Valembois
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.
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git (for-6.3/evision), thanks!
[1/1] HID: evision: Add preliminary support for EVision keyboards
https://git.kernel.org/hid/hid/c/f5cd71cfdb5c
Cheers,
Signature · 1 line
Benjamin Tissoires <[email protected]>
Hello,
Thanks for the review.
I just sent an updated patch taking your comments into account.
Regards,
Philippe Valembois
Quoted 172 lines · Benjamin Tissoires
Quoted 2 lines · Philippe Valembois
From: Philippe Valembois <[email protected]>
Jiri, I have a doubt. Do we accept emails from users.noreply.github.com?
Quoted 19 lines
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]>--- drivers/hid/Kconfig | 7 ++++ drivers/hid/Makefile | 1 + drivers/hid/hid-evision.c | 79 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 drivers/hid/hid-evision.cdrivers/hid/Kconfig +0
-0drivers/hid/Kconfig config HID_ELO · line 334
Quoted 6 lines
drivers/hid/Kconfig +3
-0@@ -329,6 +329,13 @@ config HID_ELO Support for the ELO USB 4000/4500 touchscreens. Note that this is for different devices than those handled by CONFIG_TOUCHSCREEN_USB_ELO. +config HID_EVISION + tristate "EVision Keyboards Support" + depends on USB_HIDAFAICT, the driver only uses pure HID API, so you should be able to depend on HID, not just
USB_HID.Quoted 29 lines
drivers/hid/Kconfig +4
-0+ help + Support for some EVision keyboards. Note that this is needed only when + applying customization using userspace programs. + config HID_EZKEY tristate "Ezkey BTC 8193 keyboard" default !EXPERTdrivers/hid/Makefile +1
-0@@ -45,6 +45,7 @@ obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o obj-$(CONFIG_HID_ELAN) += hid-elan.o obj-$(CONFIG_HID_ELECOM) += hid-elecom.o obj-$(CONFIG_HID_ELO) += hid-elo.o +obj-$(CONFIG_HID_EVISION) += hid-evision.o obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o obj-$(CONFIG_HID_FT260) += hid-ft260.o obj-$(CONFIG_HID_GEMBIRD) += hid-gembird.odrivers/hid/hid-evision.c new file +4
-0@@ -0,0 +1,79 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* HID driver for EVision devices +* For now, only ignore bogus consumer reports drivers/hid/hid-evision.c line 14
Quoted 10 lines
drivers/hid/hid-evision.c new file +10
-0+* sent after the keyboard has been configured +* +* Copyright (c) 2022 Philippe Valembois +*/ + +#include <linux/device.h> +#include <linux/input.h> +#include <linux/hid.h> +#include <linux/module.h> +#include <linux/usb.h> Outside of
hid_is_usb(), you are not using anything USB related, so this can be droppeddrivers/hid/hid-evision.c line 18
Quoted 4 lines
drivers/hid/hid-evision.c new file +4
-0+ + +#define USB_VENDOR_ID_EVISION 0x320f +#define USB_DEVICE_ID_EVISION_ICL01 0x5041We tend to add those variables in
drivers/hid/hid-ids.hdrivers/hid/hid-evision.c line 27
Quoted 9 lines
drivers/hid/hid-evision.c new file +9
-0+ +static int evision_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_CONSUMER ) +return 0 ; + +// Ignore key down event No C++ comments style please, use /* */ instead
drivers/hid/hid-evision.c line 30
Quoted 3 lines
drivers/hid/hid-evision.c new file +3
-0+if ((usage->hid &HID_USAGE ) >>8 ==0x05 ) +return -1 ; +// Ignore key up event Same (and for any other // below).
Quoted 8 lines
drivers/hid/hid-evision.c new file +8
-0+if ((usage->hid &HID_USAGE ) >>8 ==0x06 ) +return -1 ; + +switch (usage->hid &HID_USAGE ) { +// Ignore configuration saved event +case 0x0401 :return -1 ; +// Ignore reset event +case 0x0402 :return -1 ;drivers/hid/hid-evision.c line 48
Quoted 10 lines
drivers/hid/hid-evision.c new file +10
-0+ } +return 0 ; +} + +static int evision_probe (struct hid_device *hdev,const struct hid_device_id *id) +{ +int ret; + +if (!hid_is_usb (hdev)) +return -EINVAL ;This can be dropped...
Quoted 4 lines
drivers/hid/hid-evision.c new file +4
-0+ + ret =hid_parse (hdev); +if (ret) { +hid_err (hdev,"EVision hid parse failed: %d\n" , ret);drivers/hid/hid-evision.c line 62
Quoted 10 lines
drivers/hid/hid-evision.c new file +10
-0+return ret; + } + + ret =hid_hw_start (hdev,HID_CONNECT_DEFAULT ); +if (ret) { +hid_err (hdev,"EVision hw start failed: %d\n" , ret); +return ret; + } + +return 0 ;... which means the probe is the default one, meaning it can also be dropped from the patch :)
drivers/hid/hid-evision.c line 75
Quoted 13 lines
drivers/hid/hid-evision.c new file +13
-0+} + +static const struct hid_device_id evision_devices[] = { + {HID_USB_DEVICE (USB_VENDOR_ID_EVISION ,USB_DEVICE_ID_EVISION_ICL01 ) }, + { } +}; +MODULE_DEVICE_TABLE (hid, evision_devices); + +static struct hid_driver evision_driver = { + .name ="evision" , + .id_table = evision_devices, + .input_mapping = evision_input_mapping, + .probe = evision_probe,Just for completeness, remove that .probe line and your driver will behave the same and be smaller :)
Quoted 7 lines
drivers/hid/hid-evision.c new file +4
-1+}; +module_hid_driver (evision_driver); + +MODULE_LICENSE ("GPL" ); --2.38.2
Cheers,
Benjamin
Jiri Kosina
maintainerQuoted 3 lines · Benjamin Tissoires
Quoted 1 line
From: Philippe Valembois <[email protected]>
Jiri, I have a doubt. Do we accept emails from users.noreply.github.com?
From quick search in github documentation, this seems to be a blackhole email address, right?
If so, I'd much prefer to have a real e-mail address there, in order to make sure the author / signoff holders can be reached in the future if there are any concerns regarding the patch.
The e-mail address disclosure concern is moot as soon as the emaill with the patch hits LKML anyway.
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs
Hello,
It is a blackhole address indeed.
I just sent a v3 with my corrected email address.
Thanks,
Regards,
Philippe Valembois
Quoted 23 lines · Jiri Kosina
Quoted 3 lines · Benjamin Tissoires
Quoted 1 line
From: Philippe Valembois <[email protected]>
Jiri, I have a doubt. Do we accept emails from users.noreply.github.com?
From quick search in github documentation, this seems to be a blackhole email address, right?
If so, I'd much prefer to have a real e-mail address there, in order to make sure the author / signoff holders can be reached in the future if there are any concerns regarding the patch.
The e-mail address disclosure concern is moot as soon as the emaill with the patch hits LKML anyway.
Thanks,
--
Jiri Kosina
SUSE Labs