Skip to contentSkip to conversation

Fn keys on Dell Latitude E6440

PATCH In review Pali Rohár 2 participants 9 messages Apr 14, 2014 – May 17, 2014

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

Hello,

on my notebook dell-wmi kernel driver generates some scan codes when I press some of Fn key combinations. Now all these scan codes are mapped to key "prog3". I would like to add some actions for these Fn key combinations, so what do you think? Which key codes should be assigned for these scan codes? Note that these combinations are not special (and labeled) as other (like Fn+F11 = play/pause) and seems like windows does not recognize them.

Matthew, you are author of dell-wmi driver, do you know if there are some other secrets key combinations? And why first 10 Fn key combinations generate scan codes?

Output of commands:

$ lsinput

/dev/input/event7
bustype : BUS_HOST
vendor : 0x0
product : 0x0
version : 0
name : "Dell WMI hotkeys"
phys : "wmi/input0"
bits ev : EV_SYN EV_KEY EV_MSC

$ /lib/udev/keymap -i /dev/input/event7

scan code: 0x10 key code: prog3 --> Fn+Q
scan code: 0x11 key code: prog3 --> Fn+W
scan code: 0x12 key code: prog3 --> Fn+E
scan code: 0x13 key code: prog3 --> Fn+R
scan code: 0x14 key code: prog3 --> Fn+T

scan code: 0x1E key code: prog3 --> Fn+A
scan code: 0x1F key code: prog3 --> Fn+S
scan code: 0x20 key code: prog3 --> Fn+D
scan code: 0x21 key code: prog3 --> Fn+F
scan code: 0x22 key code: prog3 --> Fn+G

$ cat /sys/class/dmi/id/sys_vendor
Dell Inc.
$ cat /sys/class/dmi/id/product_name
Latitude E6440
Signature · 2 lines
Pali Rohár
[email protected]
#1 lore raw
Quoted 42 lines · On Monday 14 April 2014 16:51:07 Pali Rohár wrote:

Hello,

on my notebook dell-wmi kernel driver generates some scan codes when I press some of Fn key combinations. Now all these scan codes are mapped to key "prog3". I would like to add some actions for these Fn key combinations, so what do you think? Which key codes should be assigned for these scan codes? Note that these combinations are not special (and labeled) as other (like Fn+F11 = play/pause) and seems like windows does not recognize them.

Matthew, you are author of dell-wmi driver, do you know if there are some other secrets key combinations? And why first 10 Fn key combinations generate scan codes?

Output of commands:

$ lsinput

/dev/input/event7
bustype : BUS_HOST
vendor : 0x0
product : 0x0
version : 0
name : "Dell WMI hotkeys"
phys : "wmi/input0"
bits ev : EV_SYN EV_KEY EV_MSC

$ /lib/udev/keymap -i /dev/input/event7

scan code: 0x10 key code: prog3 --> Fn+Q
scan code: 0x11 key code: prog3 --> Fn+W
scan code: 0x12 key code: prog3 --> Fn+E
scan code: 0x13 key code: prog3 --> Fn+R
scan code: 0x14 key code: prog3 --> Fn+T

scan code: 0x1E key code: prog3 --> Fn+A
scan code: 0x1F key code: prog3 --> Fn+S
scan code: 0x20 key code: prog3 --> Fn+D
scan code: 0x21 key code: prog3 --> Fn+F
scan code: 0x22 key code: prog3 --> Fn+G

Quoted 5 lines
$ cat /sys/class/dmi/id/sys_vendor
Dell Inc.
$ cat /sys/class/dmi/id/product_name
Latitude E6440

Hello, can you look at above info help me with fn keys?

Signature · 2 lines
Pali Rohár
[email protected]
#2 lore raw
In reply to Pali Rohár
Quoted 42 lines · On Monday 14 April 2014 16:51:07 Pali Rohár wrote:

Hello,

on my notebook dell-wmi kernel driver generates some scan codes when I press some of Fn key combinations. Now all these scan codes are mapped to key "prog3". I would like to add some actions for these Fn key combinations, so what do you think? Which key codes should be assigned for these scan codes? Note that these combinations are not special (and labeled) as other (like Fn+F11 = play/pause) and seems like windows does not recognize them.

Matthew, you are author of dell-wmi driver, do you know if there are some other secrets key combinations? And why first 10 Fn key combinations generate scan codes?

Output of commands:

$ lsinput

/dev/input/event7
bustype : BUS_HOST
vendor : 0x0
product : 0x0
version : 0
name : "Dell WMI hotkeys"
phys : "wmi/input0"
bits ev : EV_SYN EV_KEY EV_MSC

$ /lib/udev/keymap -i /dev/input/event7

scan code: 0x10 key code: prog3 --> Fn+Q
scan code: 0x11 key code: prog3 --> Fn+W
scan code: 0x12 key code: prog3 --> Fn+E
scan code: 0x13 key code: prog3 --> Fn+R
scan code: 0x14 key code: prog3 --> Fn+T

