2020-06-08 04:25:05

by Y Paritcher

[permalink] [raw]
Subject: [PATCH 1/3] platform/x86: dell-wmi: add new backlight events

Ignore events with a type of 0x0010 and a code of 0x57 / 0x58,
this silences the following messages being logged on a
Dell Inspiron 5593:

dell_wmi: Unknown key with type 0x0010 and code 0x0057 pressed
dell_wmi: Unknown key with type 0x0010 and code 0x0058 pressed

Signed-off-by: Y Paritcher <[email protected]>
---
drivers/platform/x86/dell-wmi.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
index c25a4286d766..0b4f72f923cd 100644
--- a/drivers/platform/x86/dell-wmi.c
+++ b/drivers/platform/x86/dell-wmi.c
@@ -252,6 +252,10 @@ static const struct key_entry dell_wmi_keymap_type_0010[] = {
/* Fn-lock switched to multimedia keys */
{ KE_IGNORE, 0x1, { KEY_RESERVED } },

+ /* Backlight brightness level */
+ { KE_KEY, 0x57, { KEY_BRIGHTNESSDOWN } },
+ { KE_KEY, 0x58, { KEY_BRIGHTNESSUP } },
+
/* Keyboard backlight change notification */
{ KE_IGNORE, 0x3f, { KEY_RESERVED } },

--
2.27.0


2020-06-08 08:37:16

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH 1/3] platform/x86: dell-wmi: add new backlight events

