Skip to content

Commit fdcc060

Browse files
committed
platform/x86: asus-wmi: Fix kbd_dock_devid tablet-switch reporting
Commit 1ea0d3b ("platform/x86: asus-wmi: Simplify tablet-mode-switch handling") unified the asus-wmi tablet-switch handling, but it did not take into account that the value returned for the kbd_dock_devid WMI method is inverted where as the other ones are not inverted. This causes asus-wmi to report an inverted tablet-switch state for devices which use the kbd_dock_devid, which causes libinput to ignore touchpad events while the affected T10x model 2-in-1s are docked. Add inverting of the return value in the kbd_dock_devid case to fix this. Fixes: 1ea0d3b ("platform/x86: asus-wmi: Simplify tablet-mode-switch handling") Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a410429 commit fdcc060

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

drivers/platform/x86/asus-wmi.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ struct asus_wmi {
225225

226226
int tablet_switch_event_code;
227227
u32 tablet_switch_dev_id;
228+
bool tablet_switch_inverted;
228229

229230
enum fan_type fan_type;
230231
enum fan_type gpu_fan_type;
@@ -493,6 +494,13 @@ static bool asus_wmi_dev_is_present(struct asus_wmi *asus, u32 dev_id)
493494
}
494495

495496
/* Input **********************************************************************/
497+
static void asus_wmi_tablet_sw_report(struct asus_wmi *asus, bool value)
498+
{
499+
input_report_switch(asus->inputdev, SW_TABLET_MODE,
500+
asus->tablet_switch_inverted ? !value : value);
501+
input_sync(asus->inputdev);
502+
}
503+
496504
static void asus_wmi_tablet_sw_init(struct asus_wmi *asus, u32 dev_id, int event_code)
497505
{
498506
struct device *dev = &asus->platform_device->dev;
@@ -501,7 +509,7 @@ static void asus_wmi_tablet_sw_init(struct asus_wmi *asus, u32 dev_id, int event
501509
result = asus_wmi_get_devstate_simple(asus, dev_id);
502510
if (result >= 0) {
503511
input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE);
504-
input_report_switch(asus->inputdev, SW_TABLET_MODE, result);
512+
asus_wmi_tablet_sw_report(asus, result);
505513
asus->tablet_switch_dev_id = dev_id;
506514
asus->tablet_switch_event_code = event_code;
507515
} else if (result == -ENODEV) {
@@ -534,6 +542,7 @@ static int asus_wmi_input_init(struct asus_wmi *asus)
534542
case asus_wmi_no_tablet_switch:
535543
break;
536544
case asus_wmi_kbd_dock_devid:
545+
asus->tablet_switch_inverted = true;
537546
asus_wmi_tablet_sw_init(asus, ASUS_WMI_DEVID_KBD_DOCK, NOTIFY_KBD_DOCK_CHANGE);
538547
break;
539548
case asus_wmi_lid_flip_devid:
@@ -573,10 +582,8 @@ static void asus_wmi_tablet_mode_get_state(struct asus_wmi *asus)
573582
return;
574583

575584
result = asus_wmi_get_devstate_simple(asus, asus->tablet_switch_dev_id);
576-
if (result >= 0) {
577-
input_report_switch(asus->inputdev, SW_TABLET_MODE, result);
578-
input_sync(asus->inputdev);
579-
}
585+
if (result >= 0)
586+
asus_wmi_tablet_sw_report(asus, result);
580587
}
581588

582589
/* dGPU ********************************************************************/

0 commit comments

Comments
 (0)