diff mbox

platform/x86: dell-wmi: Add an event created by Dell Latitude 5495

Message ID 1513654714-32175-1-git-send-email-sylee@canonical.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Shih-Yuan Lee (FourDollars) Dec. 19, 2017, 3:38 a.m. UTC
The Dell Latitude 5495 has the mic mute key.

Signed-off-by: Shih-Yuan Lee (FourDollars) <sylee@canonical.com>
---
 drivers/platform/x86/dell-wmi.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Pali Rohár Dec. 19, 2017, 8:34 a.m. UTC | #1
On Tuesday 19 December 2017 11:38:34 Shih-Yuan Lee (FourDollars) wrote:
> The Dell Latitude 5495 has the mic mute key.
> 
> Signed-off-by: Shih-Yuan Lee (FourDollars) <sylee@canonical.com>
> ---
>  drivers/platform/x86/dell-wmi.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
> index fb25b20..d40f803 100644
> --- a/drivers/platform/x86/dell-wmi.c
> +++ b/drivers/platform/x86/dell-wmi.c
> @@ -261,6 +261,9 @@ static const u16 bios_to_linux_keycode[256] = {
>   * override them.
>   */
>  static const struct key_entry dell_wmi_keymap_type_0010[] = {
> +	/* Mic mute */
> +	{ KE_KEY, 0x150, { KEY_F20 } },

Hi! Are you sure that this key code needs to be in 0010 table? Because
primary this table is constructed from DMI information. See
array bios_to_linux_keycode[].

> +
>  	/* Fn-lock */
>  	{ KE_IGNORE, 0x151, { KEY_RESERVED } },
>
Pali Rohár Dec. 19, 2017, 8:41 a.m. UTC | #2
On Tuesday 19 December 2017 16:38:32 Shih-Yuan Lee (FourDollars) wrote:
> On Tue, Dec 19, 2017 at 4:34 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> 
> > On Tuesday 19 December 2017 11:38:34 Shih-Yuan Lee (FourDollars) wrote:
> > > The Dell Latitude 5495 has the mic mute key.
> > >
> > > Signed-off-by: Shih-Yuan Lee (FourDollars) <sylee@canonical.com>
> > > ---
> > >  drivers/platform/x86/dell-wmi.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/drivers/platform/x86/dell-wmi.c
> > b/drivers/platform/x86/dell-wmi.c
> > > index fb25b20..d40f803 100644
> > > --- a/drivers/platform/x86/dell-wmi.c
> > > +++ b/drivers/platform/x86/dell-wmi.c
> > > @@ -261,6 +261,9 @@ static const u16 bios_to_linux_keycode[256] = {
> > >   * override them.
> > >   */
> > >  static const struct key_entry dell_wmi_keymap_type_0010[] = {
> > > +     /* Mic mute */
> > > +     { KE_KEY, 0x150, { KEY_F20 } },
> >
> > Hi! Are you sure that this key code needs to be in 0010 table? Because
> > primary this table is constructed from DMI information. See
> > array bios_to_linux_keycode[].
> >
> Because I saw "dell_wmi: Unknown key with type 0x0010 and code 0x0150
> pressed" in dmesg when pressing the mic mute key.

And do you see following message?
"firmware scancode 0x%x maps to unrecognized keycode 0x%x\n"

> >
> > > +
> > >       /* Fn-lock */
> > >       { KE_IGNORE, 0x151, { KEY_RESERVED } },
> > >
> >
> > --
> > Pali Rohár
> > pali.rohar@gmail.com
> >
> 
> 
>
Shih-Yuan Lee (FourDollars) Dec. 19, 2017, 8:45 a.m. UTC | #3
On Tue, Dec 19, 2017 at 4:41 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> On Tuesday 19 December 2017 16:38:32 Shih-Yuan Lee (FourDollars) wrote:
>> On Tue, Dec 19, 2017 at 4:34 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
>>
>> > On Tuesday 19 December 2017 11:38:34 Shih-Yuan Lee (FourDollars) wrote:
>> > > The Dell Latitude 5495 has the mic mute key.
>> > >
>> > > Signed-off-by: Shih-Yuan Lee (FourDollars) <sylee@canonical.com>
>> > > ---
>> > >  drivers/platform/x86/dell-wmi.c | 3 +++
>> > >  1 file changed, 3 insertions(+)
>> > >
>> > > diff --git a/drivers/platform/x86/dell-wmi.c
>> > b/drivers/platform/x86/dell-wmi.c
>> > > index fb25b20..d40f803 100644
>> > > --- a/drivers/platform/x86/dell-wmi.c
>> > > +++ b/drivers/platform/x86/dell-wmi.c
>> > > @@ -261,6 +261,9 @@ static const u16 bios_to_linux_keycode[256] = {
>> > >   * override them.
>> > >   */
>> > >  static const struct key_entry dell_wmi_keymap_type_0010[] = {
>> > > +     /* Mic mute */
>> > > +     { KE_KEY, 0x150, { KEY_F20 } },
>> >
>> > Hi! Are you sure that this key code needs to be in 0010 table? Because
>> > primary this table is constructed from DMI information. See
>> > array bios_to_linux_keycode[].
>> >
>> Because I saw "dell_wmi: Unknown key with type 0x0010 and code 0x0150
>> pressed" in dmesg when pressing the mic mute key.
>
> And do you see following message?
> "firmware scancode 0x%x maps to unrecognized keycode 0x%x\n"
No, do I put some specific kernel parameter to see it?
>
>> >
>> > > +
>> > >       /* Fn-lock */
>> > >       { KE_IGNORE, 0x151, { KEY_RESERVED } },
>> > >
>> >
>> > --
>> > Pali Rohár
>> > pali.rohar@gmail.com
>> >
>>
>>
>>
>
> --
> Pali Rohár
> pali.rohar@gmail.com
Pali Rohár Dec. 19, 2017, 9 a.m. UTC | #4
On Tuesday 19 December 2017 16:45:44 Shih-Yuan Lee (FourDollars) wrote:
> On Tue, Dec 19, 2017 at 4:41 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> > On Tuesday 19 December 2017 16:38:32 Shih-Yuan Lee (FourDollars) wrote:
> >> On Tue, Dec 19, 2017 at 4:34 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> >>
> >> > On Tuesday 19 December 2017 11:38:34 Shih-Yuan Lee (FourDollars) wrote:
> >> > > The Dell Latitude 5495 has the mic mute key.
> >> > >
> >> > > Signed-off-by: Shih-Yuan Lee (FourDollars) <sylee@canonical.com>
> >> > > ---
> >> > >  drivers/platform/x86/dell-wmi.c | 3 +++
> >> > >  1 file changed, 3 insertions(+)
> >> > >
> >> > > diff --git a/drivers/platform/x86/dell-wmi.c
> >> > b/drivers/platform/x86/dell-wmi.c
> >> > > index fb25b20..d40f803 100644
> >> > > --- a/drivers/platform/x86/dell-wmi.c
> >> > > +++ b/drivers/platform/x86/dell-wmi.c
> >> > > @@ -261,6 +261,9 @@ static const u16 bios_to_linux_keycode[256] = {
> >> > >   * override them.
> >> > >   */
> >> > >  static const struct key_entry dell_wmi_keymap_type_0010[] = {
> >> > > +     /* Mic mute */
> >> > > +     { KE_KEY, 0x150, { KEY_F20 } },
> >> >
> >> > Hi! Are you sure that this key code needs to be in 0010 table? Because
> >> > primary this table is constructed from DMI information. See
> >> > array bios_to_linux_keycode[].
> >> >
> >> Because I saw "dell_wmi: Unknown key with type 0x0010 and code 0x0150
> >> pressed" in dmesg when pressing the mic mute key.
> >
> > And do you see following message?
> > "firmware scancode 0x%x maps to unrecognized keycode 0x%x\n"
> No, do I put some specific kernel parameter to see it?

It is print in same way as above Unknown key with type ...
Shih-Yuan Lee (FourDollars) Dec. 19, 2017, 9:02 a.m. UTC | #5
On Tue, Dec 19, 2017 at 5:00 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> On Tuesday 19 December 2017 16:45:44 Shih-Yuan Lee (FourDollars) wrote:
>> On Tue, Dec 19, 2017 at 4:41 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
>> > On Tuesday 19 December 2017 16:38:32 Shih-Yuan Lee (FourDollars) wrote:
>> >> On Tue, Dec 19, 2017 at 4:34 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
>> >>
>> >> > On Tuesday 19 December 2017 11:38:34 Shih-Yuan Lee (FourDollars) wrote:
>> >> > > The Dell Latitude 5495 has the mic mute key.
>> >> > >
>> >> > > Signed-off-by: Shih-Yuan Lee (FourDollars) <sylee@canonical.com>
>> >> > > ---
>> >> > >  drivers/platform/x86/dell-wmi.c | 3 +++
>> >> > >  1 file changed, 3 insertions(+)
>> >> > >
>> >> > > diff --git a/drivers/platform/x86/dell-wmi.c
>> >> > b/drivers/platform/x86/dell-wmi.c
>> >> > > index fb25b20..d40f803 100644
>> >> > > --- a/drivers/platform/x86/dell-wmi.c
>> >> > > +++ b/drivers/platform/x86/dell-wmi.c
>> >> > > @@ -261,6 +261,9 @@ static const u16 bios_to_linux_keycode[256] = {
>> >> > >   * override them.
>> >> > >   */
>> >> > >  static const struct key_entry dell_wmi_keymap_type_0010[] = {
>> >> > > +     /* Mic mute */
>> >> > > +     { KE_KEY, 0x150, { KEY_F20 } },
>> >> >
>> >> > Hi! Are you sure that this key code needs to be in 0010 table? Because
>> >> > primary this table is constructed from DMI information. See
>> >> > array bios_to_linux_keycode[].
>> >> >
>> >> Because I saw "dell_wmi: Unknown key with type 0x0010 and code 0x0150
>> >> pressed" in dmesg when pressing the mic mute key.
>> >
>> > And do you see following message?
>> > "firmware scancode 0x%x maps to unrecognized keycode 0x%x\n"
>> No, do I put some specific kernel parameter to see it?
>
> It is print in same way as above Unknown key with type ...
OK, I saw "dell_wmi: Unknown key with type 0x0010 and code 0x0150 pressed".
There is no "firmware scancode 0x%x maps to unrecognized keycode 0x%x\n" at all.
Pali Rohár Dec. 19, 2017, 9:06 a.m. UTC | #6
On Tuesday 19 December 2017 17:02:52 Shih-Yuan Lee (FourDollars) wrote:
> On Tue, Dec 19, 2017 at 5:00 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> > On Tuesday 19 December 2017 16:45:44 Shih-Yuan Lee (FourDollars) wrote:
> >> On Tue, Dec 19, 2017 at 4:41 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> >> > On Tuesday 19 December 2017 16:38:32 Shih-Yuan Lee (FourDollars) wrote:
> >> >> On Tue, Dec 19, 2017 at 4:34 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> >> >>
> >> >> > On Tuesday 19 December 2017 11:38:34 Shih-Yuan Lee (FourDollars) wrote:
> >> >> > > The Dell Latitude 5495 has the mic mute key.
> >> >> > >
> >> >> > > Signed-off-by: Shih-Yuan Lee (FourDollars) <sylee@canonical.com>
> >> >> > > ---
> >> >> > >  drivers/platform/x86/dell-wmi.c | 3 +++
> >> >> > >  1 file changed, 3 insertions(+)
> >> >> > >
> >> >> > > diff --git a/drivers/platform/x86/dell-wmi.c
> >> >> > b/drivers/platform/x86/dell-wmi.c
> >> >> > > index fb25b20..d40f803 100644
> >> >> > > --- a/drivers/platform/x86/dell-wmi.c
> >> >> > > +++ b/drivers/platform/x86/dell-wmi.c
> >> >> > > @@ -261,6 +261,9 @@ static const u16 bios_to_linux_keycode[256] = {
> >> >> > >   * override them.
> >> >> > >   */
> >> >> > >  static const struct key_entry dell_wmi_keymap_type_0010[] = {
> >> >> > > +     /* Mic mute */
> >> >> > > +     { KE_KEY, 0x150, { KEY_F20 } },
> >> >> >
> >> >> > Hi! Are you sure that this key code needs to be in 0010 table? Because
> >> >> > primary this table is constructed from DMI information. See
> >> >> > array bios_to_linux_keycode[].
> >> >> >
> >> >> Because I saw "dell_wmi: Unknown key with type 0x0010 and code 0x0150
> >> >> pressed" in dmesg when pressing the mic mute key.
> >> >
> >> > And do you see following message?
> >> > "firmware scancode 0x%x maps to unrecognized keycode 0x%x\n"
> >> No, do I put some specific kernel parameter to see it?
> >
> > It is print in same way as above Unknown key with type ...
> OK, I saw "dell_wmi: Unknown key with type 0x0010 and code 0x0150 pressed".
> There is no "firmware scancode 0x%x maps to unrecognized keycode 0x%x\n" at all.

Ok, then adding additional entry is needed.
Pali Rohár Dec. 19, 2017, 9:06 a.m. UTC | #7
On Tuesday 19 December 2017 11:38:34 Shih-Yuan Lee (FourDollars) wrote:
> The Dell Latitude 5495 has the mic mute key.
> 
> Signed-off-by: Shih-Yuan Lee (FourDollars) <sylee@canonical.com>
> ---
>  drivers/platform/x86/dell-wmi.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
> index fb25b20..d40f803 100644
> --- a/drivers/platform/x86/dell-wmi.c
> +++ b/drivers/platform/x86/dell-wmi.c
> @@ -261,6 +261,9 @@ static const u16 bios_to_linux_keycode[256] = {
>   * override them.
>   */
>  static const struct key_entry dell_wmi_keymap_type_0010[] = {
> +	/* Mic mute */
> +	{ KE_KEY, 0x150, { KEY_F20 } },

Why F20 for mic mute? We have KEY_MICMUTE.

> +
>  	/* Fn-lock */
>  	{ KE_IGNORE, 0x151, { KEY_RESERVED } },
>
Shih-Yuan Lee (FourDollars) Dec. 19, 2017, 9:17 a.m. UTC | #8
n Tue, Dec 19, 2017 at 5:06 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> On Tuesday 19 December 2017 11:38:34 Shih-Yuan Lee (FourDollars) wrote:
>> The Dell Latitude 5495 has the mic mute key.
>>
>> Signed-off-by: Shih-Yuan Lee (FourDollars) <sylee@canonical.com>
>> ---
>>  drivers/platform/x86/dell-wmi.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
>> index fb25b20..d40f803 100644
>> --- a/drivers/platform/x86/dell-wmi.c
>> +++ b/drivers/platform/x86/dell-wmi.c
>> @@ -261,6 +261,9 @@ static const u16 bios_to_linux_keycode[256] = {
>>   * override them.
>>   */
>>  static const struct key_entry dell_wmi_keymap_type_0010[] = {
>> +     /* Mic mute */
>> +     { KE_KEY, 0x150, { KEY_F20 } },
>
> Why F20 for mic mute? We have KEY_MICMUTE.
Because X Window System doesn't support KEY_MICMUTE [1] directly, it
still relies on systemd/udev rule [2] to convert it to KEY_F20 again
in the user space.
So I am also wondering why not using KEY_F20 directly and I am also
thinking about changing the bios_to_linux_keycode's KEY_MICMUTE to
KEY_F20 for compatibility.

[1]: https://bugs.freedesktop.org/show_bug.cgi?id=54171
[2]: https://github.com/systemd/systemd/commit/fc6e082622c73eb9a22ce16a278d8c4dd7594cbb
>
>> +
>>       /* Fn-lock */
>>       { KE_IGNORE, 0x151, { KEY_RESERVED } },
>>
>
> --
> Pali Rohár
> pali.rohar@gmail.com
Pali Rohár Dec. 19, 2017, 9:33 a.m. UTC | #9
On Tuesday 19 December 2017 17:17:24 Shih-Yuan Lee (FourDollars) wrote:
> n Tue, Dec 19, 2017 at 5:06 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> > On Tuesday 19 December 2017 11:38:34 Shih-Yuan Lee (FourDollars) wrote:
> >> The Dell Latitude 5495 has the mic mute key.
> >>
> >> Signed-off-by: Shih-Yuan Lee (FourDollars) <sylee@canonical.com>
> >> ---
> >>  drivers/platform/x86/dell-wmi.c | 3 +++
> >>  1 file changed, 3 insertions(+)
> >>
> >> diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
> >> index fb25b20..d40f803 100644
> >> --- a/drivers/platform/x86/dell-wmi.c
> >> +++ b/drivers/platform/x86/dell-wmi.c
> >> @@ -261,6 +261,9 @@ static const u16 bios_to_linux_keycode[256] = {
> >>   * override them.
> >>   */
> >>  static const struct key_entry dell_wmi_keymap_type_0010[] = {
> >> +     /* Mic mute */
> >> +     { KE_KEY, 0x150, { KEY_F20 } },
> >
> > Why F20 for mic mute? We have KEY_MICMUTE.
> Because X Window System doesn't support KEY_MICMUTE [1] directly,

This is not an argument why adding hacks into kernel code. If one
userspace application is buggy and cannot handle new key code (e.g.
KEY_MICMUTE), then userspace application needs to be fixed.

There are also other userspace applications which uses input devices.

> it
> still relies on systemd/udev rule [2] to convert it to KEY_F20 again
> in the user space.

That sounds like another bug which should be fixed. Translating correct
key to incorrect one is a bad idea.

> So I am also wondering why not using KEY_F20 directly and I am also
> thinking about changing the bios_to_linux_keycode's KEY_MICMUTE to
> KEY_F20 for compatibility.

NACK. This does not make sense as we already have a key code for mic
mute. KEY_MICMUTE was created specially for mic mute key and KEY_F20 for
F20 key. Those are two different keys.

Also such change would be regression for all applications which expects
KEY_MICMUTE for mic mute key.

> [1]: https://bugs.freedesktop.org/show_bug.cgi?id=54171
> [2]: https://github.com/systemd/systemd/commit/fc6e082622c73eb9a22ce16a278d8c4dd7594cbb
> >
> >> +
> >>       /* Fn-lock */
> >>       { KE_IGNORE, 0x151, { KEY_RESERVED } },
> >>
> >
> > --
> > Pali Rohár
> > pali.rohar@gmail.com
Shih-Yuan Lee (FourDollars) Dec. 19, 2017, 9:38 a.m. UTC | #10
On Tue, Dec 19, 2017 at 5:33 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> On Tuesday 19 December 2017 17:17:24 Shih-Yuan Lee (FourDollars) wrote:
>> n Tue, Dec 19, 2017 at 5:06 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
>> > On Tuesday 19 December 2017 11:38:34 Shih-Yuan Lee (FourDollars) wrote:
>> >> The Dell Latitude 5495 has the mic mute key.
>> >>
>> >> Signed-off-by: Shih-Yuan Lee (FourDollars) <sylee@canonical.com>
>> >> ---
>> >>  drivers/platform/x86/dell-wmi.c | 3 +++
>> >>  1 file changed, 3 insertions(+)
>> >>
>> >> diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
>> >> index fb25b20..d40f803 100644
>> >> --- a/drivers/platform/x86/dell-wmi.c
>> >> +++ b/drivers/platform/x86/dell-wmi.c
>> >> @@ -261,6 +261,9 @@ static const u16 bios_to_linux_keycode[256] = {
>> >>   * override them.
>> >>   */
>> >>  static const struct key_entry dell_wmi_keymap_type_0010[] = {
>> >> +     /* Mic mute */
>> >> +     { KE_KEY, 0x150, { KEY_F20 } },
>> >
>> > Why F20 for mic mute? We have KEY_MICMUTE.
>> Because X Window System doesn't support KEY_MICMUTE [1] directly,
>
> This is not an argument why adding hacks into kernel code. If one
> userspace application is buggy and cannot handle new key code (e.g.
> KEY_MICMUTE), then userspace application needs to be fixed.
>
> There are also other userspace applications which uses input devices.
>
>> it
>> still relies on systemd/udev rule [2] to convert it to KEY_F20 again
>> in the user space.
>
> That sounds like another bug which should be fixed. Translating correct
> key to incorrect one is a bad idea.
>
>> So I am also wondering why not using KEY_F20 directly and I am also
>> thinking about changing the bios_to_linux_keycode's KEY_MICMUTE to
>> KEY_F20 for compatibility.
>
> NACK. This does not make sense as we already have a key code for mic
> mute. KEY_MICMUTE was created specially for mic mute key and KEY_F20 for
> F20 key. Those are two different keys.
>
> Also such change would be regression for all applications which expects
> KEY_MICMUTE for mic mute key.
OK. Let me send a different version for this patch.
>
>> [1]: https://bugs.freedesktop.org/show_bug.cgi?id=54171
>> [2]: https://github.com/systemd/systemd/commit/fc6e082622c73eb9a22ce16a278d8c4dd7594cbb
>> >
>> >> +
>> >>       /* Fn-lock */
>> >>       { KE_IGNORE, 0x151, { KEY_RESERVED } },
>> >>
>> >
>> > --
>> > Pali Rohár
>> > pali.rohar@gmail.com
>
> --
> Pali Rohár
> pali.rohar@gmail.com
diff mbox

Patch

diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
index fb25b20..d40f803 100644
--- a/drivers/platform/x86/dell-wmi.c
+++ b/drivers/platform/x86/dell-wmi.c
@@ -261,6 +261,9 @@  static const u16 bios_to_linux_keycode[256] = {
  * override them.
  */
 static const struct key_entry dell_wmi_keymap_type_0010[] = {
+	/* Mic mute */
+	{ KE_KEY, 0x150, { KEY_F20 } },
+
 	/* Fn-lock */
 	{ KE_IGNORE, 0x151, { KEY_RESERVED } },