You are not logged in.

#1 2017-02-09 18:41:03

ItayXD
Member
Registered: 2017-02-09
Posts: 7

Tablet mode event

Hi, I'm trying to get the 'SW_TABLET_MODE' event to work correctly on my HP Spectre X360.
I think I got most of the peaces of the puzzle, but I need help putting them together.

  • hp-wmi is suppose to trigger this event, but has some error on startup, here is dmesg:

    [    2.711444] input: HP WMI hotkeys as /devices/virtual/input/input14
    [    2.714634] ACPI Error: Field [D128] at 1152 exceeds Buffer [NULL] size 160 (bits) (20160831/dsopcode-236)
    [    2.714643] ACPI Error: Method parse/execution failed [\HWMC] (Node ffff8da6c60c1730), AE_AML_BUFFER_LIMIT (20160831/psparse-543)
    [    2.714654] ACPI Error: Method parse/execution failed [\_SB.WMID.WMAA] (Node ffff8da6c60c3690), AE_AML_BUFFER_LIMIT (20160831/psparse-543)
    [    2.714715] ACPI Error: Field [D128] at 1152 exceeds Buffer [NULL] size 160 (bits) (20160831/dsopcode-236)
    [    2.714719] ACPI Error: Method parse/execution failed [\HWMC] (Node ffff8da6c60c1730), AE_AML_BUFFER_LIMIT (20160831/psparse-543)
    [    2.714728] ACPI Error: Method parse/execution failed [\_SB.WMID.WMAA] (Node ffff8da6c60c3690), AE_AML_BUFFER_LIMIT (20160831/psparse-543)
  • I believe that the problem is related to a known problem, where the airplane mode key is spammed because everytime I open the computer to more than 180* and close it again to normal I get another spam of airplane mode keys

  • I believe the problem is acpi related.

  • If I cat the event of INT33D6

    cat /dev/input/by-path/platform-INT33D6:00-event

    I get garbage output  `XXXX+X+` when over 180* (tablet state) and when back to normal (laptop state)

  • I think there is a mixup of INT33D3 and INT33D6, because INT33D3 (or PNP0C60) is suppose to be incharge of laptop mode see here:
    https://msdn.microsoft.com/library/wind … e/dn457868
    https://patchwork.kernel.org/patch/9306475/
    I also decompiled  my DSDT, here is the relevant part (I think):

    Scope (_SB)
        {
            Device (VBPA)
            {
                Name (_HID, "INT33D6" /* Intel Virtual Buttons Device */)  // _HID: Hardware ID
                Method (_STA, 0, NotSerialized)  // _STA: Status
                {
                    If ((OSYS >= 0x07DD))
                    {
                        Return (0x0F)
                    }
                    Else
                    {
                        Return (Zero)
                    }
                }
    
                Name (VBST, Zero)
                Method (VBDL, 0, NotSerialized)
                {
                    If ((^^PCI0.LPCB.EC0.ECOK == One))
                    {
                        If ((^^PCI0.LPCB.EC0.CVTS == Zero))
                        {
                            VBST = 0x40
                        }
                        Else
                        {
                            VBST = Zero
                        }
                    }
                }
    
                Method (VGBS, 0, NotSerialized)
                {
                    If ((^^PCI0.LPCB.EC0.ECOK == One))
                    {
                        If ((^^PCI0.LPCB.EC0.CVTS == Zero))
                        {
                            VBST = 0x40
                        }
                        Else
                        {
                            VBST = Zero
                        }
                    }
    
                    Return (VBST) /* \_SB_.VBPA.VBST */
                }
            }
    
            Device (CIND)
            {
                Name (_HID, "INT33D3" /* Intel GPIO Buttons */)  // _HID: Hardware ID
                Name (_CID, "PNP0C60" /* Display Sensor Device */)  // _CID: Compatible ID
                Method (_STA, 0, NotSerialized)  // _STA: Status
                {
                    If ((OSYS >= 0x07DD))
                    {
                        Return (0x0B)
                    }
                    Else
                    {
                        Return (Zero)
                    }
                }
            }
        }
  • Putting the the computer at tablet state and back at laptop state result in the folllowing messages on dmesg:

    [ 4320.122389] intel-vbtn INT33D6:00: unknown event index 0xcc
    [ 4320.171779] atkbd serio0: Unknown key pressed (translated set 2, code 0xd8 on isa0060/serio0).
    [ 4320.171782] atkbd serio0: Use 'setkeycodes e058 <keycode>' to make it known.
    [ 4320.179630] atkbd serio0: Unknown key released (translated set 2, code 0xd8 on isa0060/serio0).
    [ 4320.179631] atkbd serio0: Use 'setkeycodes e058 <keycode>' to make it known.
    [ 4329.585035] intel-vbtn INT33D6:00: unknown event index 0xcd
  • I can't read the output of hp-wmi:

    ls -la /sys/devices/platform/hp-wmi                                                            9:13PM 
    total 0
    drwxr-xr-x  3 root root    0 פבר  9 19:20 .
    drwxr-xr-x 22 root root    0 פבר  9 19:20 ..
    -rw-r--r--  1 root root 4096 פבר  9 21:12 als
    -r--r--r--  1 root root 4096 פבר  9 21:12 display
    -r--r--r--  1 root root 4096 פבר  9 21:12 dock
    lrwxrwxrwx  1 root root    0 פבר  9 19:20 driver -> ../../../bus/platform/drivers/hp-wmi
    -rw-r--r--  1 root root 4096 פבר  9 21:12 driver_override
    -r--r--r--  1 root root 4096 פבר  9 21:12 hddtemp
    -r--r--r--  1 root root 4096 פבר  9 21:12 modalias
    -rw-r--r--  1 root root 4096 פבר  9 21:12 postcode
    drwxr-xr-x  2 root root    0 פבר  9 21:11 power
    lrwxrwxrwx  1 root root    0 פבר  9 19:26 subsystem -> ../../../bus/platform
    -r--r--r--  1 root root 4096 פבר  9 21:12 tablet
    -rw-r--r--  1 root root 4096 פבר  9 21:12 uevent
    sudo cat /sys/devices/platform/hp-wmi/tablet                                                      9:12PM 
    cat: tablet: Invalid argument

    After trying to read it I get these messages on dmesg:

    [12025.122317] ACPI Error: Field [D128] at 1152 exceeds Buffer [NULL] size 160 (bits) (20160831/dsopcode-236)
    [12025.122323] ACPI Error: Method parse/execution failed [\HWMC] (Node ffff8da6c60c1730), AE_AML_BUFFER_LIMIT (20160831/psparse-543)
    [12025.122332] ACPI Error: Method parse/execution failed [\_SB.WMID.WMAA] (Node ffff8da6c60c3690), AE_AML_BUFFER_LIMIT (20160831/psparse-543)

  • xev output is identical when pressing airplane mode key and when switching from laptop to tablet and vise versa:

    MappingNotify event, serial 35, synthetic NO, window 0x0,
        request MappingKeyboard, first_keycode 8, count 248

