Skip to content

Commit

Permalink
HID: asus: Only set EV_REP if we are adding a mapping
Browse files Browse the repository at this point in the history
Make asus_input_mapping() only set EV_REP if we are adding a mapping.

The T100CHI bluetooth keyboard dock has a few input reports for which
we do not create any mappings (these input-reports are present in the
descriptors but never send).

The hid-asus code relies on the HID core not creating input devices for
input-reports without any mappings. But the present of the EV_REP but
counts as a mapping causing 6 /dev/input/event# nodes to be created for
the T100CHI bluetooth keyboard dock. This change brings the amount of
created /dev/input/event# nodes / input-devices down to 4.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Hans de Goede authored and Jiri Kosina committed May 6, 2020
1 parent 47cf1b4 commit 4e4c60f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/hid/hid-asus.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,6 @@ static int asus_input_mapping(struct hid_device *hdev,

/* ASUS-specific keyboard hotkeys */
if ((usage->hid & HID_USAGE_PAGE) == 0xff310000) {
set_bit(EV_REP, hi->input->evbit);
switch (usage->hid & HID_USAGE) {
case 0x10: asus_map_key_clear(KEY_BRIGHTNESSDOWN); break;
case 0x20: asus_map_key_clear(KEY_BRIGHTNESSUP); break;
Expand Down Expand Up @@ -737,11 +736,11 @@ static int asus_input_mapping(struct hid_device *hdev,
if (drvdata->quirks & QUIRK_USE_KBD_BACKLIGHT)
drvdata->enable_backlight = true;

set_bit(EV_REP, hi->input->evbit);
return 1;
}

if ((usage->hid & HID_USAGE_PAGE) == HID_UP_MSVENDOR) {
set_bit(EV_REP, hi->input->evbit);
switch (usage->hid & HID_USAGE) {
case 0xff01: asus_map_key_clear(BTN_1); break;
case 0xff02: asus_map_key_clear(BTN_2); break;
Expand All @@ -764,6 +763,7 @@ static int asus_input_mapping(struct hid_device *hdev,
return 0;
}

set_bit(EV_REP, hi->input->evbit);
return 1;
}

Expand Down

0 comments on commit 4e4c60f

Please sign in to comment.