diff options
author | Matjaz Hegedic <matjaz.hegedic@gmail.com> | 2017-03-09 00:31:13 +0100 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2017-03-30 11:16:53 +0200 |
commit | a93913e1496d6103ec0b76d8397fc04ece55f570 (patch) | |
tree | 9c0821dafedc25b35290afc2b1a74b516e825506 /drivers/hid/hid-asus.c | |
parent | HID: asus: support Republic of Gamers special keys (diff) | |
download | linux-a93913e1496d6103ec0b76d8397fc04ece55f570.tar.xz linux-a93913e1496d6103ec0b76d8397fc04ece55f570.zip |
HID: asus: fix and generalize ambiguous preprocessor macros
Before commits a1cbda7a65a7a ("HID: asus: drop dependency
on I2C_HID") and 64a403c6555fd ("HID: asus: support Republic
Of Gamers special keys") hid-asus only pertained to a single
I2C keyboard model found in ASUS X205TA, F205TA, & X200HA. The
aforementioned commits expanded this support to other ASUS
laptop keyboard models.
In order to clarify that existing keyboard and touchpad quirks
only apply to the I2C devices, and not ASUS keyboards in
general, I2C HID IDs and their corresponding quirk sets have
been renamed. In addition, the latter commit introduced
special key handling, which also applies to the I2C keyboard,
not just Republic of Gamers series. Therefore, the
rog_map_key_clear() macro is renamed to asus_map_key_clear()
for the sake of generality.
Signed-off-by: Matjaz Hegedic <matjaz.hegedic@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-asus.c')
-rw-r--r-- | drivers/hid/hid-asus.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 5bae6ffcae94..20fe97fb9bbc 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -64,9 +64,9 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); #define QUIRK_SKIP_INPUT_MAPPING BIT(2) #define QUIRK_IS_MULTITOUCH BIT(3) -#define KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \ +#define I2C_KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \ QUIRK_NO_INIT_REPORTS) -#define TOUCHPAD_QUIRKS (QUIRK_NO_INIT_REPORTS | \ +#define I2C_TOUCHPAD_QUIRKS (QUIRK_NO_INIT_REPORTS | \ QUIRK_SKIP_INPUT_MAPPING | \ QUIRK_IS_MULTITOUCH) @@ -199,7 +199,7 @@ static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi) return 0; } -#define rog_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, \ +#define asus_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, \ max, EV_KEY, (c)) static int asus_input_mapping(struct hid_device *hdev, struct hid_input *hi, struct hid_field *field, @@ -215,31 +215,31 @@ static int asus_input_mapping(struct hid_device *hdev, return -1; } - /* ASUS Republic of Gamers laptop keyboard hotkeys */ + /* 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: rog_map_key_clear(KEY_BRIGHTNESSDOWN); break; - case 0x20: rog_map_key_clear(KEY_BRIGHTNESSUP); break; - case 0x35: rog_map_key_clear(KEY_DISPLAY_OFF); break; - case 0x6c: rog_map_key_clear(KEY_SLEEP); break; - case 0x82: rog_map_key_clear(KEY_CAMERA); break; - case 0x88: rog_map_key_clear(KEY_WLAN); break; - case 0xb5: rog_map_key_clear(KEY_CALC); break; - case 0xc4: rog_map_key_clear(KEY_KBDILLUMUP); break; - case 0xc5: rog_map_key_clear(KEY_KBDILLUMDOWN); break; + case 0x10: asus_map_key_clear(KEY_BRIGHTNESSDOWN); break; + case 0x20: asus_map_key_clear(KEY_BRIGHTNESSUP); break; + case 0x35: asus_map_key_clear(KEY_DISPLAY_OFF); break; + case 0x6c: asus_map_key_clear(KEY_SLEEP); break; + case 0x82: asus_map_key_clear(KEY_CAMERA); break; + case 0x88: asus_map_key_clear(KEY_WLAN); break; + case 0xb5: asus_map_key_clear(KEY_CALC); break; + case 0xc4: asus_map_key_clear(KEY_KBDILLUMUP); break; + case 0xc5: asus_map_key_clear(KEY_KBDILLUMDOWN); break; /* ASUS touchpad toggle */ - case 0x6b: rog_map_key_clear(KEY_F21); break; + case 0x6b: asus_map_key_clear(KEY_F21); break; /* ROG key */ - case 0x38: rog_map_key_clear(KEY_PROG1); break; + case 0x38: asus_map_key_clear(KEY_PROG1); break; /* Fn+C ASUS Splendid */ - case 0xba: rog_map_key_clear(KEY_PROG2); break; + case 0xba: asus_map_key_clear(KEY_PROG2); break; /* Fn+Space Power4Gear Hybrid */ - case 0x5c: rog_map_key_clear(KEY_PROG3); break; + case 0x5c: asus_map_key_clear(KEY_PROG3); break; default: return 0; @@ -354,9 +354,9 @@ static __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_NOTEBOOK_KEYBOARD), KEYBOARD_QUIRKS}, + USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD), I2C_KEYBOARD_QUIRKS}, { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, - USB_DEVICE_ID_ASUSTEK_TOUCHPAD), TOUCHPAD_QUIRKS }, + USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD), I2C_TOUCHPAD_QUIRKS }, { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1) }, { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, |