linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add keycode to Dell G-Mode key
@ 2025-04-19 11:31 Marcos Alano
  2025-04-22 13:49 ` Marcos Alano
  0 siblings, 1 reply; 4+ messages in thread
From: Marcos Alano @ 2025-04-19 11:31 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, Marcos Alano

This key exists in some Alienware and Dell machines.
On Windows it activates the performance mode.

Signed-off-by: Marcos Alano <marcoshalano@gmail.com>
---
 include/uapi/linux/input-event-codes.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h
index 5a199f3d4a26..85c6a612ee84 100644
--- a/include/uapi/linux/input-event-codes.h
+++ b/include/uapi/linux/input-event-codes.h
@@ -765,6 +765,9 @@
 #define KEY_KBD_LCD_MENU4		0x2bb
 #define KEY_KBD_LCD_MENU5		0x2bc
 
+/* G-Mode key present in some Alienware and Dell machines */
+#define KEY_GMODE			0x2bd
+
 #define BTN_TRIGGER_HAPPY		0x2c0
 #define BTN_TRIGGER_HAPPY1		0x2c0
 #define BTN_TRIGGER_HAPPY2		0x2c1
-- 
2.49.0


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

* Re: [PATCH] Add keycode to Dell G-Mode key
  2025-04-19 11:31 [PATCH] Add keycode to Dell G-Mode key Marcos Alano
@ 2025-04-22 13:49 ` Marcos Alano
  2025-04-29  1:44   ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Marcos Alano @ 2025-04-22 13:49 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input

On 19/04/2025 08:31, Marcos Alano wrote:
> This key exists in some Alienware and Dell machines.
> On Windows it activates the performance mode.
> 
I noticed just now the missing of a rationale about my patch. Sorry 
about that.

This patch is part of a multiple stage plans to enable the G-Mode key on 
Linux.
The most important part is this patch, that will define an exclusive key 
code for the key.
There will be necessary a newer version for libevdev, specially the 
Python support, using the newer headers with the key code I'm adding in 
there.
Subsequently, I will update my change in systemd so the scan code for 
this key, 0x68, returns `KEY_GMODE` (today is returning a very generic 
key code).
Finally, I will release a simple Python code I developed that is 
responsible for monitoring event devices, /dev/input/event* (since I 
doubt that I have how to know what is the keyboard device).
When detect `KEY_GMODE` it will enable performance mode, and when press 
again, it will disable.
Today I'm using D-Bus to call power-profiles-daemon, but the idea in the 
future, with a quite set in stone key code, any user-space tool, like 
power-profiles-daemon, can use and manage the key by themselves.

Please let me know about any doubts or considerations.


> Signed-off-by: Marcos Alano <marcoshalano@gmail.com>
> ---
>   include/uapi/linux/input-event-codes.h | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h
> index 5a199f3d4a26..85c6a612ee84 100644
> --- a/include/uapi/linux/input-event-codes.h
> +++ b/include/uapi/linux/input-event-codes.h
> @@ -765,6 +765,9 @@
>   #define KEY_KBD_LCD_MENU4		0x2bb
>   #define KEY_KBD_LCD_MENU5		0x2bc
>   
> +/* G-Mode key present in some Alienware and Dell machines */
> +#define KEY_GMODE			0x2bd
> +
>   #define BTN_TRIGGER_HAPPY		0x2c0
>   #define BTN_TRIGGER_HAPPY1		0x2c0
>   #define BTN_TRIGGER_HAPPY2		0x2c1

-- 
Marcos Alano


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

* Re: [PATCH] Add keycode to Dell G-Mode key
  2025-04-22 13:49 ` Marcos Alano
@ 2025-04-29  1:44   ` Dmitry Torokhov
  2025-04-29 10:28     ` Marcos Alano
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2025-04-29  1:44 UTC (permalink / raw)
  To: Marcos Alano; +Cc: linux-input

Hi Marcos,

On Tue, Apr 22, 2025 at 10:49:09AM -0300, Marcos Alano wrote:
> On 19/04/2025 08:31, Marcos Alano wrote:
> > This key exists in some Alienware and Dell machines.
> > On Windows it activates the performance mode.
> > 
> I noticed just now the missing of a rationale about my patch. Sorry about
> that.
> 
> This patch is part of a multiple stage plans to enable the G-Mode key on
> Linux.
> The most important part is this patch, that will define an exclusive key
> code for the key.
> There will be necessary a newer version for libevdev, specially the Python
> support, using the newer headers with the key code I'm adding in there.
> Subsequently, I will update my change in systemd so the scan code for this
> key, 0x68, returns `KEY_GMODE` (today is returning a very generic key code).
> Finally, I will release a simple Python code I developed that is responsible
> for monitoring event devices, /dev/input/event* (since I doubt that I have
> how to know what is the keyboard device).
> When detect `KEY_GMODE` it will enable performance mode, and when press
> again, it will disable.
> Today I'm using D-Bus to call power-profiles-daemon, but the idea in the
> future, with a quite set in stone key code, any user-space tool, like
> power-profiles-daemon, can use and manage the key by themselves.

Could you please tell me more about the performance mode? What does it
do and how it differs from normal (?) mode, and also whether it is
something Dell-specific or whether it is also available on other
devices.

What input device emits this key code? atkbd? Something
platform-specific?

My inclination would be to use KEY_VENDOR for this functionality, at
least for now, as the feature seems very vendor-specific. 

Thanks.

-- 
Dmitry

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

* Re: [PATCH] Add keycode to Dell G-Mode key
  2025-04-29  1:44   ` Dmitry Torokhov
@ 2025-04-29 10:28     ` Marcos Alano
  0 siblings, 0 replies; 4+ messages in thread
From: Marcos Alano @ 2025-04-29 10:28 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input

On 28/04/2025 22:44, Dmitry Torokhov wrote:
> Hi Marcos,
>
Hi Dmitry,

> 
> Could you please tell me more about the performance mode? What does it
> do and how it differs from normal (?) mode, and also whether it is
> something Dell-specific or whether it is also available on other
> devices.
This is the performance mode related to power consumption. I think 
kernel calls this "performance profile".
When you don't need to save power, you can improve performance by 
increasing the clock.
For some machines this G-Mode is already enabled when selecting the 
performance profile: 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/platform/x86/dell/alienware-wmi-wmax.c#n51
> 
> What input device emits this key code? atkbd? Something
> platform-specific?
atkbd, I think. It parts of the regular keyboard, scan code 0x68.
> 
> My inclination would be to use KEY_VENDOR for this functionality, at
> least for now, as the feature seems very vendor-specific.
Yes, it's very vendor-specific. Dell uses for some Dell and Alienware 
machines.
I don't think we can use KEY_VENDOR because that could have another 
KEY_VENDOR in the keyboard, I think. The idea is to be a very exclusive 
keycode, that when detected, it would indicate that you want to activate 
the "performance profile" and don't do anything else.
An alternative would be create a new keycode called KEY_PERF or 
KEY_PERF_MODE. That would activate the performance profile, but it would 
be vendor-agnostic and if any other vendors, like HP, Lenovo, Acer, etc. 
want to implement the same feature, that would be possible.
> 
> Thanks.
> 
No, thank you. Please let me know what you think. :)

-- 
Marcos Alano


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

end of thread, other threads:[~2025-04-29 10:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-19 11:31 [PATCH] Add keycode to Dell G-Mode key Marcos Alano
2025-04-22 13:49 ` Marcos Alano
2025-04-29  1:44   ` Dmitry Torokhov
2025-04-29 10:28     ` Marcos Alano

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).