1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * HID driver for Asus notebook built-in keyboard.
4 * Fixes small logical maximum to match usage maximum.
6 * Currently supported devices are:
10 * Copyright (c) 2016 Yusuke Fujimaki <usk.fujimaki@gmail.com>
12 * This module based on hid-ortek by
13 * Copyright (c) 2010 Johnathon Harris <jmharris@gmail.com>
14 * Copyright (c) 2011 Jiri Kosina
16 * This module has been updated to add support for Asus i2c touchpad.
18 * Copyright (c) 2016 Brendan McGrath <redmcg@redmandi.dyndns.org>
19 * Copyright (c) 2016 Victor Vlasenko <victor.vlasenko@sysgears.com>
20 * Copyright (c) 2016 Frederik Wenigwieser <frederik.wenigwieser@gmail.com>
26 #include <linux/dmi.h>
27 #include <linux/hid.h>
28 #include <linux/module.h>
29 #include <linux/platform_data/x86/asus-wmi.h>
30 #include <linux/input/mt.h>
31 #include <linux/usb.h> /* For to_usb_interface for T100 touchpad intf check */
32 #include <linux/power_supply.h>
33 #include <linux/leds.h>
37 MODULE_AUTHOR("Yusuke Fujimaki <usk.fujimaki@gmail.com>");
38 MODULE_AUTHOR("Brendan McGrath <redmcg@redmandi.dyndns.org>");
39 MODULE_AUTHOR("Victor Vlasenko <victor.vlasenko@sysgears.com>");
40 MODULE_AUTHOR("Frederik Wenigwieser <frederik.wenigwieser@gmail.com>");
41 MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
43 #define T100_TPAD_INTF 2
44 #define MEDION_E1239T_TPAD_INTF 1
46 #define E1239T_TP_TOGGLE_REPORT_ID 0x05
47 #define T100CHI_MOUSE_REPORT_ID 0x06
48 #define FEATURE_REPORT_ID 0x0d
49 #define INPUT_REPORT_ID 0x5d
50 #define FEATURE_KBD_REPORT_ID 0x5a
51 #define FEATURE_KBD_REPORT_SIZE 16
52 #define FEATURE_KBD_LED_REPORT_ID1 0x5d
53 #define FEATURE_KBD_LED_REPORT_ID2 0x5e
55 #define SUPPORT_KBD_BACKLIGHT BIT(0)
57 #define MAX_TOUCH_MAJOR 8
58 #define MAX_PRESSURE 128
60 #define BTN_LEFT_MASK 0x01
61 #define CONTACT_TOOL_TYPE_MASK 0x80
62 #define CONTACT_X_MSB_MASK 0xf0
63 #define CONTACT_Y_MSB_MASK 0x0f
64 #define CONTACT_TOUCH_MAJOR_MASK 0x07
65 #define CONTACT_PRESSURE_MASK 0x7f
67 #define BATTERY_REPORT_ID (0x03)
68 #define BATTERY_REPORT_SIZE (1 + 8)
69 #define BATTERY_LEVEL_MAX ((u8)255)
70 #define BATTERY_STAT_DISCONNECT (0)
71 #define BATTERY_STAT_CHARGING (1)
72 #define BATTERY_STAT_FULL (2)
74 #define QUIRK_FIX_NOTEBOOK_REPORT BIT(0)
75 #define QUIRK_NO_INIT_REPORTS BIT(1)
76 #define QUIRK_SKIP_INPUT_MAPPING BIT(2)
77 #define QUIRK_IS_MULTITOUCH BIT(3)
78 #define QUIRK_NO_CONSUMER_USAGES BIT(4)
79 #define QUIRK_USE_KBD_BACKLIGHT BIT(5)
80 #define QUIRK_T100_KEYBOARD BIT(6)
81 #define QUIRK_T100CHI BIT(7)
82 #define QUIRK_G752_KEYBOARD BIT(8)
83 #define QUIRK_T90CHI BIT(9)
84 #define QUIRK_MEDION_E1239T BIT(10)
85 #define QUIRK_ROG_NKEY_KEYBOARD BIT(11)
86 #define QUIRK_ROG_CLAYMORE_II_KEYBOARD BIT(12)
88 #define I2C_KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \
89 QUIRK_NO_INIT_REPORTS | \
90 QUIRK_NO_CONSUMER_USAGES)
91 #define I2C_TOUCHPAD_QUIRKS (QUIRK_NO_INIT_REPORTS | \
92 QUIRK_SKIP_INPUT_MAPPING | \
95 #define TRKID_SGN ((TRKID_MAX + 1) >> 1)
97 struct asus_kbd_leds
{
98 struct led_classdev cdev
;
99 struct hid_device
*hdev
;
100 struct work_struct work
;
101 unsigned int brightness
;
106 struct asus_touchpad_info
{
116 struct asus_drvdata
{
117 unsigned long quirks
;
118 struct hid_device
*hdev
;
119 struct input_dev
*input
;
120 struct input_dev
*tp_kbd_input
;
121 struct asus_kbd_leds
*kbd_backlight
;
122 const struct asus_touchpad_info
*tp
;
123 bool enable_backlight
;
124 struct power_supply
*battery
;
125 struct power_supply_desc battery_desc
;
126 int battery_capacity
;
128 bool battery_in_query
;
129 unsigned long battery_next_query
;
132 static int asus_report_battery(struct asus_drvdata
*, u8
*, int);
134 static const struct asus_touchpad_info asus_i2c_tp
= {
139 .report_size
= 28 /* 2 byte header + 5 * 5 + 1 byte footer */,
142 static const struct asus_touchpad_info asus_t100ta_tp
= {
145 .res_x
= 30, /* units/mm */
146 .res_y
= 27, /* units/mm */
149 .report_size
= 28 /* 2 byte header + 5 * 5 + 1 byte footer */,
152 static const struct asus_touchpad_info asus_t100ha_tp
= {
155 .res_x
= 30, /* units/mm */
156 .res_y
= 29, /* units/mm */
159 .report_size
= 28 /* 2 byte header + 5 * 5 + 1 byte footer */,
162 static const struct asus_touchpad_info asus_t200ta_tp
= {
165 .res_x
= 30, /* units/mm */
166 .res_y
= 28, /* units/mm */
169 .report_size
= 28 /* 2 byte header + 5 * 5 + 1 byte footer */,
172 static const struct asus_touchpad_info asus_t100chi_tp
= {
175 .res_x
= 31, /* units/mm */
176 .res_y
= 29, /* units/mm */
179 .report_size
= 15 /* 2 byte header + 3 * 4 + 1 byte footer */,
182 static const struct asus_touchpad_info medion_e1239t_tp
= {
185 .res_x
= 29, /* units/mm */
186 .res_y
= 28, /* units/mm */
189 .report_size
= 32 /* 2 byte header + 5 * 5 + 5 byte footer */,
192 static void asus_report_contact_down(struct asus_drvdata
*drvdat
,
193 int toolType
, u8
*data
)
195 struct input_dev
*input
= drvdat
->input
;
196 int touch_major
, pressure
, x
, y
;
198 x
= (data
[0] & CONTACT_X_MSB_MASK
) << 4 | data
[1];
199 y
= drvdat
->tp
->max_y
- ((data
[0] & CONTACT_Y_MSB_MASK
) << 8 | data
[2]);
201 input_report_abs(input
, ABS_MT_POSITION_X
, x
);
202 input_report_abs(input
, ABS_MT_POSITION_Y
, y
);
204 if (drvdat
->tp
->contact_size
< 5)
207 if (toolType
== MT_TOOL_PALM
) {
208 touch_major
= MAX_TOUCH_MAJOR
;
209 pressure
= MAX_PRESSURE
;
211 touch_major
= (data
[3] >> 4) & CONTACT_TOUCH_MAJOR_MASK
;
212 pressure
= data
[4] & CONTACT_PRESSURE_MASK
;
215 input_report_abs(input
, ABS_MT_TOUCH_MAJOR
, touch_major
);
216 input_report_abs(input
, ABS_MT_PRESSURE
, pressure
);
219 /* Required for Synaptics Palm Detection */
220 static void asus_report_tool_width(struct asus_drvdata
*drvdat
)
222 struct input_mt
*mt
= drvdat
->input
->mt
;
223 struct input_mt_slot
*oldest
;
226 if (drvdat
->tp
->contact_size
< 5)
232 for (i
= 0; i
< mt
->num_slots
; ++i
) {
233 struct input_mt_slot
*ps
= &mt
->slots
[i
];
234 int id
= input_mt_get_value(ps
, ABS_MT_TRACKING_ID
);
238 if ((id
- oldid
) & TRKID_SGN
) {
245 input_report_abs(drvdat
->input
, ABS_TOOL_WIDTH
,
246 input_mt_get_value(oldest
, ABS_MT_TOUCH_MAJOR
));
250 static int asus_report_input(struct asus_drvdata
*drvdat
, u8
*data
, int size
)
252 int i
, toolType
= MT_TOOL_FINGER
;
253 u8
*contactData
= data
+ 2;
255 if (size
!= drvdat
->tp
->report_size
)
258 for (i
= 0; i
< drvdat
->tp
->max_contacts
; i
++) {
259 bool down
= !!(data
[1] & BIT(i
+3));
261 if (drvdat
->tp
->contact_size
>= 5)
262 toolType
= contactData
[3] & CONTACT_TOOL_TYPE_MASK
?
263 MT_TOOL_PALM
: MT_TOOL_FINGER
;
265 input_mt_slot(drvdat
->input
, i
);
266 input_mt_report_slot_state(drvdat
->input
, toolType
, down
);
269 asus_report_contact_down(drvdat
, toolType
, contactData
);
270 contactData
+= drvdat
->tp
->contact_size
;
274 input_report_key(drvdat
->input
, BTN_LEFT
, data
[1] & BTN_LEFT_MASK
);
275 asus_report_tool_width(drvdat
);
277 input_mt_sync_frame(drvdat
->input
);
278 input_sync(drvdat
->input
);
283 static int asus_e1239t_event(struct asus_drvdata
*drvdat
, u8
*data
, int size
)
288 /* Handle broken mute key which only sends press events */
290 data
[0] == 0x02 && data
[1] == 0xe2 && data
[2] == 0x00) {
291 input_report_key(drvdat
->input
, KEY_MUTE
, 1);
292 input_sync(drvdat
->input
);
293 input_report_key(drvdat
->input
, KEY_MUTE
, 0);
294 input_sync(drvdat
->input
);
298 /* Handle custom touchpad toggle key which only sends press events */
299 if (drvdat
->tp_kbd_input
&&
300 data
[0] == 0x05 && data
[1] == 0x02 && data
[2] == 0x28) {
301 input_report_key(drvdat
->tp_kbd_input
, KEY_F21
, 1);
302 input_sync(drvdat
->tp_kbd_input
);
303 input_report_key(drvdat
->tp_kbd_input
, KEY_F21
, 0);
304 input_sync(drvdat
->tp_kbd_input
);
311 static int asus_event(struct hid_device
*hdev
, struct hid_field
*field
,
312 struct hid_usage
*usage
, __s32 value
)
314 if ((usage
->hid
& HID_USAGE_PAGE
) == 0xff310000 &&
315 (usage
->hid
& HID_USAGE
) != 0x00 &&
316 (usage
->hid
& HID_USAGE
) != 0xff && !usage
->type
) {
317 hid_warn(hdev
, "Unmapped Asus vendor usagepage code 0x%02x\n",
318 usage
->hid
& HID_USAGE
);
324 static int asus_raw_event(struct hid_device
*hdev
,
325 struct hid_report
*report
, u8
*data
, int size
)
327 struct asus_drvdata
*drvdata
= hid_get_drvdata(hdev
);
329 if (drvdata
->battery
&& data
[0] == BATTERY_REPORT_ID
)
330 return asus_report_battery(drvdata
, data
, size
);
332 if (drvdata
->tp
&& data
[0] == INPUT_REPORT_ID
)
333 return asus_report_input(drvdata
, data
, size
);
335 if (drvdata
->quirks
& QUIRK_MEDION_E1239T
)
336 return asus_e1239t_event(drvdata
, data
, size
);
339 * Skip these report ID, the device emits a continuous stream associated
340 * with the AURA mode it is in which looks like an 'echo'.
342 if (report
->id
== FEATURE_KBD_LED_REPORT_ID1
|| report
->id
== FEATURE_KBD_LED_REPORT_ID2
)
344 if (drvdata
->quirks
& QUIRK_ROG_NKEY_KEYBOARD
) {
346 * G713 and G733 send these codes on some keypresses, depending on
347 * the key pressed it can trigger a shutdown event if not caught.
349 if (data
[0] == 0x02 && data
[1] == 0x30) {
354 if (drvdata
->quirks
& QUIRK_ROG_CLAYMORE_II_KEYBOARD
) {
356 * CLAYMORE II keyboard sends this packet when it goes to sleep
357 * this causes the whole system to go into suspend.
360 if(size
== 2 && data
[0] == 0x02 && data
[1] == 0x00) {
368 static int asus_kbd_set_report(struct hid_device
*hdev
, const u8
*buf
, size_t buf_size
)
370 unsigned char *dmabuf
;
373 dmabuf
= kmemdup(buf
, buf_size
, GFP_KERNEL
);
378 * The report ID should be set from the incoming buffer due to LED and key
379 * interfaces having different pages
381 ret
= hid_hw_raw_request(hdev
, buf
[0], dmabuf
,
382 buf_size
, HID_FEATURE_REPORT
,
389 static int asus_kbd_init(struct hid_device
*hdev
, u8 report_id
)
391 const u8 buf
[] = { report_id
, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54,
392 0x65, 0x63, 0x68, 0x2e, 0x49, 0x6e, 0x63, 0x2e, 0x00 };
395 ret
= asus_kbd_set_report(hdev
, buf
, sizeof(buf
));
397 hid_err(hdev
, "Asus failed to send init command: %d\n", ret
);
402 static int asus_kbd_get_functions(struct hid_device
*hdev
,
403 unsigned char *kbd_func
,
406 const u8 buf
[] = { report_id
, 0x05, 0x20, 0x31, 0x00, 0x08 };
410 ret
= asus_kbd_set_report(hdev
, buf
, sizeof(buf
));
412 hid_err(hdev
, "Asus failed to send configuration command: %d\n", ret
);
416 readbuf
= kzalloc(FEATURE_KBD_REPORT_SIZE
, GFP_KERNEL
);
420 ret
= hid_hw_raw_request(hdev
, FEATURE_KBD_REPORT_ID
, readbuf
,
421 FEATURE_KBD_REPORT_SIZE
, HID_FEATURE_REPORT
,
424 hid_err(hdev
, "Asus failed to request functions: %d\n", ret
);
429 *kbd_func
= readbuf
[6];
435 static void asus_schedule_work(struct asus_kbd_leds
*led
)
439 spin_lock_irqsave(&led
->lock
, flags
);
441 schedule_work(&led
->work
);
442 spin_unlock_irqrestore(&led
->lock
, flags
);
445 static void asus_kbd_backlight_set(struct led_classdev
*led_cdev
,
446 enum led_brightness brightness
)
448 struct asus_kbd_leds
*led
= container_of(led_cdev
, struct asus_kbd_leds
,
452 spin_lock_irqsave(&led
->lock
, flags
);
453 led
->brightness
= brightness
;
454 spin_unlock_irqrestore(&led
->lock
, flags
);
456 asus_schedule_work(led
);
459 static enum led_brightness
asus_kbd_backlight_get(struct led_classdev
*led_cdev
)
461 struct asus_kbd_leds
*led
= container_of(led_cdev
, struct asus_kbd_leds
,
463 enum led_brightness brightness
;
466 spin_lock_irqsave(&led
->lock
, flags
);
467 brightness
= led
->brightness
;
468 spin_unlock_irqrestore(&led
->lock
, flags
);
473 static void asus_kbd_backlight_work(struct work_struct
*work
)
475 struct asus_kbd_leds
*led
= container_of(work
, struct asus_kbd_leds
, work
);
476 u8 buf
[] = { FEATURE_KBD_REPORT_ID
, 0xba, 0xc5, 0xc4, 0x00 };
480 spin_lock_irqsave(&led
->lock
, flags
);
481 buf
[4] = led
->brightness
;
482 spin_unlock_irqrestore(&led
->lock
, flags
);
484 ret
= asus_kbd_set_report(led
->hdev
, buf
, sizeof(buf
));
486 hid_err(led
->hdev
, "Asus failed to set keyboard backlight: %d\n", ret
);
489 /* WMI-based keyboard backlight LED control (via asus-wmi driver) takes
490 * precedence. We only activate HID-based backlight control when the
491 * WMI control is not available.
493 static bool asus_kbd_wmi_led_control_present(struct hid_device
*hdev
)
495 struct asus_drvdata
*drvdata
= hid_get_drvdata(hdev
);
499 if (!IS_ENABLED(CONFIG_ASUS_WMI
))
502 if (drvdata
->quirks
& QUIRK_ROG_NKEY_KEYBOARD
&&
503 dmi_check_system(asus_use_hid_led_dmi_ids
)) {
504 hid_info(hdev
, "using HID for asus::kbd_backlight\n");
508 ret
= asus_wmi_evaluate_method(ASUS_WMI_METHODID_DSTS
,
509 ASUS_WMI_DEVID_KBD_BACKLIGHT
, 0, &value
);
510 hid_dbg(hdev
, "WMI backlight check: rc %d value %x", ret
, value
);
514 return !!(value
& ASUS_WMI_DSTS_PRESENCE_BIT
);
517 static int asus_kbd_register_leds(struct hid_device
*hdev
)
519 struct asus_drvdata
*drvdata
= hid_get_drvdata(hdev
);
520 unsigned char kbd_func
;
523 if (drvdata
->quirks
& QUIRK_ROG_NKEY_KEYBOARD
) {
524 /* Initialize keyboard */
525 ret
= asus_kbd_init(hdev
, FEATURE_KBD_REPORT_ID
);
529 /* The LED endpoint is initialised in two HID */
530 ret
= asus_kbd_init(hdev
, FEATURE_KBD_LED_REPORT_ID1
);
534 ret
= asus_kbd_init(hdev
, FEATURE_KBD_LED_REPORT_ID2
);
538 /* Initialize keyboard */
539 ret
= asus_kbd_init(hdev
, FEATURE_KBD_REPORT_ID
);
543 /* Get keyboard functions */
544 ret
= asus_kbd_get_functions(hdev
, &kbd_func
, FEATURE_KBD_REPORT_ID
);
548 /* Check for backlight support */
549 if (!(kbd_func
& SUPPORT_KBD_BACKLIGHT
))
553 drvdata
->kbd_backlight
= devm_kzalloc(&hdev
->dev
,
554 sizeof(struct asus_kbd_leds
),
556 if (!drvdata
->kbd_backlight
)
559 drvdata
->kbd_backlight
->removed
= false;
560 drvdata
->kbd_backlight
->brightness
= 0;
561 drvdata
->kbd_backlight
->hdev
= hdev
;
562 drvdata
->kbd_backlight
->cdev
.name
= "asus::kbd_backlight";
563 drvdata
->kbd_backlight
->cdev
.max_brightness
= 3;
564 drvdata
->kbd_backlight
->cdev
.brightness_set
= asus_kbd_backlight_set
;
565 drvdata
->kbd_backlight
->cdev
.brightness_get
= asus_kbd_backlight_get
;
566 INIT_WORK(&drvdata
->kbd_backlight
->work
, asus_kbd_backlight_work
);
567 spin_lock_init(&drvdata
->kbd_backlight
->lock
);
569 ret
= devm_led_classdev_register(&hdev
->dev
, &drvdata
->kbd_backlight
->cdev
);
571 /* No need to have this still around */
572 devm_kfree(&hdev
->dev
, drvdata
->kbd_backlight
);
579 * [0] REPORT_ID (same value defined in report descriptor)
580 * [1] rest battery level. range [0..255]
581 * [2]..[7] Bluetooth hardware address (MAC address)
582 * [8] charging status
583 * = 0 : AC offline / discharging
584 * = 1 : AC online / charging
585 * = 2 : AC online / fully charged
587 static int asus_parse_battery(struct asus_drvdata
*drvdata
, u8
*data
, int size
)
596 drvdata
->battery_capacity
= ((int)lvl
* 100) / (int)BATTERY_LEVEL_MAX
;
599 case BATTERY_STAT_CHARGING
:
600 val
= POWER_SUPPLY_STATUS_CHARGING
;
602 case BATTERY_STAT_FULL
:
603 val
= POWER_SUPPLY_STATUS_FULL
;
605 case BATTERY_STAT_DISCONNECT
:
607 val
= POWER_SUPPLY_STATUS_DISCHARGING
;
610 drvdata
->battery_stat
= val
;
615 static int asus_report_battery(struct asus_drvdata
*drvdata
, u8
*data
, int size
)
617 /* notify only the autonomous event by device */
618 if ((drvdata
->battery_in_query
== false) &&
619 (size
== BATTERY_REPORT_SIZE
))
620 power_supply_changed(drvdata
->battery
);
625 static int asus_battery_query(struct asus_drvdata
*drvdata
)
630 buf
= kmalloc(BATTERY_REPORT_SIZE
, GFP_KERNEL
);
634 drvdata
->battery_in_query
= true;
635 ret
= hid_hw_raw_request(drvdata
->hdev
, BATTERY_REPORT_ID
,
636 buf
, BATTERY_REPORT_SIZE
,
637 HID_INPUT_REPORT
, HID_REQ_GET_REPORT
);
638 drvdata
->battery_in_query
= false;
639 if (ret
== BATTERY_REPORT_SIZE
)
640 ret
= asus_parse_battery(drvdata
, buf
, BATTERY_REPORT_SIZE
);
649 static enum power_supply_property asus_battery_props
[] = {
650 POWER_SUPPLY_PROP_STATUS
,
651 POWER_SUPPLY_PROP_PRESENT
,
652 POWER_SUPPLY_PROP_CAPACITY
,
653 POWER_SUPPLY_PROP_SCOPE
,
654 POWER_SUPPLY_PROP_MODEL_NAME
,
657 #define QUERY_MIN_INTERVAL (60 * HZ) /* 60[sec] */
659 static int asus_battery_get_property(struct power_supply
*psy
,
660 enum power_supply_property psp
,
661 union power_supply_propval
*val
)
663 struct asus_drvdata
*drvdata
= power_supply_get_drvdata(psy
);
667 case POWER_SUPPLY_PROP_STATUS
:
668 case POWER_SUPPLY_PROP_CAPACITY
:
669 if (time_before(drvdata
->battery_next_query
, jiffies
)) {
670 drvdata
->battery_next_query
=
671 jiffies
+ QUERY_MIN_INTERVAL
;
672 ret
= asus_battery_query(drvdata
);
676 if (psp
== POWER_SUPPLY_PROP_STATUS
)
677 val
->intval
= drvdata
->battery_stat
;
679 val
->intval
= drvdata
->battery_capacity
;
681 case POWER_SUPPLY_PROP_PRESENT
:
684 case POWER_SUPPLY_PROP_SCOPE
:
685 val
->intval
= POWER_SUPPLY_SCOPE_DEVICE
;
687 case POWER_SUPPLY_PROP_MODEL_NAME
:
688 val
->strval
= drvdata
->hdev
->name
;
698 static int asus_battery_probe(struct hid_device
*hdev
)
700 struct asus_drvdata
*drvdata
= hid_get_drvdata(hdev
);
701 struct power_supply_config pscfg
= { .drv_data
= drvdata
};
704 drvdata
->battery_capacity
= 0;
705 drvdata
->battery_stat
= POWER_SUPPLY_STATUS_UNKNOWN
;
706 drvdata
->battery_in_query
= false;
708 drvdata
->battery_desc
.properties
= asus_battery_props
;
709 drvdata
->battery_desc
.num_properties
= ARRAY_SIZE(asus_battery_props
);
710 drvdata
->battery_desc
.get_property
= asus_battery_get_property
;
711 drvdata
->battery_desc
.type
= POWER_SUPPLY_TYPE_BATTERY
;
712 drvdata
->battery_desc
.use_for_apm
= 0;
713 drvdata
->battery_desc
.name
= devm_kasprintf(&hdev
->dev
, GFP_KERNEL
,
714 "asus-keyboard-%s-battery",
716 hdev
->uniq
: dev_name(&hdev
->dev
));
717 if (!drvdata
->battery_desc
.name
)
720 drvdata
->battery_next_query
= jiffies
;
722 drvdata
->battery
= devm_power_supply_register(&hdev
->dev
,
723 &(drvdata
->battery_desc
), &pscfg
);
724 if (IS_ERR(drvdata
->battery
)) {
725 ret
= PTR_ERR(drvdata
->battery
);
726 drvdata
->battery
= NULL
;
727 hid_err(hdev
, "Unable to register battery device\n");
731 power_supply_powers(drvdata
->battery
, &hdev
->dev
);
736 static int asus_input_configured(struct hid_device
*hdev
, struct hid_input
*hi
)
738 struct input_dev
*input
= hi
->input
;
739 struct asus_drvdata
*drvdata
= hid_get_drvdata(hdev
);
741 /* T100CHI uses MULTI_INPUT, bind the touchpad to the mouse hid_input */
742 if (drvdata
->quirks
& QUIRK_T100CHI
&&
743 hi
->report
->id
!= T100CHI_MOUSE_REPORT_ID
)
746 /* Handle MULTI_INPUT on E1239T mouse/touchpad USB interface */
747 if (drvdata
->tp
&& (drvdata
->quirks
& QUIRK_MEDION_E1239T
)) {
748 switch (hi
->report
->id
) {
749 case E1239T_TP_TOGGLE_REPORT_ID
:
750 input_set_capability(input
, EV_KEY
, KEY_F21
);
751 input
->name
= "Asus Touchpad Keys";
752 drvdata
->tp_kbd_input
= input
;
754 case INPUT_REPORT_ID
:
755 break; /* Touchpad report, handled below */
757 return 0; /* Ignore other reports */
764 input_set_abs_params(input
, ABS_MT_POSITION_X
, 0,
765 drvdata
->tp
->max_x
, 0, 0);
766 input_set_abs_params(input
, ABS_MT_POSITION_Y
, 0,
767 drvdata
->tp
->max_y
, 0, 0);
768 input_abs_set_res(input
, ABS_MT_POSITION_X
, drvdata
->tp
->res_x
);
769 input_abs_set_res(input
, ABS_MT_POSITION_Y
, drvdata
->tp
->res_y
);
771 if (drvdata
->tp
->contact_size
>= 5) {
772 input_set_abs_params(input
, ABS_TOOL_WIDTH
, 0,
773 MAX_TOUCH_MAJOR
, 0, 0);
774 input_set_abs_params(input
, ABS_MT_TOUCH_MAJOR
, 0,
775 MAX_TOUCH_MAJOR
, 0, 0);
776 input_set_abs_params(input
, ABS_MT_PRESSURE
, 0,
780 __set_bit(BTN_LEFT
, input
->keybit
);
781 __set_bit(INPUT_PROP_BUTTONPAD
, input
->propbit
);
783 ret
= input_mt_init_slots(input
, drvdata
->tp
->max_contacts
,
787 hid_err(hdev
, "Asus input mt init slots failed: %d\n", ret
);
792 drvdata
->input
= input
;
794 if (drvdata
->enable_backlight
&&
795 !asus_kbd_wmi_led_control_present(hdev
) &&
796 asus_kbd_register_leds(hdev
))
797 hid_warn(hdev
, "Failed to initialize backlight.\n");
802 #define asus_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, \
804 static int asus_input_mapping(struct hid_device
*hdev
,
805 struct hid_input
*hi
, struct hid_field
*field
,
806 struct hid_usage
*usage
, unsigned long **bit
,
809 struct asus_drvdata
*drvdata
= hid_get_drvdata(hdev
);
811 if (drvdata
->quirks
& QUIRK_SKIP_INPUT_MAPPING
) {
812 /* Don't map anything from the HID report.
813 * We do it all manually in asus_input_configured
819 * Ignore a bunch of bogus collections in the T100CHI descriptor.
820 * This avoids a bunch of non-functional hid_input devices getting
821 * created because of the T100CHI using HID_QUIRK_MULTI_INPUT.
823 if ((drvdata
->quirks
& (QUIRK_T100CHI
| QUIRK_T90CHI
)) &&
824 (field
->application
== (HID_UP_GENDESK
| 0x0080) ||
825 field
->application
== HID_GD_MOUSE
||
826 usage
->hid
== (HID_UP_GENDEVCTRLS
| 0x0024) ||
827 usage
->hid
== (HID_UP_GENDEVCTRLS
| 0x0025) ||
828 usage
->hid
== (HID_UP_GENDEVCTRLS
| 0x0026)))
831 /* ASUS-specific keyboard hotkeys and led backlight */
832 if ((usage
->hid
& HID_USAGE_PAGE
) == HID_UP_ASUSVENDOR
) {
833 switch (usage
->hid
& HID_USAGE
) {
834 case 0x10: asus_map_key_clear(KEY_BRIGHTNESSDOWN
); break;
835 case 0x20: asus_map_key_clear(KEY_BRIGHTNESSUP
); break;
836 case 0x35: asus_map_key_clear(KEY_DISPLAY_OFF
); break;
837 case 0x6c: asus_map_key_clear(KEY_SLEEP
); break;
838 case 0x7c: asus_map_key_clear(KEY_MICMUTE
); break;
839 case 0x82: asus_map_key_clear(KEY_CAMERA
); break;
840 case 0x88: asus_map_key_clear(KEY_RFKILL
); break;
841 case 0xb5: asus_map_key_clear(KEY_CALC
); break;
842 case 0xc4: asus_map_key_clear(KEY_KBDILLUMUP
); break;
843 case 0xc5: asus_map_key_clear(KEY_KBDILLUMDOWN
); break;
844 case 0xc7: asus_map_key_clear(KEY_KBDILLUMTOGGLE
); break;
846 case 0x6b: asus_map_key_clear(KEY_F21
); break; /* ASUS touchpad toggle */
847 case 0x38: asus_map_key_clear(KEY_PROG1
); break; /* ROG key */
848 case 0xba: asus_map_key_clear(KEY_PROG2
); break; /* Fn+C ASUS Splendid */
849 case 0x5c: asus_map_key_clear(KEY_PROG3
); break; /* Fn+Space Power4Gear */
850 case 0x99: asus_map_key_clear(KEY_PROG4
); break; /* Fn+F5 "fan" symbol */
851 case 0xae: asus_map_key_clear(KEY_PROG4
); break; /* Fn+F5 "fan" symbol */
852 case 0x92: asus_map_key_clear(KEY_CALC
); break; /* Fn+Ret "Calc" symbol */
853 case 0xb2: asus_map_key_clear(KEY_PROG2
); break; /* Fn+Left previous aura */
854 case 0xb3: asus_map_key_clear(KEY_PROG3
); break; /* Fn+Left next aura */
855 case 0x6a: asus_map_key_clear(KEY_F13
); break; /* Screenpad toggle */
856 case 0x4b: asus_map_key_clear(KEY_F14
); break; /* Arrows/Pg-Up/Dn toggle */
857 case 0xa5: asus_map_key_clear(KEY_F15
); break; /* ROG Ally left back */
858 case 0xa6: asus_map_key_clear(KEY_F16
); break; /* ROG Ally QAM button */
859 case 0xa7: asus_map_key_clear(KEY_F17
); break; /* ROG Ally ROG long-press */
860 case 0xa8: asus_map_key_clear(KEY_F18
); break; /* ROG Ally ROG long-press-release */
863 /* ASUS lazily declares 256 usages, ignore the rest,
864 * as some make the keyboard appear as a pointer device. */
869 * Check and enable backlight only on devices with UsagePage ==
870 * 0xff31 to avoid initializing the keyboard firmware multiple
871 * times on devices with multiple HID descriptors but same
874 if (drvdata
->quirks
& QUIRK_USE_KBD_BACKLIGHT
)
875 drvdata
->enable_backlight
= true;
877 set_bit(EV_REP
, hi
->input
->evbit
);
881 if ((usage
->hid
& HID_USAGE_PAGE
) == HID_UP_MSVENDOR
) {
882 switch (usage
->hid
& HID_USAGE
) {
883 case 0xff01: asus_map_key_clear(BTN_1
); break;
884 case 0xff02: asus_map_key_clear(BTN_2
); break;
885 case 0xff03: asus_map_key_clear(BTN_3
); break;
886 case 0xff04: asus_map_key_clear(BTN_4
); break;
887 case 0xff05: asus_map_key_clear(BTN_5
); break;
888 case 0xff06: asus_map_key_clear(BTN_6
); break;
889 case 0xff07: asus_map_key_clear(BTN_7
); break;
890 case 0xff08: asus_map_key_clear(BTN_8
); break;
891 case 0xff09: asus_map_key_clear(BTN_9
); break;
892 case 0xff0a: asus_map_key_clear(BTN_A
); break;
893 case 0xff0b: asus_map_key_clear(BTN_B
); break;
894 case 0x00f1: asus_map_key_clear(KEY_WLAN
); break;
895 case 0x00f2: asus_map_key_clear(KEY_BRIGHTNESSDOWN
); break;
896 case 0x00f3: asus_map_key_clear(KEY_BRIGHTNESSUP
); break;
897 case 0x00f4: asus_map_key_clear(KEY_DISPLAY_OFF
); break;
898 case 0x00f7: asus_map_key_clear(KEY_CAMERA
); break;
899 case 0x00f8: asus_map_key_clear(KEY_PROG1
); break;
904 set_bit(EV_REP
, hi
->input
->evbit
);
908 if (drvdata
->quirks
& QUIRK_NO_CONSUMER_USAGES
&&
909 (usage
->hid
& HID_USAGE_PAGE
) == HID_UP_CONSUMER
) {
910 switch (usage
->hid
& HID_USAGE
) {
911 case 0xe2: /* Mute */
912 case 0xe9: /* Volume up */
913 case 0xea: /* Volume down */
916 /* Ignore dummy Consumer usages which make the
917 * keyboard incorrectly appear as a pointer device.
924 * The mute button is broken and only sends press events, we
925 * deal with this in our raw_event handler, so do not map it.
927 if ((drvdata
->quirks
& QUIRK_MEDION_E1239T
) &&
928 usage
->hid
== (HID_UP_CONSUMER
| 0xe2)) {
929 input_set_capability(hi
->input
, EV_KEY
, KEY_MUTE
);
936 static int asus_start_multitouch(struct hid_device
*hdev
)
939 static const unsigned char buf
[] = {
940 FEATURE_REPORT_ID
, 0x00, 0x03, 0x01, 0x00
942 unsigned char *dmabuf
= kmemdup(buf
, sizeof(buf
), GFP_KERNEL
);
946 hid_err(hdev
, "Asus failed to alloc dma buf: %d\n", ret
);
950 ret
= hid_hw_raw_request(hdev
, dmabuf
[0], dmabuf
, sizeof(buf
),
951 HID_FEATURE_REPORT
, HID_REQ_SET_REPORT
);
955 if (ret
!= sizeof(buf
)) {
956 hid_err(hdev
, "Asus failed to start multitouch: %d\n", ret
);
963 static int __maybe_unused
asus_resume(struct hid_device
*hdev
) {
964 struct asus_drvdata
*drvdata
= hid_get_drvdata(hdev
);
967 if (drvdata
->kbd_backlight
) {
968 const u8 buf
[] = { FEATURE_KBD_REPORT_ID
, 0xba, 0xc5, 0xc4,
969 drvdata
->kbd_backlight
->cdev
.brightness
};
970 ret
= asus_kbd_set_report(hdev
, buf
, sizeof(buf
));
972 hid_err(hdev
, "Asus failed to set keyboard backlight: %d\n", ret
);
973 goto asus_resume_err
;
981 static int __maybe_unused
asus_reset_resume(struct hid_device
*hdev
)
983 struct asus_drvdata
*drvdata
= hid_get_drvdata(hdev
);
986 return asus_start_multitouch(hdev
);
991 static int asus_probe(struct hid_device
*hdev
, const struct hid_device_id
*id
)
994 struct asus_drvdata
*drvdata
;
996 drvdata
= devm_kzalloc(&hdev
->dev
, sizeof(*drvdata
), GFP_KERNEL
);
997 if (drvdata
== NULL
) {
998 hid_err(hdev
, "Can't alloc Asus descriptor\n");
1002 hid_set_drvdata(hdev
, drvdata
);
1004 drvdata
->quirks
= id
->driver_data
;
1007 * T90CHI's keyboard dock returns same ID values as T100CHI's dock.
1008 * Thus, identify T90CHI dock with product name string.
1010 if (strstr(hdev
->name
, "T90CHI")) {
1011 drvdata
->quirks
&= ~QUIRK_T100CHI
;
1012 drvdata
->quirks
|= QUIRK_T90CHI
;
1015 if (drvdata
->quirks
& QUIRK_IS_MULTITOUCH
)
1016 drvdata
->tp
= &asus_i2c_tp
;
1018 if ((drvdata
->quirks
& QUIRK_T100_KEYBOARD
) && hid_is_usb(hdev
)) {
1019 struct usb_interface
*intf
= to_usb_interface(hdev
->dev
.parent
);
1021 if (intf
->altsetting
->desc
.bInterfaceNumber
== T100_TPAD_INTF
) {
1022 drvdata
->quirks
= QUIRK_SKIP_INPUT_MAPPING
;
1024 * The T100HA uses the same USB-ids as the T100TAF and
1025 * the T200TA uses the same USB-ids as the T100TA, while
1026 * both have different max x/y values as the T100TA[F].
1028 if (dmi_match(DMI_PRODUCT_NAME
, "T100HAN"))
1029 drvdata
->tp
= &asus_t100ha_tp
;
1030 else if (dmi_match(DMI_PRODUCT_NAME
, "T200TA"))
1031 drvdata
->tp
= &asus_t200ta_tp
;
1033 drvdata
->tp
= &asus_t100ta_tp
;
1037 if (drvdata
->quirks
& QUIRK_T100CHI
) {
1039 * All functionality is on a single HID interface and for
1040 * userspace the touchpad must be a separate input_dev.
1042 hdev
->quirks
|= HID_QUIRK_MULTI_INPUT
;
1043 drvdata
->tp
= &asus_t100chi_tp
;
1046 if ((drvdata
->quirks
& QUIRK_MEDION_E1239T
) && hid_is_usb(hdev
)) {
1047 struct usb_host_interface
*alt
=
1048 to_usb_interface(hdev
->dev
.parent
)->altsetting
;
1050 if (alt
->desc
.bInterfaceNumber
== MEDION_E1239T_TPAD_INTF
) {
1051 /* For separate input-devs for tp and tp toggle key */
1052 hdev
->quirks
|= HID_QUIRK_MULTI_INPUT
;
1053 drvdata
->quirks
|= QUIRK_SKIP_INPUT_MAPPING
;
1054 drvdata
->tp
= &medion_e1239t_tp
;
1058 if (drvdata
->quirks
& QUIRK_NO_INIT_REPORTS
)
1059 hdev
->quirks
|= HID_QUIRK_NO_INIT_REPORTS
;
1061 drvdata
->hdev
= hdev
;
1063 if (drvdata
->quirks
& (QUIRK_T100CHI
| QUIRK_T90CHI
)) {
1064 ret
= asus_battery_probe(hdev
);
1067 "Asus hid battery_probe failed: %d\n", ret
);
1072 ret
= hid_parse(hdev
);
1074 hid_err(hdev
, "Asus hid parse failed: %d\n", ret
);
1078 ret
= hid_hw_start(hdev
, HID_CONNECT_DEFAULT
);
1080 hid_err(hdev
, "Asus hw start failed: %d\n", ret
);
1084 if (!drvdata
->input
) {
1085 hid_err(hdev
, "Asus input not registered\n");
1091 drvdata
->input
->name
= "Asus TouchPad";
1093 drvdata
->input
->name
= "Asus Keyboard";
1097 ret
= asus_start_multitouch(hdev
);
1108 static void asus_remove(struct hid_device
*hdev
)
1110 struct asus_drvdata
*drvdata
= hid_get_drvdata(hdev
);
1111 unsigned long flags
;
1113 if (drvdata
->kbd_backlight
) {
1114 spin_lock_irqsave(&drvdata
->kbd_backlight
->lock
, flags
);
1115 drvdata
->kbd_backlight
->removed
= true;
1116 spin_unlock_irqrestore(&drvdata
->kbd_backlight
->lock
, flags
);
1118 cancel_work_sync(&drvdata
->kbd_backlight
->work
);
1124 static const __u8 asus_g752_fixed_rdesc
[] = {
1125 0x19, 0x00, /* Usage Minimum (0x00) */
1126 0x2A, 0xFF, 0x00, /* Usage Maximum (0xFF) */
1129 static const __u8
*asus_report_fixup(struct hid_device
*hdev
, __u8
*rdesc
,
1130 unsigned int *rsize
)
1132 struct asus_drvdata
*drvdata
= hid_get_drvdata(hdev
);
1134 if (drvdata
->quirks
& QUIRK_FIX_NOTEBOOK_REPORT
&&
1135 *rsize
>= 56 && rdesc
[54] == 0x25 && rdesc
[55] == 0x65) {
1136 hid_info(hdev
, "Fixing up Asus notebook report descriptor\n");
1139 /* For the T100TA/T200TA keyboard dock */
1140 if (drvdata
->quirks
& QUIRK_T100_KEYBOARD
&&
1141 (*rsize
== 76 || *rsize
== 101) &&
1142 rdesc
[73] == 0x81 && rdesc
[74] == 0x01) {
1143 hid_info(hdev
, "Fixing up Asus T100 keyb report descriptor\n");
1144 rdesc
[74] &= ~HID_MAIN_ITEM_CONSTANT
;
1146 /* For the T100CHI/T90CHI keyboard dock */
1147 if (drvdata
->quirks
& (QUIRK_T100CHI
| QUIRK_T90CHI
)) {
1151 if (drvdata
->quirks
& QUIRK_T100CHI
) {
1160 * Change Usage (76h) to Usage Minimum (00h), Usage Maximum
1161 * (FFh) and clear the flags in the Input() byte.
1162 * Note the descriptor has a bogus 0 byte at the end so we
1163 * only need 1 extra byte.
1165 if (*rsize
== rsize_orig
&&
1166 rdesc
[offs
] == 0x09 && rdesc
[offs
+ 1] == 0x76) {
1167 *rsize
= rsize_orig
+ 1;
1168 rdesc
= kmemdup(rdesc
, *rsize
, GFP_KERNEL
);
1172 hid_info(hdev
, "Fixing up %s keyb report descriptor\n",
1173 drvdata
->quirks
& QUIRK_T100CHI
?
1174 "T100CHI" : "T90CHI");
1175 memmove(rdesc
+ offs
+ 4, rdesc
+ offs
+ 2, 12);
1177 rdesc
[offs
+ 1] = 0x00;
1178 rdesc
[offs
+ 2] = 0x29;
1179 rdesc
[offs
+ 3] = 0xff;
1180 rdesc
[offs
+ 14] = 0x00;
1184 if (drvdata
->quirks
& QUIRK_G752_KEYBOARD
&&
1185 *rsize
== 75 && rdesc
[61] == 0x15 && rdesc
[62] == 0x00) {
1186 /* report is missing usage minimum and maximum */
1188 size_t new_size
= *rsize
+ sizeof(asus_g752_fixed_rdesc
);
1190 new_rdesc
= devm_kzalloc(&hdev
->dev
, new_size
, GFP_KERNEL
);
1191 if (new_rdesc
== NULL
)
1194 hid_info(hdev
, "Fixing up Asus G752 keyb report descriptor\n");
1195 /* copy the valid part */
1196 memcpy(new_rdesc
, rdesc
, 61);
1197 /* insert missing part */
1198 memcpy(new_rdesc
+ 61, asus_g752_fixed_rdesc
, sizeof(asus_g752_fixed_rdesc
));
1199 /* copy remaining data */
1200 memcpy(new_rdesc
+ 61 + sizeof(asus_g752_fixed_rdesc
), rdesc
+ 61, *rsize
- 61);
1206 if (drvdata
->quirks
& QUIRK_ROG_NKEY_KEYBOARD
&&
1207 *rsize
== 331 && rdesc
[190] == 0x85 && rdesc
[191] == 0x5a &&
1208 rdesc
[204] == 0x95 && rdesc
[205] == 0x05) {
1209 hid_info(hdev
, "Fixing up Asus N-KEY keyb report descriptor\n");
1213 /* match many more n-key devices */
1214 if (drvdata
->quirks
& QUIRK_ROG_NKEY_KEYBOARD
&& *rsize
> 15) {
1215 for (int i
= 0; i
< *rsize
- 15; i
++) {
1216 /* offset to the count from 0x5a report part always 14 */
1217 if (rdesc
[i
] == 0x85 && rdesc
[i
+ 1] == 0x5a &&
1218 rdesc
[i
+ 14] == 0x95 && rdesc
[i
+ 15] == 0x05) {
1219 hid_info(hdev
, "Fixing up Asus N-Key report descriptor\n");
1220 rdesc
[i
+ 15] = 0x01;
1229 static const struct hid_device_id asus_devices
[] = {
1230 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK
,
1231 USB_DEVICE_ID_ASUSTEK_I2C_KEYBOARD
), I2C_KEYBOARD_QUIRKS
},
1232 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK
,
1233 USB_DEVICE_ID_ASUSTEK_I2C_TOUCHPAD
), I2C_TOUCHPAD_QUIRKS
},
1234 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK
,
1235 USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD1
), QUIRK_USE_KBD_BACKLIGHT
},
1236 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK
,
1237 USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD2
), QUIRK_USE_KBD_BACKLIGHT
},
1238 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK
,
1239 USB_DEVICE_ID_ASUSTEK_ROG_KEYBOARD3
), QUIRK_G752_KEYBOARD
},
1240 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK
,
1241 USB_DEVICE_ID_ASUSTEK_FX503VD_KEYBOARD
),
1242 QUIRK_USE_KBD_BACKLIGHT
},
1243 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK
,
1244 USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD
),
1245 QUIRK_USE_KBD_BACKLIGHT
| QUIRK_ROG_NKEY_KEYBOARD
},
1246 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK
,
1247 USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD2
),
1248 QUIRK_USE_KBD_BACKLIGHT
| QUIRK_ROG_NKEY_KEYBOARD
},
1249 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK
,
1250 USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD3
),
1251 QUIRK_USE_KBD_BACKLIGHT
| QUIRK_ROG_NKEY_KEYBOARD
},
1252 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK
,
1253 USB_DEVICE_ID_ASUSTEK_ROG_Z13_LIGHTBAR
),
1254 QUIRK_USE_KBD_BACKLIGHT
| QUIRK_ROG_NKEY_KEYBOARD
},
1255 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK
,
1256 USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY
),
1257 QUIRK_USE_KBD_BACKLIGHT
| QUIRK_ROG_NKEY_KEYBOARD
},
1258 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK
,
1259 USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY_X
),
1260 QUIRK_USE_KBD_BACKLIGHT
| QUIRK_ROG_NKEY_KEYBOARD
},
1261 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK
,
1262 USB_DEVICE_ID_ASUSTEK_ROG_CLAYMORE_II_KEYBOARD
),
1263 QUIRK_ROG_CLAYMORE_II_KEYBOARD
},
1264 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK
,
1265 USB_DEVICE_ID_ASUSTEK_T100TA_KEYBOARD
),
1266 QUIRK_T100_KEYBOARD
| QUIRK_NO_CONSUMER_USAGES
},
1267 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK
,
1268 USB_DEVICE_ID_ASUSTEK_T100TAF_KEYBOARD
),
1269 QUIRK_T100_KEYBOARD
| QUIRK_NO_CONSUMER_USAGES
},
1270 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY
, USB_DEVICE_ID_ASUS_AK1D
) },
1271 { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX
, USB_DEVICE_ID_ASUS_MD_5110
) },
1272 { HID_USB_DEVICE(USB_VENDOR_ID_JESS
, USB_DEVICE_ID_ASUS_MD_5112
) },
1273 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ASUSTEK
,
1274 USB_DEVICE_ID_ASUSTEK_T100CHI_KEYBOARD
), QUIRK_T100CHI
},
1275 { HID_USB_DEVICE(USB_VENDOR_ID_ITE
, USB_DEVICE_ID_ITE_MEDION_E1239T
),
1276 QUIRK_MEDION_E1239T
},
1278 * Note bind to the HID_GROUP_GENERIC group, so that we only bind to the keyboard
1279 * part, while letting hid-multitouch.c handle the touchpad.
1281 { HID_DEVICE(BUS_USB
, HID_GROUP_GENERIC
,
1282 USB_VENDOR_ID_ASUSTEK
, USB_DEVICE_ID_ASUSTEK_T101HA_KEYBOARD
) },
1285 MODULE_DEVICE_TABLE(hid
, asus_devices
);
1287 static struct hid_driver asus_driver
= {
1289 .id_table
= asus_devices
,
1290 .report_fixup
= asus_report_fixup
,
1291 .probe
= asus_probe
,
1292 .remove
= asus_remove
,
1293 .input_mapping
= asus_input_mapping
,
1294 .input_configured
= asus_input_configured
,
1296 .reset_resume
= asus_reset_resume
,
1297 .resume
= asus_resume
,
1299 .event
= asus_event
,
1300 .raw_event
= asus_raw_event
1302 module_hid_driver(asus_driver
);
1304 MODULE_LICENSE("GPL");