I hope this would help other user too,
Thanks in advance,
Itay

Last edited by ItayXD (2017-02-09 23:30:49)

Offline

#2 2017-02-11 20:38:54

ItayXD
Member
Registered: 2017-02-09
Posts: 7

Re: Tablet mode event

Anyone has any idea?

Offline

#3 2017-02-13 02:22:40

matthewprenger
Member
Registered: 2017-02-13
Posts: 1

Re: Tablet mode event

I just ran into this issue as well on my x360. Was curious if you found any workarounds?

Offline

#4 2017-02-15 20:16:50

ItayXD
Member
Registered: 2017-02-09
Posts: 7

Re: Tablet mode event

I did not, but I reported a bug on both arch and the kernel. You can mark yourself as effected, which might get us more attention.
Arch
Kernel

Offline

#5 2017-02-20 16:49:44

ItayXD
Member
Registered: 2017-02-09
Posts: 7

Re: Tablet mode event

Any clue would be welcome...

Offline

#6 2017-02-20 20:41:09

QuackDonkey
Member
Registered: 2017-01-27
Posts: 24

Re: Tablet mode event

It could only be fixed in hp_wmi kernel module, no one here could do this. There are other reports except yours already submitted: https://bugzilla.kernel.org/show_bug.cgi?id=190661 .

You can ping Matthew Garrett https://twitter.com/mjg59 which I think is one of the developers of this module and ask him if it's fixable or not.

If you only want get rid of those errors you can blacklist hp_wmi module in /etc/modprobe.d

Offline

#7 2017-02-25 20:52:28

QuackDonkey
Member
Registered: 2017-01-27
Posts: 24

Re: Tablet mode event

