I've recently bought this laptop for pen usage for taking class notes, and daily driver for a week with a Windows installation, and as soon as I had time I've tried with a Linux installation (Arch in my case). I would expect that touchscreen and pen input under Linux was a no go, since AFAICS the only well supported pen input methods was Wacom Digitizer, while this system has a MPP implementation from Microsoft, that was decent under Windows but not perfect with handling palm rejection from the touchscreen. With my suprise, touchscreen and pen input works better under linux, buttons from the stylus works, and palm rejection is even better, almost perfect. Rotation works, since the accelerometer in the display is detected with some custom software. The issue is the automatic switch off for the keyboard and the trackpad while it is used with the display only. The inputs are still triggered, the hack from me was to use xinput to manually disable the keyboard and mouse with a script, but that's just a temporary fix. I've taken quite a look to get where the event should come from and why it's not working here. As far as I have traced the problem, the issue is probably coming from asus-wmi and asus-nb-wmi. I've tried to force tablet mode as a parameter for the second module, but the module at boot complains with: This device has lid_flip quirk but got ENODEV checking it. This is a bug. At row https://github.com/torvalds/linux/blob/7fd2bf83d59a2d32e0d596c5d3e623b9a0e7e2d5/drivers/platform/x86/asus-wmi.c#L403 From the code is searching for an event called ASUS_WMI_DEVID_LID_FLIP, with the WMI id of 0x00060062, as of https://github.com/torvalds/linux/blob/7ba88a2a09f47e2e4f3e34215677a1d78a9e6a73/include/linux/platform_data/x86/asus-wmi.h#L66 From there I've dumped the DSDT for my machine, did a search for that specific ID, and I found an actual entry in the WMI table (one with a return(one), the other with a return(Zero), so I'm assuming that the call should work fine? Even if it's returning always 1 or 0, it should be possible to read anyway?). I'll attach a complete DSDT and SSDT dump for this machine to this post. I've tried to force _OSI to Windows 2015 to see if the issue it's a DSDT platform bug or what but this hasn't changed anything. I always see SSDTs errors at boot time, so some SSDTs has some parsing issues as always (Quite a lot on EC related stuff, but I'm not sure if that is the issue here). Can anyone help me debug where the issue lies here?
Created attachment 299163 [details] dmesg log
Created attachment 299165 [details] DSDT and SSDTs of TM420IA
Are there any tests we can do or logging that we can acquire to help debug this issue. Unfortunately also having this issue.
(In reply to Tom from comment #3) > Are there any tests we can do or logging that we can acquire to help debug > this issue. Unfortunately also having this issue. I do not have this laptop anymore for other unrelated issues, so I don't really need this issue fixed anymore. You can kinda workaround this by using accelerometer data and estimating the display position, but that wasn't that great all the time. AFAIK the issue rely on the fact that amd-sfh do not support lid angle sensors as of today, but I'm not sure if this laptop use that driver or ASUS has invented something else for handling it and therefore the driver is fully missing. Marco.
Thanks for the update
I have dual boot Windows 11 and I can confirm WMI id `0x00060062` changes each flip: ``` # laptop mode - returns 0 $ (Invoke-CimMethod (Get-CimInstance -Namespace root/wmi -ClassName AsusAtkWmi_WMNB) -MethodName DSTS -Arguments @{Device_ID=0x00060062} | Select-Object -ExpandProperty device_status) - 65536 0 # tablet mode - returns 1 # read tablet mode (no keyboard, because of that is used sleep) $ Start-Sleep -Seconds 5 ; (Invoke-CimMethod (Get-CimInstance -Namespace root/wmi -ClassName AsusAtkWmi_WMNB) -MethodName DSTS -Arguments @{Device_ID=0x00060062} | Select-Object -ExpandProperty device_status) - 65536 1 ``` What I tried also was flipping to tablet mode on Windows and then shutdown with pressing power button and boot to Linux and read value, but was `0`: ``` $ sudo -s $ cd /sys/kernel/debug/asus-nb-wmi $ echo "0x60062" > dev_id $ cat dsts ``` On Linux I also tried to do is execute method `_SB.PCI0.SBRG.EC0.RPIN` but value what was succesfully written was only 1, do not know how to understand value `0x0E` in the brackets in `DSDT.dsl` table below: ``` $ sudo acpidbg $ $ find RPIN $ \_SB.PCI0.SBRG.EC0.RPIN Method 000000003537b063 001 Args 1 Len 0009 Aml 0000000074b8092b $ evaluate _SB.PCI0.SBRG.EC0.RPIN 1 Evaluating \_SB.PCI0.SBRG.EC0.RPIN Evaluation of \_SB.PCI0.SBRG.EC0.RPIN returned object 000000005df55307, external buffer length 18 [Integer] = 0000000000000001 ``` Then I tried to read `0x60062`, was still zero. Related parts of ACPI table (I found `PCI0.SBRG.EC0.RPIN (0x0E)` on two places only): ``` Scope (\_SB.ATKD) { Method (FANL, 1, Serialized) { FANF = Arg0 If ((^^ != One)) { ^^PCI0.SBRG.EC0.MPLI (0x05, Zero) ^^PCI0.SBRG.EC0.MPLI (One, Zero) ^^PCI0.SBRG.EC0.MPLI (0x07, Zero) ^^PCI0.SBRG.EC0.MPLI (0x06, Zero) ^^PCI0.SBRG.EC0.MPLI (0x08, Zero) ^^PCI0.SBRG.EC0.MPLI (0x03, 0x05) If (ACPF) { ^^PCI0.SBRG.EC0.STTM (0x0B, 0xE290) ^^PCI0.SBRG.EC0.STTM (0x0C, 0x0001ADB0) } Else { ^^PCI0.SBRG.EC0.STTM (0x0B, 0xE290) ^^PCI0.SBRG.EC0.STTM (0x0C, 0x0001ADB0) } ^^PCI0.SBRG.EC0.STTF () } TEMF = One If ((^^PCI0.SBRG.EC0.RPIN (0x0E) != One)) { SMIF = 0x05 FANF = Arg0 } Return (ASMI (Arg0)) } } ... If ((IIA0 == 0x00060062)) { If (^^PCI0.SBRG.EC0.RPIN (0x0E)) { Local0 = 0x00010001 } Else { Local0 = 0x00010000 } Return (Local0) } ```
Using logs from G-helper (open source Armoury Crate alternative for Asus laptops - https://github.com/seerge/g-helper) during flipping ``` ... 11.01.2024 15:03:17: WMI event 250 11.01.2024 15:03:21: WMI event 250 11.01.2024 15:03:33: WMI event 250 11.01.2024 15:03:37: WMI event 250 11.01.2024 15:04:21: WMI event 250 ... ``` I can confirm that Windows uses value 250 dec which is `0xFA` in hexa, already associated in `asus-nb-wmi` with `KEY_PROG2` ``` ... > { KE_KEY, 0xC5, { KEY_KBDILLUMDOWN } }, > { KE_IGNORE, 0xC6, }, /* Ambient Light Sensor notification */ > { KE_KEY, 0xFA, { KEY_PROG2 } }, /* Lid flip action */ > { KE_KEY, 0xBD, { KEY_PROG2 } }, /* Lid flip action on rog > flow laptops */ ... ``` Laptop Zenbook UN5401QAB_UN5401QA
I created a driver https://github.com/asus-linux-drivers/asus-accel-tablet-mode-driver which sends appropriate events (`EV_KEY.KEY_PROG2` and `EV_SW.SW_TABLET_MODE`) based on accelerometer data as a solution that may be sufficient for someone: ``` $ sudo libinput debug-events ... -event7 DEVICE_ADDED Asus WMI accel tablet mode seat0 default group9 cap:kS ... event7 KEYBOARD_KEY +0.000s KEY_PROG2 (149) pressed event7 KEYBOARD_KEY +0.000s KEY_PROG2 (149) released event7 SWITCH_TOGGLE +0.000s switch tablet-mode state 1 event7 KEYBOARD_KEY +1.004s KEY_PROG2 (149) pressed event7 KEYBOARD_KEY +1.004s KEY_PROG2 (149) released event7 SWITCH_TOGGLE +1.004s switch tablet-mode state 0 ``` ``` $ sudo acpi_listen video/tabletmode TBLT 0000008A 00000001 video/tabletmode TBLT 0000008A 00000000 ```
On Windows, I can confirm that flip stops working when I disable AMD Sensor Fusion HUB in Device Manager.
Created attachment 305713 [details] Laptop Zenbook UN5401QAB_UN5401QA - Device manager - AMD Sensor Fusion Hub
Created attachment 305714 [details] Laptop Zenbook UN5401QAB_UN5401QA - Device manager - AMD UMDF Sensor
Created attachment 305715 [details] Laptop Zenbook UN5401QAB_UN5401QA - Device manager - Simple Device Orientation Sensor
Marco, please change the kernel version to 6.6.10-1 (this is what I am currently using).
Done, but I'll tick ignore bug mail now since I don't have the laptop in question and being the submitter make me unable to remove myself from it. I would like to be able to have a feature like the AUR disown package here, so at least other people could pick up the issue without having to open a complete separate one, but that's sadly not the case. Anyway, good luck in fixing this :) Marco.