On Monday 08 June 2020 00:22:24 Y Paritcher wrote:
> Ignore events with a type of 0x0010 and a code of 0x57 / 0x58,
> this silences the following messages being logged on a
> Dell Inspiron 5593:
>
> dell_wmi: Unknown key with type 0x0010 and code 0x0057 pressed
> dell_wmi: Unknown key with type 0x0010 and code 0x0058 pressed
>
> Signed-off-by: Y Paritcher <[email protected]>
> ---
> drivers/platform/x86/dell-wmi.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
> index c25a4286d766..0b4f72f923cd 100644
> --- a/drivers/platform/x86/dell-wmi.c
> +++ b/drivers/platform/x86/dell-wmi.c
> @@ -252,6 +252,10 @@ static const struct key_entry dell_wmi_keymap_type_0010[] = {
> /* Fn-lock switched to multimedia keys */
> { KE_IGNORE, 0x1, { KEY_RESERVED } },
>
> + /* Backlight brightness level */
> + { KE_KEY, 0x57, { KEY_BRIGHTNESSDOWN } },
> + { KE_KEY, 0x58, { KEY_BRIGHTNESSUP } },
> +
> /* Keyboard backlight change notification */
> { KE_IGNORE, 0x3f, { KEY_RESERVED } },

Please, keep codes sorted.

>
> --
> 2.27.0
>

2020-06-08 15:35:38

by Mario Limonciello

[permalink] [raw]
Subject: RE: [PATCH 1/3] platform/x86: dell-wmi: add new backlight events

> -----Original Message-----
> From: [email protected] <platform-driver-x86-
> [email protected]> On Behalf Of Pali Roh?r
> Sent: Monday, June 8, 2020 3:35 AM
> To: Y Paritcher
> Cc: [email protected]; [email protected];
> Matthew Garrett
> Subject: Re: [PATCH 1/3] platform/x86: dell-wmi: add new backlight events
>
>
> [EXTERNAL EMAIL]
>
> On Monday 08 June 2020 00:22:24 Y Paritcher wrote:
> > Ignore events with a type of 0x0010 and a code of 0x57 / 0x58,
> > this silences the following messages being logged on a
> > Dell Inspiron 5593:
> >
> > dell_wmi: Unknown key with type 0x0010 and code 0x0057 pressed
> > dell_wmi: Unknown key with type 0x0010 and code 0x0058 pressed
> >
> > Signed-off-by: Y Paritcher <[email protected]>
> > ---
> > drivers/platform/x86/dell-wmi.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-
> wmi.c
> > index c25a4286d766..0b4f72f923cd 100644
> > --- a/drivers/platform/x86/dell-wmi.c
> > +++ b/drivers/platform/x86/dell-wmi.c
> > @@ -252,6 +252,10 @@ static const struct key_entry
> dell_wmi_keymap_type_0010[] = {
> > /* Fn-lock switched to multimedia keys */
> > { KE_IGNORE, 0x1, { KEY_RESERVED } },
> >
> > + /* Backlight brightness level */
> > + { KE_KEY, 0x57, { KEY_BRIGHTNESSDOWN } },
> > + { KE_KEY, 0x58, { KEY_BRIGHTNESSUP } },
> > +

For these particular events are they emitted by another interface as well in this
platform?

If so they should be KE_IGNORE so you don't end up with double notifications to
userspace.

> > /* Keyboard backlight change notification */
> > { KE_IGNORE, 0x3f, { KEY_RESERVED } },
>
> Please, keep codes sorted.
>
> >
> > --
> > 2.27.0
> >

2020-06-08 20:14:22

by Y Paritcher

[permalink] [raw]
Subject: Re: [PATCH 1/3] platform/x86: dell-wmi: add new backlight events

On 6/8/20 11:30 AM, [email protected] wrote:
>> -----Original Message-----
>> From: [email protected] <platform-driver-x86-
>> [email protected]> On Behalf Of Pali Rohár
>> Sent: Monday, June 8, 2020 3:35 AM
>> To: Y Paritcher
>> Cc: [email protected]; [email protected];
>> Matthew Garrett
>> Subject: Re: [PATCH 1/3] platform/x86: dell-wmi: add new backlight events
>>
>>
>> [EXTERNAL EMAIL]
>>
>> On Monday 08 June 2020 00:22:24 Y Paritcher wrote:
>>> Ignore events with a type of 0x0010 and a code of 0x57 / 0x58,
>>> this silences the following messages being logged on a
>>> Dell Inspiron 5593:
>>>
>>> dell_wmi: Unknown key with type 0x0010 and code 0x0057 pressed
>>> dell_wmi: Unknown key with type 0x0010 and code 0x0058 pressed
>>>
>>> Signed-off-by: Y Paritcher <[email protected]>
>>> ---
>>> drivers/platform/x86/dell-wmi.c | 4 ++++
>>> 1 file changed, 4 insertions(+)
>>>
>>> diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-
>> wmi.c
>>> index c25a4286d766..0b4f72f923cd 100644
>>> --- a/drivers/platform/x86/dell-wmi.c
>>> +++ b/drivers/platform/x86/dell-wmi.c
>>> @@ -252,6 +252,10 @@ static const struct key_entry
>> dell_wmi_keymap_type_0010[] = {
>>> /* Fn-lock switched to multimedia keys */
>>> { KE_IGNORE, 0x1, { KEY_RESERVED } },
>>>
>>> + /* Backlight brightness level */
>>> + { KE_KEY, 0x57, { KEY_BRIGHTNESSDOWN } },
>>> + { KE_KEY, 0x58, { KEY_BRIGHTNESSUP } },
>>> +
>
> For these particular events are they emitted by another interface as well in this
> platform?
>
> If so they should be KE_IGNORE so you don't end up with double notifications to
> userspace.
Thank you both for the review,
This is my first patch so if i am doing something wrong please let me know.

Both before and after this change they are only emitted once (verified via showkeys)
this is because `dell_wmi_process_key()` calls `acpi_video_handles_brightness_key_presses()`
for brightness events, and `acpi_video_handles_brightness_key_presses()` makes sure no duplicate acpi-video events are sent.
>
>>> /* Keyboard backlight change notification */
>>> { KE_IGNORE, 0x3f, { KEY_RESERVED } },
>>
>> Please, keep codes sorted.

Will fix
>>
>>>
>>> --
>>> 2.27.0
>>>

2020-06-08 20:19:29

by Mario Limonciello

[permalink] [raw]
Subject: RE: [PATCH 1/3] platform/x86: dell-wmi: add new backlight events

> -----Original Message-----
> From: Y Paritcher <[email protected]>
> Sent: Monday, June 8, 2020 3:12 PM
> To: Limonciello, Mario; [email protected]
> Cc: [email protected]; [email protected];
> [email protected]
> Subject: Re: [PATCH 1/3] platform/x86: dell-wmi: add new backlight events
>
>
> [EXTERNAL EMAIL]
>
> On 6/8/20 11:30 AM, [email protected] wrote:
> >> -----Original Message-----
> >> From: [email protected] <platform-driver-x86-
> >> [email protected]> On Behalf Of Pali Rohár
> >> Sent: Monday, June 8, 2020 3:35 AM
> >> To: Y Paritcher
> >> Cc: [email protected]; [email protected];
> >> Matthew Garrett
> >> Subject: Re: [PATCH 1/3] platform/x86: dell-wmi: add new backlight
> events
> >>
> >>
> >> [EXTERNAL EMAIL]
> >>
> >> On Monday 08 June 2020 00:22:24 Y Paritcher wrote:
> >>> Ignore events with a type of 0x0010 and a code of 0x57 / 0x58,
> >>> this silences the following messages being logged on a
> >>> Dell Inspiron 5593:
> >>>
> >>> dell_wmi: Unknown key with type 0x0010 and code 0x0057 pressed
> >>> dell_wmi: Unknown key with type 0x0010 and code 0x0058 pressed
> >>>
> >>> Signed-off-by: Y Paritcher <[email protected]>
> >>> ---
> >>> drivers/platform/x86/dell-wmi.c | 4 ++++
> >>> 1 file changed, 4 insertions(+)
> >>>
> >>> diff --git a/drivers/platform/x86/dell-wmi.c
> b/drivers/platform/x86/dell-
> >> wmi.c
> >>> index c25a4286d766..0b4f72f923cd 100644
> >>> --- a/drivers/platform/x86/dell-wmi.c
> >>> +++ b/drivers/platform/x86/dell-wmi.c
> >>> @@ -252,6 +252,10 @@ static const struct key_entry
> >> dell_wmi_keymap_type_0010[] = {
> >>> /* Fn-lock switched to multimedia keys */
> >>> { KE_IGNORE, 0x1, { KEY_RESERVED } },
> >>>
> >>> + /* Backlight brightness level */
> >>> + { KE_KEY, 0x57, { KEY_BRIGHTNESSDOWN } },
> >>> + { KE_KEY, 0x58, { KEY_BRIGHTNESSUP } },
> >>> +
> >
> > For these particular events are they emitted by another interface as well
> in this
> > platform?
> >
> > If so they should be KE_IGNORE so you don't end up with double
> notifications to
> > userspace.
> Thank you both for the review,
> This is my first patch so if i am doing something wrong please let me know.
>
> Both before and after this change they are only emitted once (verified via
> showkeys)
> this is because `dell_wmi_process_key()` calls
> `acpi_video_handles_brightness_key_presses()`
> for brightness events, and `acpi_video_handles_brightness_key_presses()`
> makes sure no duplicate acpi-video events are sent.

That's good to hear that it also filters it, but my opinion is that dell-wmi.c
should also filter it. So just change KE_KEY to KE_IGNORE like the other events.

> >
> >>> /* Keyboard backlight change notification */
> >>> { KE_IGNORE, 0x3f, { KEY_RESERVED } },
> >>
> >> Please, keep codes sorted.
>
> Will fix
> >>
> >>>
> >>> --
> >>> 2.27.0
> >>>

2020-06-08 20:38:41

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH 1/3] platform/x86: dell-wmi: add new backlight events

On Monday 08 June 2020 20:14:15 [email protected] wrote:
> > >>> index c25a4286d766..0b4f72f923cd 100644
> > >>> --- a/drivers/platform/x86/dell-wmi.c
> > >>> +++ b/drivers/platform/x86/dell-wmi.c
> > >>> @@ -252,6 +252,10 @@ static const struct key_entry
> > >> dell_wmi_keymap_type_0010[] = {
> > >>> /* Fn-lock switched to multimedia keys */
> > >>> { KE_IGNORE, 0x1, { KEY_RESERVED } },
> > >>>
> > >>> + /* Backlight brightness level */
> > >>> + { KE_KEY, 0x57, { KEY_BRIGHTNESSDOWN } },
> > >>> + { KE_KEY, 0x58, { KEY_BRIGHTNESSUP } },
> > >>> +
> > >
> > > For these particular events are they emitted by another interface as well
> > in this
> > > platform?
> > >
> > > If so they should be KE_IGNORE so you don't end up with double
> > notifications to
> > > userspace.
> > Thank you both for the review,
> > This is my first patch so if i am doing something wrong please let me know.
> >
> > Both before and after this change they are only emitted once (verified via
> > showkeys)
> > this is because `dell_wmi_process_key()` calls
> > `acpi_video_handles_brightness_key_presses()`
> > for brightness events, and `acpi_video_handles_brightness_key_presses()`
> > makes sure no duplicate acpi-video events are sent.
>
> That's good to hear that it also filters it, but my opinion is that dell-wmi.c
> should also filter it. So just change KE_KEY to KE_IGNORE like the other events.

IIRC for other existing KEY_BRIGHTNESS* lines, KE_KEY/KE_IGNORE decision
is there just because kernel can be configured if ACPI layer would
handle them or not. And based on acpi_video_handles_brightness_key_presses()
function we know if ACPI layer processed these keys or not.

So in my opinion we should handle these new KEY_BRIGHTNESS* events in
the same way. So dell-wmi should process these events, but only in case
when ACPI layer did not processed them.

2020-06-08 20:40:38

by Mario Limonciello

[permalink] [raw]
Subject: RE: [PATCH 1/3] platform/x86: dell-wmi: add new backlight events

> -----Original Message-----
> From: Pali Roh?r <[email protected]>
> Sent: Monday, June 8, 2020 3:36 PM
> To: Limonciello, Mario
> Cc: [email protected]; [email protected]; platform-driver-
> [email protected]; [email protected]
> Subject: Re: [PATCH 1/3] platform/x86: dell-wmi: add new backlight events
>
>
> [EXTERNAL EMAIL]
>
> On Monday 08 June 2020 20:14:15 [email protected] wrote:
> > > >>> index c25a4286d766..0b4f72f923cd 100644
> > > >>> --- a/drivers/platform/x86/dell-wmi.c
> > > >>> +++ b/drivers/platform/x86/dell-wmi.c
> > > >>> @@ -252,6 +252,10 @@ static const struct key_entry
> > > >> dell_wmi_keymap_type_0010[] = {
> > > >>> /* Fn-lock switched to multimedia keys */
> > > >>> { KE_IGNORE, 0x1, { KEY_RESERVED } },
> > > >>>
> > > >>> + /* Backlight brightness level */
> > > >>> + { KE_KEY, 0x57, { KEY_BRIGHTNESSDOWN } },
> > > >>> + { KE_KEY, 0x58, { KEY_BRIGHTNESSUP } },
> > > >>> +
> > > >
> > > > For these particular events are they emitted by another interface as
> well
> > > in this
> > > > platform?
> > > >
> > > > If so they should be KE_IGNORE so you don't end up with double
> > > notifications to
> > > > userspace.
> > > Thank you both for the review,
> > > This is my first patch so if i am doing something wrong please let me
> know.
> > >
> > > Both before and after this change they are only emitted once (verified
> via
> > > showkeys)
> > > this is because `dell_wmi_process_key()` calls
> > > `acpi_video_handles_brightness_key_presses()`
> > > for brightness events, and
> `acpi_video_handles_brightness_key_presses()`
> > > makes sure no duplicate acpi-video events are sent.
> >
> > That's good to hear that it also filters it, but my opinion is that dell-
> wmi.c
> > should also filter it. So just change KE_KEY to KE_IGNORE like the other
> events.
>
> IIRC for other existing KEY_BRIGHTNESS* lines, KE_KEY/KE_IGNORE decision
> is there just because kernel can be configured if ACPI layer would
> handle them or not. And based on
> acpi_video_handles_brightness_key_presses()
> function we know if ACPI layer processed these keys or not.
>
> So in my opinion we should handle these new KEY_BRIGHTNESS* events in
> the same way. So dell-wmi should process these events, but only in case
> when ACPI layer did not processed them.

OK thanks, I wasn't aware of this decision elsewhere.