scan code: 0x1E key code: prog3 --> Fn+A
scan code: 0x1F key code: prog3 --> Fn+S
scan code: 0x20 key code: prog3 --> Fn+D
scan code: 0x21 key code: prog3 --> Fn+F
scan code: 0x22 key code: prog3 --> Fn+G

Quoted 5 lines
$ cat /sys/class/dmi/id/sys_vendor
Dell Inc.
$ cat /sys/class/dmi/id/product_name
Latitude E6440

I looked deeper into dell-wmi driver and bios DMI keycode table. I will send patch for dell-wmi driver which adding support for Fn key combinations.

Signature · 2 lines
Pali Rohár
[email protected]
#3 lore raw

cover dell-wmi: Add support for Fn key combinations

This patch series add support for Fn key combinations to dell-wmi driver. I tested this patch series on laptop Dell Latitude E6440.

Here is Bios DMI table which contains scancode to keycode mapping:

Handle 0xB200, DMI type 178, 80 bytes
OEM-specific Type

        Header and Data:
                B2 50 00 B2 07 01 0C 00 08 01 0A 00 09 01 0B 00
                0A 01 12 00 3B 00 20 00 42 00 18 00 48 00 14 00
                50 00 13 00 10 00 FF 00 11 00 FF 00 12 00 FF 00
                13 00 FF 00 14 00 FF 00 1E 00 FF 00 1F 00 FF 00
                20 00 FF 00 21 00 FF 00 22 00 FF 00 4D 00 16 00
        Strings:

As you can see, more different keys are mapped to one keycode 0xFF.

Pali Rohár (2):
Input: Add keycodes for some missing Fn key combinations
dell-wmi: Add support for Fn key combinations

 drivers/platform/x86/dell-wmi.c |   27 ++++++++++++++++++++++++++-
 include/uapi/linux/input.h      |    6 ++++++
 2 files changed, 32 insertions(+), 1 deletion(-)
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw

PATCH 1/2 Input: Add keycodes for some missing Fn key combinations

There are already defined some Fn key combinations, but not all. This patch adds missing combinations for support in dell-wmi driver.

---
 include/uapi/linux/input.h |    6 ++++++
 1 file changed, 6 insertions(+)
