linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: hid-asus.c: Maps key 0x35 (display off) to KEY_SCREENLOCK
@ 2021-10-08 22:23 Vinícius Angiolucci Reis
  2021-10-19  9:17 ` Jiri Kosina
  2021-10-28 16:07 ` Dmitry Torokhov
  0 siblings, 2 replies; 9+ messages in thread
From: Vinícius Angiolucci Reis @ 2021-10-08 22:23 UTC (permalink / raw)
  To: jikos; +Cc: linux-input, linux-kernel, angiolucci

On Windows systems, ASUS laptops uses the "turn display off" key
(usually fn+f6) to turn both display and keyboard backlit off. On Linux
systems, this key has no effect at all since most desktop enviroments
don't deal with KEY_DISPLAY_OFF. By mapping it to KEY_SCREENLOCK
instead, would enable desktop environments to handle this key as a
screen lock intent from the user, out of the box.

Signed-off-by: Vinícius Angiolucci Reis <angiolucci@gmail.com>
---
 drivers/hid/hid-asus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index f3ecddc519ee..5d57214d8dee 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -854,7 +854,7 @@ static int asus_input_mapping(struct hid_device *hdev,
 		switch (usage->hid & HID_USAGE) {
 		case 0x10: asus_map_key_clear(KEY_BRIGHTNESSDOWN);	break;
 		case 0x20: asus_map_key_clear(KEY_BRIGHTNESSUP);		break;
-		case 0x35: asus_map_key_clear(KEY_DISPLAY_OFF);		break;
+		case 0x35: asus_map_key_clear(KEY_SCREENLOCK);		break;
 		case 0x6c: asus_map_key_clear(KEY_SLEEP);		break;
 		case 0x7c: asus_map_key_clear(KEY_MICMUTE);		break;
 		case 0x82: asus_map_key_clear(KEY_CAMERA);		break;
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] HID: hid-asus.c: Maps key 0x35 (display off) to KEY_SCREENLOCK
  2021-10-08 22:23 [PATCH] HID: hid-asus.c: Maps key 0x35 (display off) to KEY_SCREENLOCK Vinícius Angiolucci Reis
@ 2021-10-19  9:17 ` Jiri Kosina
  2021-10-28 16:07 ` Dmitry Torokhov
  1 sibling, 0 replies; 9+ messages in thread
From: Jiri Kosina @ 2021-10-19  9:17 UTC (permalink / raw)
  To: Vinícius Angiolucci Reis; +Cc: linux-input, linux-kernel, angiolucci

On Fri, 8 Oct 2021, Vinícius Angiolucci Reis wrote:

> On Windows systems, ASUS laptops uses the "turn display off" key
> (usually fn+f6) to turn both display and keyboard backlit off. On Linux
> systems, this key has no effect at all since most desktop enviroments
> don't deal with KEY_DISPLAY_OFF. By mapping it to KEY_SCREENLOCK
> instead, would enable desktop environments to handle this key as a
> screen lock intent from the user, out of the box.
> 
> Signed-off-by: Vinícius Angiolucci Reis <angiolucci@gmail.com>

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] HID: hid-asus.c: Maps key 0x35 (display off) to KEY_SCREENLOCK
  2021-10-08 22:23 [PATCH] HID: hid-asus.c: Maps key 0x35 (display off) to KEY_SCREENLOCK Vinícius Angiolucci Reis
  2021-10-19  9:17 ` Jiri Kosina
@ 2021-10-28 16:07 ` Dmitry Torokhov
  2021-11-05 15:16   ` Vinícius Reis
  1 sibling, 1 reply; 9+ messages in thread
From: Dmitry Torokhov @ 2021-10-28 16:07 UTC (permalink / raw)
  To: Vinícius Angiolucci Reis; +Cc: Jiri Kosina, linux-input, lkml, angiolucci

Hi Vinícius,

On Fri, Oct 8, 2021 at 3:24 PM Vinícius Angiolucci Reis
<itsme.vreis@gmail.com> wrote:
>
> On Windows systems, ASUS laptops uses the "turn display off" key
> (usually fn+f6) to turn both display and keyboard backlit off. On Linux
> systems, this key has no effect at all since most desktop enviroments
> don't deal with KEY_DISPLAY_OFF. By mapping it to KEY_SCREENLOCK
> instead, would enable desktop environments to handle this key as a
> screen lock intent from the user, out of the box.

But is it the intent of the user? The fact that current desktop
environments do not handle this key is not a reason to change kernel
behavior.

If screen lock is simply your preference then you can change the
mapping via udev on your system without the need to patch the kernel.

Thanks.

--
Dmitry

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] HID: hid-asus.c: Maps key 0x35 (display off) to KEY_SCREENLOCK
  2021-10-28 16:07 ` Dmitry Torokhov
