Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1335666 > unrolled thread

[PATCH] HID: corsair: fix mapping of non-keyboard usages

Started by=?UTF-8?q?Cl=C3=A9ment=20Vuchener?= <clement.vuchener@gmail.com>
First post2016-02-16 18:40 +0100
Last post2016-02-18 09:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] HID: corsair: fix mapping of non-keyboard usages =?UTF-8?q?Cl=C3=A9ment=20Vuchener?=   <clement.vuchener@gmail.com> - 2016-02-16 18:40 +0100
    Re: [PATCH] HID: corsair: fix mapping of non-keyboard usages Benjamin Tissoires <benjamin.tissoires@redhat.com> - 2016-02-18 09:20 +0100

#1335666 — [PATCH] HID: corsair: fix mapping of non-keyboard usages

From=?UTF-8?q?Cl=C3=A9ment=20Vuchener?= <clement.vuchener@gmail.com>
Date2016-02-16 18:40 +0100
Subject[PATCH] HID: corsair: fix mapping of non-keyboard usages
Message-ID<r2RLs-2yT-25@gated-at.bofh.it>
This fixes a bug where the Volume Up key was ignored because it uses the same usage code as G18. Special Corsair usage codes are in the keyboard page, other pages should be left to the generic driver.

Signed-off-by: Clément Vuchener <clement.vuchener@gmail.com>
---
 drivers/hid/hid-corsair.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/hid/hid-corsair.c b/drivers/hid/hid-corsair.c
index 5855196..717704e 100644
--- a/drivers/hid/hid-corsair.c
+++ b/drivers/hid/hid-corsair.c
@@ -595,6 +595,9 @@ static int corsair_input_mapping(struct hid_device *dev,
 {
 	int gkey;
 
+	if ((usage->hid & HID_USAGE_PAGE) != HID_UP_KEYBOARD)
+		return 0;
+
 	gkey = corsair_usage_to_gkey(usage->hid & HID_USAGE);
 	if (gkey != 0) {
 		hid_map_usage_clear(input, usage, bit, max, EV_KEY,
-- 
2.5.0

[toc] | [next] | [standalone]


#1337130

FromBenjamin Tissoires <benjamin.tissoires@redhat.com>
Date2016-02-18 09:20 +0100
Message-ID<r3rYC-2K0-23@gated-at.bofh.it>
In reply to#1335666
On Feb 16 2016 or thereabouts, =?UTF-8?q?Cl=C3=A9ment=20Vuchener?= wrote:
> This fixes a bug where the Volume Up key was ignored because it uses the same usage code as G18. Special Corsair usage codes are in the keyboard page, other pages should be left to the generic driver.
> 
> Signed-off-by: Clément Vuchener <clement.vuchener@gmail.com>

Looks good to me.

Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin

> ---
>  drivers/hid/hid-corsair.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/hid/hid-corsair.c b/drivers/hid/hid-corsair.c
> index 5855196..717704e 100644
> --- a/drivers/hid/hid-corsair.c
> +++ b/drivers/hid/hid-corsair.c
> @@ -595,6 +595,9 @@ static int corsair_input_mapping(struct hid_device *dev,
>  {
>  	int gkey;
>  
> +	if ((usage->hid & HID_USAGE_PAGE) != HID_UP_KEYBOARD)
> +		return 0;
> +
>  	gkey = corsair_usage_to_gkey(usage->hid & HID_USAGE);
>  	if (gkey != 0) {
>  		hid_map_usage_clear(input, usage, bit, max, EV_KEY,
> -- 
> 2.5.0
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web