include/uapi/linux/input.h +6 -0
index f484952..3a32799 100644
@@ -672,6 +672,12 @@ struct input_keymap_entry {
 #define KEY_FN_F		0x1e2
 #define KEY_FN_S		0x1e3
 #define KEY_FN_B		0x1e4
+#define KEY_FN_Q		0x1e5
+#define KEY_FN_W		0x1e6
+#define KEY_FN_R		0x1e7
+#define KEY_FN_T		0x1e8
+#define KEY_FN_A		0x1e9
+#define KEY_FN_G		0x1ea
 
 #define KEY_BRL_DOT1		0x1f1
 #define KEY_BRL_DOT2		0x1f2
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#5 lore raw

Re: [PATCH 1/2] Input: Add keycodes for some missing Fn key combinations

Hi Pali,

Quoted 13 lines · Pali Rohár

There are already defined some Fn key combinations, but not all. This patch adds missing combinations for support in dell-wmi driver.

---
 include/uapi/linux/input.h |    6 ++++++
 1 file changed, 6 insertions(+)
include/uapi/linux/input.h +0 -0
index f484952..3a32799 100644

include/uapi/linux/input.h struct input_keymap_entry { · line 680

Quoted 9 lines
include/uapi/linux/input.h +6 -0
@@ -672,6 +672,12 @@ struct input_keymap_entry {
 #define KEY_FN_F		0x1e2
 #define KEY_FN_S		0x1e3
 #define KEY_FN_B		0x1e4
+#define KEY_FN_Q		0x1e5
+#define KEY_FN_W		0x1e6
+#define KEY_FN_R		0x1e7
+#define KEY_FN_T		0x1e8
+#define KEY_FN_A		0x1e9
+#define KEY_FN_G		0x1ea

What do they actually do?

Thanks.

Signature · 1 line
Dmitry
#6 lore raw

Re: [PATCH 1/2] Input: Add keycodes for some missing Fn key combinations

Quoted 32 lines · On Saturday 17 May 2014 22:30:54 Dmitry Torokhov wrote:

Hi Pali,

Quoted 16 lines · Pali Rohár

There are already defined some Fn key combinations, but not all. This patch adds missing combinations for support in dell-wmi driver.

---

 include/uapi/linux/input.h |    6 ++++++
 1 file changed, 6 insertions(+)
(quoted diff) +0 -0

b/include/uapi/linux/input.h index f484952..3a32799 100644

include/uapi/linux/input.h +0 -0
@@ -672,6 +672,12 @@ struct input_keymap_entry {
 

include/uapi/linux/input.h struct input_keymap_entry { · line 682

Quoted 10 lines
include/uapi/linux/input.h +6 -0
 #define KEY_FN_F		0x1e2
 #define KEY_FN_S		0x1e3
 #define KEY_FN_B		0x1e4
 
+#define KEY_FN_Q		0x1e5
+#define KEY_FN_W		0x1e6
+#define KEY_FN_R		0x1e7
+#define KEY_FN_T		0x1e8
+#define KEY_FN_A		0x1e9
+#define KEY_FN_G		0x1ea

What do they actually do?

Quoted 1 line

Thanks.

All 10 combinations Fn+Q ... Fn+T, Fn+A ... Fn+G are reported by WMI and I need to assign some keycodes for them in dell-wmi driver. And because More FN_* constants are already defined in input.h I added those which are missing.

With this patch series I'm able to use above Fn combinations for my own keyboard shortcuts. Before this patch all Fn combinations were one same keycode - which was useless.

Signature · 2 lines
Pali Rohár
[email protected]
maintainer
#7 lore raw

Re: [PATCH 1/2] Input: Add keycodes for some missing Fn key combinations

Quoted 33 lines · Pali Rohár
Quoted 32 lines · On Saturday 17 May 2014 22:30:54 Dmitry Torokhov wrote:

Hi Pali,

Quoted 16 lines · Pali Rohár

There are already defined some Fn key combinations, but not all. This patch adds missing combinations for support in dell-wmi driver.

---

 include/uapi/linux/input.h |    6 ++++++
 1 file changed, 6 insertions(+)
(quoted diff) +0 -0

b/include/uapi/linux/input.h index f484952..3a32799 100644

include/uapi/linux/input.h +0 -0
@@ -672,6 +672,12 @@ struct input_keymap_entry {
 

include/uapi/linux/input.h struct input_keymap_entry { · line 682

Quoted 10 lines
include/uapi/linux/input.h +6 -0
 #define KEY_FN_F		0x1e2
 #define KEY_FN_S		0x1e3
 #define KEY_FN_B		0x1e4
 
+#define KEY_FN_Q		0x1e5
+#define KEY_FN_W		0x1e6
+#define KEY_FN_R		0x1e7
+#define KEY_FN_T		0x1e8
+#define KEY_FN_A		0x1e9
+#define KEY_FN_G		0x1ea

What do they actually do?

Quoted 5 lines
Quoted 1 line

Thanks.

All 10 combinations Fn+Q ... Fn+T, Fn+A ... Fn+G are reported by WMI and I need to assign some keycodes for them in dell-wmi driver.

If they do not have a well-defined meaning then KEY_UNKNOWN is appropriate and user later can redefine via EVIOCSKEYCODE to the code they wish.

Quoted 2 lines

And because More FN_* constants are already defined in input.h I added those which are missing.

I am not sure if adding existing generic KEY_FN_* was a good idea.

Quoted 4 lines

With this patch series I'm able to use above Fn combinations for my own keyboard shortcuts. Before this patch all Fn combinations were one same keycode - which was useless.

Are there not enough key definitions already to accommodate actions you want? dell-wmi supports changing keymap from usersopace so you should be able to remap entries you want to the actions you need.

Thanks.

Signature · 1 line
Dmitry
#8 lore raw

PATCH 2/2 dell-wmi: Add support for Fn key combinations

In reply to Pali Rohár

Bios DMI table contains scancodes for some Fn key combinations. But corresponding keycodes in DMI table have same value 255. And dell-wmi driver map value 255 to KEY_PROG3. This means that it is not possible to distinguish between Fn key combinations (e.g Fn+Q and Fn+W), because kernel reports for all of them only KEY_PROG3.

This patch adding new table for mapping Bios DMI scancodes to linux keycodes when bios DMI keycode is set to "generic" keycode 255. So different Fn key combinations will have different keycodes.

---
 drivers/platform/x86/dell-wmi.c |   27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)
drivers/platform/x86/dell-wmi.c +25 -1
index 390e8e3..c54d675 100644
@@ -140,7 +140,27 @@ static const u16 bios_to_linux_keycode[256] __initconst = {
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0, 0, KEY_PROG3
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+/* table for bios code 0xff */
+static const u16 scancode_to_linux_keycode[256] __initconst = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	KEY_FN_Q, KEY_FN_W, KEY_FN_E, KEY_FN_R,
+	KEY_FN_T, 0, 0, 0,
+	0, 0, 0, 0,
+	0, 0, KEY_FN_A, KEY_FN_S,
+	KEY_FN_D, KEY_FN_F, KEY_FN_G, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 };
 
 static struct input_dev *dell_wmi_input_dev;
@@ -212,6 +232,11 @@ static const struct key_entry * __init dell_wmi_prepare_new_keymap(void)
 		keymap[i].keycode = bios_entry->keycode < 256 ?
 				    bios_to_linux_keycode[bios_entry->keycode] :
 				    KEY_RESERVED;
+		if (bios_entry->keycode = 255 && bios_entry->scancode < 256)
+			keymap[i].keycode +				scancode_to_linux_keycode[bios_entry->scancode];
+		if (!keymap[i].keycode)
+			keymap[i].keycode = KEY_RESERVED;
 	}
 
 	keymap[hotkey_num].type = KE_END;
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html