@ 2021-11-05 15:16   ` Vinícius Reis
  2021-11-05 21:55     ` Dmitry Torokhov
  0 siblings, 1 reply; 9+ messages in thread
From: Vinícius Reis @ 2021-11-05 15:16 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Jiri Kosina, linux-input, lkml, angiolucci

Em qui., 28 de out. de 2021 às 13:07, Dmitry Torokhov
<dmitry.torokhov@gmail.com> escreveu:
>
> Hi Vinícius,
>
> On Fri, Oct 8, 2021 at 3:24 PM Vinícius Angiolucci Reis
> <itsme.vreis@gmail.com> wrote:
> >
> > On Windows systems, ASUS laptops uses the "turn display off" key
> > (usually fn+f6) to turn both display and keyboard backlit off. On Linux
> > systems, this key has no effect at all since most desktop enviroments
> > don't deal with KEY_DISPLAY_OFF. By mapping it to KEY_SCREENLOCK
> > instead, would enable desktop environments to handle this key as a
> > screen lock intent from the user, out of the box.
>
> But is it the intent of the user? The fact that current desktop
> environments do not handle this key is not a reason to change kernel
> behavior.
>
> If screen lock is simply your preference then you can change the
> mapping via udev on your system without the need to patch the kernel.
>
> Thanks.
>
> --
> Dmitry

(Sorry, I'm sending this response again because it seems the first
attempt didn't make it to the mailing lists for some reason.)

Hi Dmitry,

I've picked up this particular key event because it would trigger a close
behavior to the one seen on Windows. It is far from being my preference,
which would be an exact mimic of the Windows behavior (and can be
achieved by xset dpms force on/off from user space).

The idea of this patch is to improve the user experience, by giving that key a
behavior as close as possible to what users might experience on Windows.
Because most Linux desktop environments also turn the display off after
locking the screen, this would be a good approximation to what happens on
Windows. I think it is more about giving (consistent) behavior to it
than changing it.

I agree it is possible to control that via udev or something else. But
most regular
users won't be able to do that, ending up with an unused key, though.
The hardcore user that would prefer a very different key behavior
could keep using
udev to do that.

So IMHO I think that setting this up on the kernel would be a good
approach in this case.

Thanks.

Vinícius

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] HID: hid-asus.c: Maps key 0x35 (display off) to KEY_SCREENLOCK
  2021-11-05 15:16   ` Vinícius Reis
@ 2021-11-05 21:55     ` Dmitry Torokhov
  2021-11-06 23:48       ` Vinícius Reis
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Torokhov @ 2021-11-05 21:55 UTC (permalink / raw)
  To: Vinícius Reis; +Cc: Jiri Kosina, linux-input, lkml, angiolucci

On Fri, Nov 05, 2021 at 12:16:45PM -0300, Vinícius Reis wrote:
> Em qui., 28 de out. de 2021 às 13:07, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> escreveu:
> >
> > Hi Vinícius,
> >
> > On Fri, Oct 8, 2021 at 3:24 PM Vinícius Angiolucci Reis
> > <itsme.vreis@gmail.com> wrote:
> > >
> > > On Windows systems, ASUS laptops uses the "turn display off" key
> > > (usually fn+f6) to turn both display and keyboard backlit off. On Linux
> > > systems, this key has no effect at all since most desktop enviroments
> > > don't deal with KEY_DISPLAY_OFF. By mapping it to KEY_SCREENLOCK
> > > instead, would enable desktop environments to handle this key as a
> > > screen lock intent from the user, out of the box.
> >
> > But is it the intent of the user? The fact that current desktop
> > environments do not handle this key is not a reason to change kernel
> > behavior.
> >
> > If screen lock is simply your preference then you can change the
> > mapping via udev on your system without the need to patch the kernel.
> >
> > Thanks.
> >
> > --
> > Dmitry
> 
> (Sorry, I'm sending this response again because it seems the first
> attempt didn't make it to the mailing lists for some reason.)
> 
> Hi Dmitry,
> 
> I've picked up this particular key event because it would trigger a close
> behavior to the one seen on Windows. It is far from being my preference,
> which would be an exact mimic of the Windows behavior (and can be
> achieved by xset dpms force on/off from user space).
> 
> The idea of this patch is to improve the user experience, by giving that key a
> behavior as close as possible to what users might experience on Windows.
> Because most Linux desktop environments also turn the display off after
> locking the screen, this would be a good approximation to what happens on
> Windows. I think it is more about giving (consistent) behavior to it
> than changing it.
> 
> I agree it is possible to control that via udev or something else. But
> most regular
> users won't be able to do that, ending up with an unused key, though.
> The hardcore user that would prefer a very different key behavior
> could keep using
> udev to do that.
> 
> So IMHO I think that setting this up on the kernel would be a good
> approach in this case.

I am sorry, I disagree. I understand that patching the kernel might be
easier than implementing new shortcut/behavior in various desktop
environments, but that does not make it the right approach.

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] HID: hid-asus.c: Maps key 0x35 (display off) to KEY_SCREENLOCK
  2021-11-05 21:55     ` Dmitry Torokhov