Another way to tackle this would be to fix those DSDT/SSDT tables by yourself. Unfortunately there is no easy wat to do this. Here some guidelines:
https://forums.gentoo.org/viewtopic.php?t=122145
https://www.tonymacx86.com/threads/guid … ts.152573/
https://github.com/RehabMan/Laptop-DSDT-Patch

Try to fix all errors, maybe one of them is causing this issue. I think you could ask on gentoo forums for help.

Offline

#8 2017-02-26 12:43:40

ItayXD
Member
Registered: 2017-02-09
Posts: 7

Re: Tablet mode event

Thank you very much QuackDonkey, I did find some new info, that might lead me to the solution.
As we can see in dmesg, all I have to do it set the correct keycode to the scancode

[ 4320.171782] atkbd serio0: Use 'setkeycodes e058 <keycode>' to make it known.

I tried it, and it works, I can get it to type a letter for example whenever I switch to tablet state using:

setkeycodes e058 <keycode>

I also managed to make it permanent using udev I added these line to `/etc/udev/hwdb.d/70-keyboard.hwdb`:

# Keys for HP spectre x360
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHP:pnHPSpectrex360Convertible:pvr
 KEYBOARD_KEY_d8=k

to get it to type k (for example) when ever switching to tablet mode (based on `[ 4320.171779] atkbd serio0: Unknown key pressed (translated set 2, code 0xd8 on isa0060/serio0).`)
the problem I have now is getting it to work for switching to laptop state.
If I set it using setkeycode:

setkeycodes e057 <keycode>

it works fine and print whatever character, however when I try to set it as I udev rule it seems to be overwritten.
setting:

# Keys for HP spectre x360
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnHP:pnHPSpectrex360Convertible:pvr
 KEYBOARD_KEY_d8=k
 KEYBOARD_KEY_d8=z

doesn't print z, instead it trigger airplane mode.
Anyone has any idea when this is coming from or how to over write it?

Last edited by ItayXD (2017-02-26 12:45:01)

Offline

#9 2017-02-26 22:37:55

QuackDonkey
Member
Registered: 2017-01-27
Posts: 24

Re: Tablet mode event

Ok, but what's the point with those keybindings?

If I understand this correctly you want to make your accelerometer work with auto rotate screen. Those keys are virtual and belongs to accelerometer under hp_wmi module which is bugged. You can install https://github.com/hadess/iio-sensor-proxy avalaible in AUR https://aur.archlinux.org/packages/iio- … proxy-git/ and after reboot run "monitor-sensor" and try to rotate screen to see those events.

Offline

#10 2017-02-26 22:46:27

ItayXD
Member
Registered: 2017-02-09
Posts: 7

Re: Tablet mode event

there are 2 different sensors, one for accelerometer, used for orientation (which I managed to get working), and the other is for detecting tablet mode and laptop mode, used to disable touchpad and etc which I'm trying to fix

Offline

#11 2017-02-26 23:04:58

QuackDonkey
Member
Registered: 2017-01-27
Posts: 24

Re: Tablet mode event

How do you managed to rotation working?

Offline

#12 2017-02-27 11:47:20

QuackDonkey
Member
Registered: 2017-01-27
Posts: 24

Re: Tablet mode event

I think you have to contact kernel maintainers of hp_wmi or intel-vbtn modules (or both) and ask them to add support for this HP Spectre feature. You can't fix this in userspace.

Last edited by QuackDonkey (2017-03-03 22:51:43)

Offline

#13 2017-03-04 15:07:26

QuackDonkey
Member
Registered: 2017-01-27
Posts: 24

Re: Tablet mode event

Ok, I made it!

#/etc/udev/hwdb.d/90-custom-keyboard.hwdb
evdev:atkbd:dmi:bvn*:bvr*:bd*:svn*:pn*:pvr*
 KEYBOARD_KEY_d8=!f23
 KEYBOARD_KEY_d7=!f22

Now you have to bind f23 and f22 keys to enable and disable touchpad events. In kde go to: system settings --> shortcuts -> global shortcuts -> KDE daemon

Check "Disable Touchpad", select custom shortcut, then flip your laptop into tablet - it should detect the key as "Touchpad Off".
Next check "Enable Touchpad", select custom shortcut, then return your laptop into laptop -  it should detect the key as "Wireless" (This name doesn't matter it works as intended).

Note that I disabled hp_wmi module in modprobe.d (I don't know if it's relevant). It should be similiar in other DE. I hope this help you.

Offline

Board footer

Powered by FluxBB