All of lore.kernel.org
 help / color / mirror / Atom feed
From: Armin Wolf <W_Armin@gmx.de>
To: Andrew Kallmeyer <kallmeyeras@gmail.com>
Cc: Maximilian Luz <luzmaximilian@gmail.com>,
	platform-driver-x86@vger.kernel.org
Subject: Re: ideapad_laptop tablet mode toggle detection
Date: Mon, 6 Mar 2023 02:41:40 +0100	[thread overview]
Message-ID: <e00df016-5ff1-3e5a-cffc-ab79672a2d7f@gmx.de> (raw)
In-Reply-To: <2181c5de-44d6-aebd-52ba-63d9fabd620c@gmx.de>

Am 06.03.23 um 02:26 schrieb Armin Wolf:

> Am 05.03.23 um 23:59 schrieb Andrew Kallmeyer:
>
>> On Sun, Mar 5, 2023 at 1:40 PM Armin Wolf <W_Armin@gmx.de> wrote:
>>> Hi,
>>>
>>> could it be that bit 5 is set to disable the touchpad when the
>>> device switches
>>> to tablet mode? I suspect that the query handler does the following:
>>> 1. Notify VPC0 to disable the touchpad.
>>> 2. Notify ACPI WMI, which does submit the necessary scancode for
>>> switching to tablet mode.
>> I think you're right about this notification being for the touchpad,
>> although at least on my machine
>> there is no other touchpad switch. So this is identical for my machine
>> specifically. In this function
>> from the decompiled ACPI dump you can see VCP0 and WM00 notified:
>>
>> Method (_Q44, 0, NotSerialized)  // _Qxx: EC Query, xx=0x00-0xFF
>> {
>>     P80B = 0x44
>>     Notify (VPC0, 0x80) // Status Change
>>     WEID = 0xF4
>>     Notify (WM00, 0x80) // Status Change
>> }
>>
>> This WM00 device sounds like the WMI you're talking about, however I'm
>> getting those errors
>> about this device not existing in journalctl still. I was asking
>> before about how to create this
>> missing device but it's not clear to me if that is possible.
>>
>> kernel: ACPI BIOS Error (bug): Could not resolve symbol
>> [\_SB.PC00.LPCB.EC0._Q44.WM00], AE_NOT_FOUND
>>
>> I searched in my .dsl files from the acpidump and wasn't able to find
>> any of the 3 ideapad_wmi_ids
>> listed in the driver. Maybe you have an idea of how to interface with
>> this missing WM00 object though.
>
> I was combing through the ACPI DSDT table inside the acpidump you
> provided,
> and i found serveral PNP0C14 devices, which hold WMI methods, events
> and data.
>
> The WMI GUIDs are encoded inside the associated _WDG buffers, you
> should therefore
> only grep for parts of the GUIDs.
> For example: GUID 06129D99-6083-4164-81AD-F092F9D773A6 -> grep "0xF0,
> 0x92"
>
> When feeding the content of the buffers named WQxx to the bmfdec
> utility, i was able
> to extract a description of each WMI object.
>
> On of which (WMIY) is handling the "Lenovo Yoga Mode", which seems to
> handle the tablet
> mode transitions. The MOF data is:
>
> [WMI, Dynamic, Provider("WmiProv"), Locale("MS\\0x409"),
> Description("Lenovo Yoga Mode Change Event"),
> guid("{06129D99-6083-4164-81AD-F092F9D773A6}")]
> class LENOVO_GSENSOR_EVENT : WMIEvent {
>   [key, read] string InstanceName;
>   [read] boolean Active;
>   [WmiDataId(1), read, Description("Lenovo Yoga Mode Change Event")]
> uint32 ModeDataVal;
> };
>
> [WMI, Dynamic, Provider("WmiProv"), Locale("MS\\0x409"),
> Description("LENOVO_GSENSOR_DATA class"),
> guid("{09B0EE6E-C3FD-4243-8DA1-7911FF80BB8C}")]
> class LENOVO_GSENSOR_DATA {
>   [key, read] string InstanceName;
>   [read] boolean Active;
>
>   [WmiMethodId(1), Implemented, Description("Mode Data")] void
> GetUsageMode([out, Description("Mode Data")] uint32 Data);
>   [WmiMethodId(2), Implemented, Description("Get Xaxis Value")] void
> GetXaxisValue([out, Description("Get Xaxis Value")] uint32 Data);
>   [WmiMethodId(3), Implemented, Description("Get Yaxis Value")] void
> GetYaxisValue([out, Description("Get Yaxis Value")] uint32 Data);
>   [WmiMethodId(4), Implemented, Description("Get Zaxis Value")] void
> GetZaxisValue([out, Description("Get Zaxis Value")] uint32 Data);
>   [WmiMethodId(5), Implemented, Description("Base to Ground")] void
> GetAngle4Value([out, Description("Base to Ground")] uint32 Data);
>   [WmiMethodId(6), Implemented, Description("Screen to Ground")] void
> GetAngle5Value([out, Description("Screen to Ground")] uint32 Data);
>   [WmiMethodId(7), Implemented, Description("Screen to Base")] void
> GetAngle6Value([out, Description("Screen to Base")] uint32 Data);
> };
>
> While looking at _WED (used to get ModeDataVal) and WMAB (handles
> method calls on LENOVO_GSENSOR_DATA),
> i assume that  only the first method (GetUsageMode) is implemented,
> and that ModeDataVal is used to tell
> which value of LENOVO_GSENSOR_DATA has changed (hardwired to 1 on your
> device).
>
> Maybe you can write a wmi driver which handles both WMI objects, so
> that you can find out what the values
> returned by GetUsageMode mean. With a bit of luck, you can use this to
> implement tablet mode toggle detection.
>
> BTW, what is the name of your notebook model?
>
> Armin Wolf
>
Well, it turns out i totally forgot that there exists already a patch which adds support for this:
https://patchwork.kernel.org/project/platform-driver-x86/patch/20221004214332.35934-1-soyer@irl.hu/

