You are not logged in.

#1 2024-04-11 17:25:26

jmole
Member
Registered: 2024-04-11
Posts: 3

Rotating my device disables the keyboard, how can I prevent this?

Hello, I have a new HP Spectre x360 16" that I've recently installed Arch on. It's a 2 in 1 device, and so there is a bunch of built-in stuff that happens when you rotate the device to accommodate "tablet mode".

Some of this stuff is configurable (screen rotation lock in GNOME, e.g.), but there is a really annoying feature where when you rotate the device left to right beyond ~45 degrees, the keyboard and touchpad are disabled.

To be clear, this is like rotation where the left speaker is higher than the right speaker, or vice versa.

I can understand why you might want the touchpad and keyboard disabled if you're in "tent mode", or full on "tablet mode" with the keyboard folded behind the display, but this happens even in laptop mode with the screen and keyboard in a typical laptop configuration.

I've narrowed this down to the intel integrated sensor hub, and specifically disabling the `intel_hid` module will disable this behavior. However, disabling this module also completely disables any kind of tablet mode behaviors, which I'd still like to keep for tent mode and tablet mode. Basically I just don't want the keyboard to be disabled when I'm just rotating the device when it's in laptop mode.

It's not clear to me at this point if this is configurable, or if there is some underlying firmware controlling this outside of linux.

I've found where the tablet mode state is reported, but I don't know enough about where these events come from to investigate this any further.

Wondering if anyone has some tips on how I can get more information here.

There are a couple other related modules involved, but I haven't looked deeply into them: `hp_wmi` and `intel_ishtp_hid`.

Offline

#2 2024-04-11 19:01:55

jl2
Member
From: 47° 18' N 8° 34' E
Registered: 2022-06-01
Posts: 296
Website

Re: Rotating my device disables the keyboard, how can I prevent this?

Hi,
This is *very* likely disabled by HW, as well as Tent/tablet mode. Check you're bios settings.
To be sure, uninstall iio-sensor-proxy and look again. This will make the rotation sensors unavailable for gnome.
You can go digging around in '/sys/drivers/hp_wmi', as if it's the kernel, it'll be there.

and you might be interested in https://h30434.www3.hp.com/t5/Notebook- … -p/5771767

Last edited by jl2 (2024-04-11 19:02:39)


Why I run Arch? To "BTW I run Arch" the guy one grade younger.
And to let my siblings and cousins laugh at Arsch Linux...

Offline

#3 2024-04-12 20:46:07

jmole
Member
Registered: 2024-04-11
Posts: 3

Re: Rotating my device disables the keyboard, how can I prevent this?

Actually it seems like there is some kernel (or userspace) involvement here after the tablet mode is reported. Digging through the ACPI tables, I've found this function which does the actual reporting from the hardware event:


https://github.com/slimbootloader/slimb … .asl#L1099

Method (_Q82)    // Tablet Switch Toggle Slate/Tablet mode
{
  If (LEqual (SMSS, 1)) // SDS, PantherMtn, GrizzlyMtn or StarBrook
  {
    // Rotation Lock button
    // If VirtualButton driver loaded
    //   use VirtualButton driver
    // Else
    //   use GFX Driver.

    If (LAnd (LGreaterEqual (\OSYS, 2015), \_SB.HIDD.BTLD)) { //Win10 and Button Driver loaded. For HID event filter driver
      Or (\PB1E, 0x08, \PB1E) // Toggle Slate Status
      UPBT (CONVERTIBLE_BUTTON, Zero)
      Notify (\_SB.HIDD, 0xCC) // Notify HID Event Filter driver that the system is now in Slate/Tablet mode.
    } Else {
      \_SB.PC00.GFX0.IUEH (6) // Convertible Indicator lock
    }
  }
}

Disabling the intel_hid module simply prevents that HID event from propagating to the rest of the system here:
https://github.com/torvalds/linux/blob/ … 5C1-L502C2

static bool report_tablet_mode_event(struct input_dev *input_dev, u32 event)
{
	if (!input_dev)
		return false;

	switch (event) {
	case 0xcc:
		input_report_switch(input_dev, SW_TABLET_MODE, 1);
		input_sync(input_dev);
		return true;
	case 0xcd:
		input_report_switch(input_dev, SW_TABLET_MODE, 0);
		input_sync(input_dev);
		return true;
	default:
		return false;
	}
}

So there is some code sitting around somewhere else that's listening for that event and then turning off the keyboard/trackpad. libinput perhaps?

Windows documentation for tablet mode (which uses exactly the same HID signal called PNP0C60) seems to imply that hardware should **always report mode change events, but always ask the user to confirm**, which is not happening here:
https://learn.microsoft.com/en-us/windo … /continuum

OEMs can report hardware transitions (for example, transformation of 2-in-1 device from clamshell to tablet and vice versa), enabling automatic switching between the two modes. However, a key promise of tablet mode is that the user remains in control of their experience at all times, so these hardware transitions are surfaced through a toast prompt that must be confirmed by the user. Users also have the option to set the default response.

Anyway, it's clear now that something higher in the stack is just making a bad decision about what to do when it sees this tablet mode HID event, and automatically disabling the keyboard/touchpad. If anyone has any ideas, I'm all ears.

Last edited by jmole (2024-04-12 20:46:25)

Offline

#4 2024-04-12 23:19:42

seth
Member
Registered: 2012-09-03
Posts: 52,218

Re: Rotating my device disables the keyboard, how can I prevent this?

Anyway, it's clear now that something higher in the stack is just making a bad decision about what to do when it sees this tablet mode HID event, and automatically disabling the keyboard/touchpad. If anyone has any ideas, I'm all ears.

screen rotation lock in GNOME

https://gitlab.gnome.org/GNOME/mutter/- … te_1864387

Offline

#5 2024-04-13 04:17:08

jmole
Member
Registered: 2024-04-11
Posts: 3

Re: Rotating my device disables the keyboard, how can I prevent this?

seth wrote:

Seems like a big can of worms that I don't want to deal with.

I wrote a quick program to let me switch into tablet mode with a hotkey, so I can leave the intel_hid module disabled for now and not have to deal with the bad decision that HP made with their BIOS. Seems like it might solve some of the other problems those folks are dealing with: https://gitlab.com/jmole/tablet-mode-hotkey

Offline

Board footer

Powered by FluxBB