HID: move Asus keyboard support from hid-chicony to hid-asus
authorDaniel Drake <drake@endlessm.com>
Mon, 5 Jun 2017 20:58:56 +0000 (14:58 -0600)
committerJiri Kosina <jkosina@suse.cz>
Thu, 8 Jun 2017 11:47:52 +0000 (13:47 +0200)
The Asus AIO keyboard AK1D was added to hid-chicony based on its
USB vendor ID, however images available online suggest that this keyboard
is physically branded as ASUS with no mention of Chicony.

A recent commit also added support for another Asus AIO keyboard into
hid-chicony, this one with USB vendor ID Jess, and a pending review
comment asked me to move it into hid-asus because it is also only
physically branded as ASUS.

I updated the USB ID defines to match the branding and product name,
including noting that the recently added keyboard is labelled as
ASUS MD-5112.

Signed-off-by: Daniel Drake <drake@endlessm.com>
Acked-by: Benjamin Tissoires <benajmin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-asus.c
drivers/hid/hid-chicony.c
drivers/hid/hid-core.c
drivers/hid/hid-ids.h

index a6268f2f7408a520660c6add3c734a8006474393..16a88da545b1cc28040a6e59c1ac9c8ae2911a32 100644 (file)
@@ -422,6 +422,33 @@ static int asus_input_mapping(struct hid_device *hdev,
                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;
+               case 0xff03: asus_map_key_clear(BTN_3); break;
+               case 0xff04: asus_map_key_clear(BTN_4); break;
+               case 0xff05: asus_map_key_clear(BTN_5); break;
+               case 0xff06: asus_map_key_clear(BTN_6); break;
+               case 0xff07: asus_map_key_clear(BTN_7); break;
+               case 0xff08: asus_map_key_clear(BTN_8); break;
+               case 0xff09: asus_map_key_clear(BTN_9); break;
+               case 0xff0a: asus_map_key_clear(BTN_A); break;
+               case 0xff0b: asus_map_key_clear(BTN_B); break;
+               case 0x00f1: asus_map_key_clear(KEY_WLAN);      break;
+               case 0x00f2: asus_map_key_clear(KEY_BRIGHTNESSDOWN);    break;
+               case 0x00f3: asus_map_key_clear(KEY_BRIGHTNESSUP);      break;
+               case 0x00f4: asus_map_key_clear(KEY_DISPLAY_OFF);       break;
+               case 0x00f7: asus_map_key_clear(KEY_CAMERA);    break;
+               case 0x00f8: asus_map_key_clear(KEY_PROG1);     break;
+               default:
+                       return 0;
+               }
+
+               return 1;
+       }
+
        if (drvdata->quirks & QUIRK_NO_CONSUMER_USAGES &&
                (usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER) {
                switch (usage->hid & HID_USAGE) {
@@ -572,6 +599,8 @@ static const struct hid_device_id asus_devices[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
                USB_DEVICE_ID_ASUSTEK_T100_KEYBOARD),
          QUIRK_T100_KEYBOARD | QUIRK_NO_CONSUMER_USAGES },
+       { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_ASUS_AK1D) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_ASUS_MD_5112) },
        { }
 };
 MODULE_DEVICE_TABLE(hid, asus_devices);
index f04ed9aabc3f9fea0baf5b074acd83b6d07527c6..397a789a41be942a24a8673767da277869a9b670 100644 (file)
@@ -84,9 +84,7 @@ static __u8 *ch_switch12_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 static const struct hid_device_id ch_devices[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) },
        { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) },
-       { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) },
        { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_ACER_SWITCH12) },
-       { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_ZEN_AIO_KBD) },
        { }
 };
 MODULE_DEVICE_TABLE(hid, ch_devices);
index 04cee65531d761c18e53775ffc784c3c3d993daa..63bcd4f2ef89e48b233febce0245d07e09a3067b 100644 (file)
@@ -1869,7 +1869,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) },
        { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) },
        { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) },
-       { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_ASUS_AK1D) },
        { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_ACER_SWITCH12) },
        { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K90) },
        { HID_USB_DEVICE(USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_SCIMITAR_PRO_RGB) },
@@ -1916,7 +1916,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) },
        { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A0C2) },
        { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_TABLET) },
-       { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_ZEN_AIO_KBD) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_ASUS_MD_5112) },
        { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) },
        { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) },
index 8ca1e8ce0af24e325957526c125ccf55d9081eb8..9fb49c6b8dcc7aebd59df3e1d56393f4d95a6d39 100644 (file)
 #define USB_DEVICE_ID_CHICONY_WIRELESS 0x0618
 #define USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE 0x1053
 #define USB_DEVICE_ID_CHICONY_WIRELESS2        0x1123
-#define USB_DEVICE_ID_CHICONY_AK1D     0x1125
+#define USB_DEVICE_ID_ASUS_AK1D                0x1125
 #define USB_DEVICE_ID_CHICONY_ACER_SWITCH12    0x1421
 
 #define USB_VENDOR_ID_CHUNGHWAT                0x2247
 
 #define USB_VENDOR_ID_JESS             0x0c45
 #define USB_DEVICE_ID_JESS_YUREX       0x1010
-#define USB_DEVICE_ID_JESS_ZEN_AIO_KBD 0x5112
+#define USB_DEVICE_ID_ASUS_MD_5112     0x5112
 
 #define USB_VENDOR_ID_JESS2            0x0f30
 #define USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD 0x0111