Skip to contentSkip to conversation

Add keycode to Dell G-Mode key

PATCH In review Marcos Alano 2 participants 4 messages Apr 19, 2025 – Apr 29, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add keycode to Dell G-Mode key

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

---
 include/uapi/linux/input-event-codes.h | 3 +++
 1 file changed, 3 insertions(+)
include/uapi/linux/input-event-codes.h +3 -0
index 5a199f3d4a26..85c6a612ee84 100644
@@ -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
Signature · 1 line
2.49.0
#1 lore raw
Quoted 3 lines · Marcos Alano

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.

Quoted 19 lines
---
  include/uapi/linux/input-event-codes.h | 3 +++
  1 file changed, 3 insertions(+)
include/uapi/linux/input-event-codes.h +3 -0
index 5a199f3d4a26..85c6a612ee84 100644
@@ -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
Signature · 1 line
Marcos Alano
maintainer
#2 lore raw

Hi Marcos,

Quoted 7 lines · Marcos Alano
Quoted 3 lines · Marcos Alano

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.

Quoted 16 lines

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.

Signature · 1 line
Dmitry
#3 lore raw
Quoted 2 lines · Dmitry Torokhov

Hi Marcos,

Hi Dmitry,

Quoted 5 lines

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

Quoted 3 lines

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

atkbd, I think. It parts of the regular keyboard, scan code 0x68.

Quoted 3 lines

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.

Quoted 3 lines

Thanks.

No, thank you. Please let me know what you think. :)

Signature · 1 line
Marcos Alano