Skip to contentSkip to conversation

HID: corsair: fix mapping of non-keyboard usages

PATCH Applied =?UTF-8?q?Cl=C3=A9ment=20Vuchener?= 3 participants 3 messages Feb 16, 2016 – Feb 23, 2016 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: corsair: fix mapping of non-keyboard usages

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.

---
 drivers/hid/hid-corsair.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/hid/hid-corsair.c +3 -0
index 5855196..717704e 100644
@@ -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,
Signature · 6 lines
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · 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.

Looks good to me.

Cheers,
Benjamin

Quoted 21 lines
---
 drivers/hid/hid-corsair.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/hid/hid-corsair.c +3 -0
index 5855196..717704e 100644
@@ -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,
Signature · 1 line
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer Applied
#2 lore raw
In reply to =?UTF-8?q?Cl=C3=A9ment=20Vuchener?=
Quoted 3 lines · On Tue, 16 Feb 2016, =?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.

Applied, thanks.

Signature · 2 lines
Jiri Kosina
SUSE Labs