Maybe you can get this patch into shape and submit it again?

Armin Wolf

>>> Could you provide the output of "acpidump"? Because i suspect that
>>> the virtual key handling
>>> is done using ACPI WMI, as many modern devices are using this
>>> approach. In this case, you
>>> could experiment with ideapad_wmi_notify(), and maybe take a look at
>>> ideapad_wmi_ids[].
>>>
>>> Armin Wolf
>> Here is the raw acpidump output:
>> https://la.ask.systems/temp/acpidump.out
>>
>> - Andrew

  parent reply	other threads:[~2023-03-06  1:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01  4:45 ideapad_laptop tablet mode toggle detection Andrew Kallmeyer
2023-03-04  5:46 ` Andrew Kallmeyer
2023-03-04 20:14   ` Maximilian Luz
2023-03-04 21:37     ` Armin Wolf
2023-03-05  5:42       ` Andrew Kallmeyer
2023-03-05 21:40         ` Armin Wolf
2023-03-05 22:59           ` Andrew Kallmeyer
2023-03-06  1:26             ` Armin Wolf
2023-03-06  1:41               ` Andrew Kallmeyer
2023-03-06  1:58                 ` Armin Wolf
2023-03-06  1:41               ` Armin Wolf [this message]
2023-03-06  8:38                 ` Hans de Goede
2023-03-08  5:14                   ` Andrew Kallmeyer
2023-03-08  5:21                     ` Andrew Kallmeyer
2023-03-08 10:13                     ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e00df016-5ff1-3e5a-cffc-ab79672a2d7f@gmx.de \
    --to=w_armin@gmx.de \
    --cc=kallmeyeras@gmail.com \
    --cc=luzmaximilian@gmail.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.