Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions drivers/hid/hid-asus.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
#define QUIRK_ROG_ALLY_XPAD BIT(13)
#define QUIRK_HID_FN_LOCK BIT(14)
#define QUIRK_ROG_NKEY_ID1ID2_INIT BIT(15)
#define QUIRK_FILTER_CAMERA_COMPANION BIT(16)

#define I2C_KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \
QUIRK_NO_INIT_REPORTS | \
Expand Down Expand Up @@ -460,6 +461,17 @@ static int asus_raw_event(struct hid_device *hdev,
}
}

/*
* The camera-toggle key reports its vendor usage (0x85) together with a
* companion state byte in the same array report, e.g. "5a 85 01" and
* "5a 85 10" for the two toggle positions. The 0x10 companion aliases the
* brightness-down vendor usage and would spuriously dim the panel, so drop
* the companion slots and leave only the camera usage for input mapping.
*/
if (drvdata->quirks & QUIRK_FILTER_CAMERA_COMPANION &&
report->id == FEATURE_KBD_REPORT_ID && size >= 3 && data[1] == 0x85)
memset(&data[2], 0, size - 2);

return 0;
}

Expand Down Expand Up @@ -1046,6 +1058,12 @@ static int asus_input_mapping(struct hid_device *hdev,
case 0x6c: asus_map_key_clear(KEY_SLEEP); break;
case 0x7c: asus_map_key_clear(KEY_MICMUTE); break;
case 0x82: asus_map_key_clear(KEY_CAMERA); break;
case 0x85:
asus_map_key_clear(KEY_CAMERA);
break;
case 0x86:
asus_map_key_clear(KEY_PROG1); /* MyASUS key */
break;
case 0x88: asus_map_key_clear(KEY_RFKILL); break;
case 0xb5: asus_map_key_clear(KEY_CALC); break;
case 0xc4: asus_map_key_clear(KEY_KBDILLUMUP); break;
Expand All @@ -1055,6 +1073,9 @@ static int asus_input_mapping(struct hid_device *hdev,
case 0x7e: asus_map_key_clear(KEY_EMOJI_PICKER); break;

case 0x8b: asus_map_key_clear(KEY_PROG1); break; /* ProArt Creator Hub key */
case 0x5f:
asus_map_key_clear(KEY_PROG2); /* S-shaped programmable key */
break;
case 0x6b: asus_map_key_clear(KEY_F21); break; /* ASUS touchpad toggle */
case 0x38: asus_map_key_clear(KEY_PROG1); break; /* ROG key */
case 0xba: asus_map_key_clear(KEY_PROG2); break; /* Fn+C ASUS Splendid */
Expand Down Expand Up @@ -1467,6 +1488,9 @@ static const __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc,
static const struct hid_device_id asus_devices[] = {
{ HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK,
USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD), I2C_KEYBOARD_QUIRKS},
{ HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK,
USB_DEVICE_ID_ASUSTEK_I2C_ZENBOOK_KEYBOARD),
I2C_KEYBOARD_QUIRKS | QUIRK_FILTER_CAMERA_COMPANION },
{ HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK,
USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD), I2C_TOUCHPAD_QUIRKS },
{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
Expand Down
1 change: 1 addition & 0 deletions drivers/hid/hid-ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@
#define USB_DEVICE_ID_ASUSTEK_T101HA_KEYBOARD 0x183d
#define USB_DEVICE_ID_ASUSTEK_T304_KEYBOARD 0x184a
#define USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD 0x8585
#define USB_DEVICE_ID_ASUSTEK_I2C_ZENBOOK_KEYBOARD 0x4b42
#define USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD 0x0101
#define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1 0x1854
#define USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2 0x1837
Expand Down
Loading