@ 2021-11-06 23:48       ` Vinícius Reis
  2021-11-07  2:08         ` Dmitry Torokhov
  0 siblings, 1 reply; 9+ messages in thread
From: Vinícius Reis @ 2021-11-06 23:48 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Jiri Kosina, linux-input, lkml, angiolucci

Em sex., 5 de nov. de 2021 às 18:55, Dmitry Torokhov
<dmitry.torokhov@gmail.com> escreveu:
>
> On Fri, Nov 05, 2021 at 12:16:45PM -0300, Vinícius Reis wrote:
> > Em qui., 28 de out. de 2021 às 13:07, Dmitry Torokhov
> > <dmitry.torokhov@gmail.com> escreveu:
> > >
> > > Hi Vinícius,
> > >
> > > On Fri, Oct 8, 2021 at 3:24 PM Vinícius Angiolucci Reis
> > > <itsme.vreis@gmail.com> wrote:
> > > >
> > > > On Windows systems, ASUS laptops uses the "turn display off" key
> > > > (usually fn+f6) to turn both display and keyboard backlit off. On Linux
> > > > systems, this key has no effect at all since most desktop enviroments
> > > > don't deal with KEY_DISPLAY_OFF. By mapping it to KEY_SCREENLOCK
> > > > instead, would enable desktop environments to handle this key as a
> > > > screen lock intent from the user, out of the box.
> > >
> > > But is it the intent of the user? The fact that current desktop
> > > environments do not handle this key is not a reason to change kernel
> > > behavior.
> > >
> > > If screen lock is simply your preference then you can change the
> > > mapping via udev on your system without the need to patch the kernel.
> > >
> > > Thanks.
> > >
> > > --
> > > Dmitry
> >
> > (Sorry, I'm sending this response again because it seems the first
> > attempt didn't make it to the mailing lists for some reason.)
> >
> > Hi Dmitry,
> >
> > I've picked up this particular key event because it would trigger a close
> > behavior to the one seen on Windows. It is far from being my preference,
> > which would be an exact mimic of the Windows behavior (and can be
> > achieved by xset dpms force on/off from user space).
> >
> > The idea of this patch is to improve the user experience, by giving that key a
> > behavior as close as possible to what users might experience on Windows.
> > Because most Linux desktop environments also turn the display off after
> > locking the screen, this would be a good approximation to what happens on
> > Windows. I think it is more about giving (consistent) behavior to it
> > than changing it.
> >
> > I agree it is possible to control that via udev or something else. But
> > most regular
> > users won't be able to do that, ending up with an unused key, though.
> > The hardcore user that would prefer a very different key behavior
> > could keep using
> > udev to do that.
> >
> > So IMHO I think that setting this up on the kernel would be a good
> > approach in this case.
>
> I am sorry, I disagree. I understand that patching the kernel might be
> easier than implementing new shortcut/behavior in various desktop
> environments, but that does not make it the right approach.
>
> Thanks.
>
> --
> Dmitry

Hi Dmitry,

Thanks for explaining this a little bit more, I've got the point: The current
key code triggered by the kernel is correct, the real issue is the lack of
support for that particular code by current desktop environments.

I'm new to contributing to the Linux kernel; the proper way to rollback
this would be by me just sending a revert patch to the respective
maintainer?

Thank you,
Vinícius.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] HID: hid-asus.c: Maps key 0x35 (display off) to KEY_SCREENLOCK
  2021-11-06 23:48       ` Vinícius Reis
@ 2021-11-07  2:08         ` Dmitry Torokhov
  2021-11-07  2:35           ` Vinícius Reis
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Torokhov @ 2021-11-07  2:08 UTC (permalink / raw)
  To: Vinícius Reis; +Cc: Jiri Kosina, linux-input, lkml, angiolucci

Hi Vinícius,

On Sat, Nov 06, 2021 at 08:48:29PM -0300, Vinícius Reis wrote:
> Hi Dmitry,
> 
> Thanks for explaining this a little bit more, I've got the point: The current
> key code triggered by the kernel is correct, the real issue is the lack of
> support for that particular code by current desktop environments.
> 
> I'm new to contributing to the Linux kernel; the proper way to rollback
> this would be by me just sending a revert patch to the respective
> maintainer?

Has the patch been accepted? I'd wait for Jiri or Benjamin to chime in
as to what they want to do.

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] HID: hid-asus.c: Maps key 0x35 (display off) to KEY_SCREENLOCK
  2021-11-07  2:08         ` Dmitry Torokhov
