RE: Dell Vostro 3360 multimedia keys

Mario.Limonciello
2017-11-27T16:56:22Z

> -----Original Message-----
> From: Pali Rohár [mailto:pali.rohar@gmail.com]
> Sent: Tuesday, November 21, 2017 12:36 PM
> To: Oleksandr Natalenko <oleksandr@natalenko.name>
> Cc: Limonciello, Mario <Mario_Limonciello@Dell.com>; platform-driver-
> x86@vger.kernel.org; linux-kernel@vger.kernel.org; Matthew Garrett
> <mjg59@srcf.ucam.org>; Darren Hart <dvhart@infradead.org>; Andy Shevchenko
> <andy@infradead.org>; Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Subject: Re: Dell Vostro 3360 multimedia keys
>
> Hi!
>
> On Tuesday 21 November 2017 15:52:28 Oleksandr Natalenko wrote:
> > Hi, Pali et al.
> >
> > Answers go inline.
> >
> > On úterý 21. listopadu 2017 14:51:10 CET Pali Rohár wrote:
> > > What would happen if you enable wmi_requires_smbios_request?
> > > Nothing? And situation is exactly same?
> >
> > Yes, this is what I did with DMI quirk which enables
> > wmi_requires_smbios_request. Keys "1" and "2" behave the same, key
> > "3" gets reported via both atkbd and wmi (see my thoughts about this
> > key below).
>
> Ok, if wmi_requires_smbios_request is really doing nothing, then it
> should not be used. It enables some QSET feature in Dell SMM mode which
> is for 2 laptops.
>
> > > > + /* Dell Vostro 3360 combined keycode */
> > > > + { KE_KEY, 0xe0f1, { KEY_PROG1 } },
> > > > + { KE_KEY, 0xe0f2, { KEY_PROG2 } },
> > >
> > > What is purpose of those two keys? Does not linux kernel already
> > > have better description for them as KEY_PROG1 and KEY_PROG2?
> >
> > Well, I didn't find KEY_PROG1/KEY_PROG2 in 0000 table. Thus, I just
> > added them. Actually, since these keys have some icons drawn on
> > them, they have some designated purpose (most likely,
> > Windows-related), but I'd rather think of them as of custom
> > programmable keys without any specific function assigned.
>
> Looks like that Dell Vostro 3360 have this meaning for multimedia keys:
>
> first key: Mobility Center
> second key: Dell Support Center
> third key: Dell Instant Launch Manager
>
> (same as other Vostro laptops)

As I can tell the "Instant Launch" key is supposed to be emitted
both via WMI and scan code both.

Can you please check SMBIOS table 0xb1 offset 0x08? This is the misc
BIOS flags table. It's been used for a few other drivers for other purposes
too. I expect that bit 1 should be set. This should indicate that the system
supports instant launch manager button. You can use that to key off of for
deviating behavior.

As for why these two keys (first and second) seem to emit the same code,
keep in mind that these were machines from around the era of Windows Vista.
Microsoft had allowed applications to register tiles in the "mobility center".

Dell had an application at that time (Quickset) that would receive the WMI
events and register tiles in the mobility center. So the application could then
know to open up mobility center applet when it needed to from WMI request
or to launch another application if it needed to.

This has all obviously changed with newer versions of Windows.

I would recommend to have a separate function in dell-wmi driver for when
you see instant launch key in misc flags table and to allow looking at
extended buffer for these behaviors.

>
> But do not know what KEY_* are used on other Vostro laptops for those
> keys. It would be great to use same KEY_*...

These first two aren't intended to be generally mapped (as I described above).
I think for Linux you can map them if you desire by my above description.

>
> > > /* snip */
> > >
> > > > Third key (the one that is handled via PS/2 keyboard) produces
> > > > this in the
> > >
> > > > kernel buffer:
> > > / *snip */
> > >
> > > Seems you still have not configured keycode for your internal PS/2
> > > keyboard to make this key working. Use 'setkeycodes 60 <keycode>'
> > > as written in dmesg.
> >
> > Well, I've tried. The problem is that if I even configure this key
> > via setkeycodes, it doesn't work.
>
> Hm... why it does not work?
>
> CCing Dmitry, can you tell us what needs to be done to "active" key from
> AT Keyboard driver which prints following messages to dmesg?
>
> ===
> Nov 20 15:36:51 spock kernel: atkbd serio0: Unknown key pressed
> (translated set 2, code 0x60 on isa0060/serio0).
> Nov 20 15:36:51 spock kernel: atkbd serio0: Use 'setkeycodes 60
> <keycode>' to make it known.
> ===
>
> I was in impression that if we see such message in dmesg, then key is
> working fine...
>
> > evtest shows me "value 2" (the
> > same value is shown if I press and hold some ordinary key, like "A",
> > for instance) instead of 0 and/or 1. Looks like key press event is
> > not generated properly by this key via atkbd.
> >
> > That's why I think wmi_requires_smbios_request quirk must be
> > permanently enabled for this laptop, and 3rd key must be handled via
> > wmi (like two other keys), not via atkbd. And all atkbd events from
> > this key must be just suppressed via userspace.
>
> In dell-wmi we filter all key events which are also delivered via PS/2
> AT Keyboard driver. So filtering PS/2 keys instead of WMI is anti-design
> solution.
>
> --
> Pali Rohár
> pali.rohar@gmail.com