@ 2021-11-07  2:35           ` Vinícius Reis
  2021-11-09 10:21             ` Jiri Kosina
  0 siblings, 1 reply; 9+ messages in thread
From: Vinícius Reis @ 2021-11-07  2:35 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Jiri Kosina, linux-input, lkml, angiolucci

Em sáb., 6 de nov. de 2021 às 23:08, Dmitry Torokhov
<dmitry.torokhov@gmail.com> escreveu:
>
> Hi Vinícius,
>
> On Sat, Nov 06, 2021 at 08:48:29PM -0300, Vinícius Reis wrote:
> > Hi Dmitry,
> >
> > Thanks for explaining this a little bit more, I've got the point: The current
> > key code triggered by the kernel is correct, the real issue is the lack of
> > support for that particular code by current desktop environments.
> >
> > I'm new to contributing to the Linux kernel; the proper way to rollback
> > this would be by me just sending a revert patch to the respective
> > maintainer?
>
> Has the patch been accepted? I'd wait for Jiri or Benjamin to chime in
> as to what they want to do.
>
> Thanks.
>
> --
> Dmitry

Hi Dmitry,

Yes, it was applied two weeks ago. Okay, I will do that.

Thanks again,
Vinícius.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] HID: hid-asus.c: Maps key 0x35 (display off) to KEY_SCREENLOCK
  2021-11-07  2:35           ` Vinícius Reis
@ 2021-11-09 10:21             ` Jiri Kosina
  0 siblings, 0 replies; 9+ messages in thread
From: Jiri Kosina @ 2021-11-09 10:21 UTC (permalink / raw)
  To: Vinícius Reis; +Cc: Dmitry Torokhov, linux-input, lkml, angiolucci

On Sat, 6 Nov 2021, Vinícius Reis wrote:

> > > Thanks for explaining this a little bit more, I've got the point: The current
> > > key code triggered by the kernel is correct, the real issue is the lack of
> > > support for that particular code by current desktop environments.
> > >
> > > I'm new to contributing to the Linux kernel; the proper way to rollback
> > > this would be by me just sending a revert patch to the respective
> > > maintainer?
> >
> > Has the patch been accepted? I'd wait for Jiri or Benjamin to chime in
> > as to what they want to do.
> >
> > Thanks.
> >
> > --
> > Dmitry
> 
> Hi Dmitry,
> 
> Yes, it was applied two weeks ago. Okay, I will do that.

Yes, please send me a revert with a full explanation in the changelog.

Thanks,

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-11-09 10:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-08 22:23 [PATCH] HID: hid-asus.c: Maps key 0x35 (display off) to KEY_SCREENLOCK Vinícius Angiolucci Reis
2021-10-19  9:17 ` Jiri Kosina
2021-10-28 16:07 ` Dmitry Torokhov
2021-11-05 15:16   ` Vinícius Reis
2021-11-05 21:55     ` Dmitry Torokhov
2021-11-06 23:48       ` Vinícius Reis
2021-11-07  2:08         ` Dmitry Torokhov
2021-11-07  2:35           ` Vinícius Reis
2021-11-09 10:21             ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).