dell platform driver tweaks v2
Subsystems (2)
v2 cover dell platform driver tweaks v2
Here's v2.
I'm still hoping to hear more details about the rfkill button. Meanwhile, let's at least wire up the WMI decoding stuff and get the rest in.
Changes from v1:
- The new hotkey code matches reality better.
- Don't send key events for the new hotkeys (yet?)
- Improve warning formatting.
Andy Lutomirski (3):
dell-wmi: Use a C99-style array for bios_to_linux_keycode
dell-wmi: Support new hotkeys on the XPS 13 9350 (Skylake)
dell-wmi: Improve unknown hotkey handling
drivers/platform/x86/dell-wmi.c | 143 +++++++++++++++++++++++++++++++--------- 1 file changed, 112 insertions(+), 31 deletions(-)
Signature · 1 line
2.5.0
PATCH v2 1/3 dell-wmi: Use a C99-style array for bios_to_linux_keycode
It's currently hard to follow what maps to what, and it's hard to edit the array. Redo it as a C99-style array.
I generated this using emacs regexes and a python one-liner. objdump says this didn't change the table.
--- drivers/platform/x86/dell-wmi.c | 61 +++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 21 deletions(-)
drivers/platform/x86/dell-wmi.c +40 -21
@@ -119,27 +119,46 @@ struct dell_bios_hotkey_table {static const struct dell_bios_hotkey_table *dell_bios_hotkey_table;static const u16 bios_to_linux_keycode[256 ]__initconst = { - -KEY_MEDIA ,KEY_NEXTSONG ,KEY_PLAYPAUSE ,KEY_PREVIOUSSONG , -KEY_STOPCD ,KEY_UNKNOWN ,KEY_UNKNOWN ,KEY_UNKNOWN , -KEY_WWW ,KEY_UNKNOWN ,KEY_VOLUMEDOWN ,KEY_MUTE , -KEY_VOLUMEUP ,KEY_UNKNOWN ,KEY_BATTERY ,KEY_EJECTCD , -KEY_UNKNOWN ,KEY_SLEEP ,KEY_PROG1 ,KEY_BRIGHTNESSDOWN , -KEY_BRIGHTNESSUP ,KEY_UNKNOWN ,KEY_KBDILLUMTOGGLE , -KEY_UNKNOWN ,KEY_SWITCHVIDEOMODE ,KEY_UNKNOWN ,KEY_UNKNOWN , -KEY_SWITCHVIDEOMODE ,KEY_UNKNOWN ,KEY_UNKNOWN ,KEY_PROG2 , -KEY_UNKNOWN ,KEY_UNKNOWN ,KEY_UNKNOWN ,KEY_UNKNOWN , -KEY_UNKNOWN ,KEY_UNKNOWN ,KEY_UNKNOWN ,KEY_MICMUTE , -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 ,KEY_PROG3 + [0 ] =KEY_MEDIA , + [1 ] =KEY_NEXTSONG , + [2 ] =KEY_PLAYPAUSE , + [3 ] =KEY_PREVIOUSSONG , + [4 ] =KEY_STOPCD , + [5 ] =KEY_UNKNOWN , + [6 ] =KEY_UNKNOWN , + [7 ] =KEY_UNKNOWN , + [8 ] =KEY_WWW , + [9 ] =KEY_UNKNOWN , + [10 ] =KEY_VOLUMEDOWN , + [11 ] =KEY_MUTE , + [12 ] =KEY_VOLUMEUP , + [13 ] =KEY_UNKNOWN , + [14 ] =KEY_BATTERY , + [15 ] =KEY_EJECTCD , + [16 ] =KEY_UNKNOWN , + [17 ] =KEY_SLEEP , + [18 ] =KEY_PROG1 , + [19 ] =KEY_BRIGHTNESSDOWN , + [20 ] =KEY_BRIGHTNESSUP , + [21 ] =KEY_UNKNOWN , + [22 ] =KEY_KBDILLUMTOGGLE , + [23 ] =KEY_UNKNOWN , + [24 ] =KEY_SWITCHVIDEOMODE , + [25 ] =KEY_UNKNOWN , + [26 ] =KEY_UNKNOWN , + [27 ] =KEY_SWITCHVIDEOMODE , + [28 ] =KEY_UNKNOWN , + [29 ] =KEY_UNKNOWN , + [30 ] =KEY_PROG2 , + [31 ] =KEY_UNKNOWN , + [32 ] =KEY_UNKNOWN , + [33 ] =KEY_UNKNOWN , + [34 ] =KEY_UNKNOWN , + [35 ] =KEY_UNKNOWN , + [36 ] =KEY_UNKNOWN , + [37 ] =KEY_UNKNOWN , + [38 ] =KEY_MICMUTE , + [255 ] =KEY_PROG3 , };static struct input_dev *dell_wmi_input_dev;
Signature · 6 lines
2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/3] dell-wmi: Use a C99-style array for bios_to_linux_keycode
Quoted 8 lines · Andy Lutomirski
It's currently hard to follow what maps to what, and it's hard to edit the array. Redo it as a C99-style array.
I generated this using emacs regexes and a python one-liner. objdump says this didn't change the table.
Acked-by Pali Rohár <[email protected]>Signed-off-by Andy Lutomirski <[email protected]>
I already have this one in next and I don't see a per-patch changelog for this one - has it changed?
Signature · 6 lines
Darren Hart Intel Open Source Technology Center -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/3] dell-wmi: Use a C99-style array for bios_to_linux_keycode
Quoted 4 lines · Darren Hart
Quoted 3 lines · Andy Lutomirski
It's currently hard to follow what maps to what, and it's hard to edit the array. Redo it as a C99-style array.
Quoted 9 lines
Quoted 5 lines
I generated this using emacs regexes and a python one-liner. objdump says this didn't change the table.
Acked-by Pali Rohár <[email protected]>Signed-off-by Andy Lutomirski <[email protected]>I already have this one in next and I don't see a per-patch changelog for this one - has it changed?
No, it hasn't. I didn't actually mean to include it in the series. Whoops! Please just pretend that I only sent patch 2 onward.
--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/3] dell-wmi: Use a C99-style array for bios_to_linux_keycode
Quoted 11 lines · Andy Lutomirski
Quoted 10 lines · Darren Hart
Quoted 8 lines · Andy Lutomirski
It's currently hard to follow what maps to what, and it's hard to edit the array. Redo it as a C99-style array.
I generated this using emacs regexes and a python one-liner. objdump says this didn't change the table.
Acked-by Pali Rohár <[email protected]>Signed-off-by Andy Lutomirski <[email protected]>
Quoted 6 lines
Quoted 3 lines
I already have this one in next and I don't see a per-patch changelog for this one - has it changed?
No, it hasn't. I didn't actually mean to include it in the series. Whoops! Please just pretend that I only sent patch 2 onward.
:-) Done.
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
PATCH v2 2/3 dell-wmi: Support new hotkeys on the XPS 13 9350 (Skylake)
In reply to Andy LutomirskiThe XPS 13 9350 sends WMI keypress events that aren't enumerated in the DMI table. Add a table listing them. To avoid breaking things that worked before, these un-enumerated hotkeys won't be used if the DMI table maps them to something else.
FWIW, it appears that the DMI table may be a legacy thing and we might want to rethink how we handle events in general. As an example, a whole lot of things map to KEY_PROG3 via the DMI table.
So far, this doesn't send keypress events for any of the new events. Depnding on whether we figure out exactly what needs to happen to get the wireless button working in time for Linux 4.5, we might want to temporarily handle it in dell-wmi.
--- drivers/platform/x86/dell-wmi.c | 59 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 7 deletions(-)
drivers/platform/x86/dell-wmi.c +52 -7
@@ -161,6 +161,27 @@ static const u16 bios_to_linux_keycode[256] __initconst = { [255] = KEY_PROG3, }; +/* These are applied if the hk table is present and doesn't override them. */ +static const struct key_entry dell_wmi_extra_keymap[]__initconst = { +/* Fn-lock */ + {KE_IGNORE ,0x151 , {KEY_RESERVED } }, + +/* Change keyboard illumination */ + {KE_IGNORE ,0x152 , {KEY_KBDILLUMTOGGLE } }, + +/* +* Radio disable (notify only -- there is no model for which the +* WMI event is supposed to trigger an action. +*/ + {KE_IGNORE ,0x153 , {KEY_RFKILL } }, + +/* RGB keyboard backlight control */ + {KE_IGNORE ,0x154 , {KEY_RESERVED } }, + +/* Stealth mode toggle */ + {KE_IGNORE ,0x155 , {KEY_RESERVED } }, +}; +static struct input_dev *dell_wmi_input_dev;static void dell_wmi_process_key (int reported_key)
@@ -319,9 +340,10 @@ static const struct key_entry * __init dell_wmi_prepare_new_keymap(void)int hotkey_num = (dell_bios_hotkey_table->header.length -4 ) /sizeof (struct dell_bios_keymap_entry );struct key_entry *keymap; -int i; +int i, pos =0 , num_bios_keys; - keymap =kcalloc (hotkey_num +1 ,sizeof (struct key_entry ),GFP_KERNEL ); + keymap =kcalloc (hotkey_num +ARRAY_SIZE (dell_wmi_extra_keymap), +sizeof (struct key_entry ),GFP_KERNEL );if (!keymap)return NULL ;
@@ -333,14 +355,37 @@ static const struct key_entry * __init dell_wmi_prepare_new_keymap(void)KEY_RESERVED ;if (keycode ==KEY_KBDILLUMTOGGLE ) - keymap[i].type =KE_IGNORE ; + keymap[pos].type =KE_IGNORE ;else - keymap[i].type =KE_KEY ; - keymap[i].code = bios_entry->scancode; - keymap[i].keycode = keycode; + keymap[pos].type =KE_KEY ; + keymap[pos].code = bios_entry->scancode; + keymap[pos].keycode = keycode; + + pos++; + } + + num_bios_keys = pos; + +for (i =0 ; i <ARRAY_SIZE (dell_wmi_extra_keymap); i++) { +int j; + +/* +* Check if we've already found this scancode. This takes +* quadratic time, but it doesn't matter unless the list +* of extra keys gets very long. +*/ +for (j =0 ; j < num_bios_keys; j++) +if (keymap[j].code == dell_wmi_extra_keymap[i].code) + goto skip; + + keymap[pos] = dell_wmi_extra_keymap[i]; + pos++; + +skip: + ; } - keymap[hotkey_num].type =KE_END ; + keymap[pos].type =KE_END ;return keymap; }
Signature · 1 line
2.5.0
Re: [PATCH v2 2/3] dell-wmi: Support new hotkeys on the XPS 13 9350 (Skylake)
Quoted 97 lines · Andy Lutomirski
The XPS 13 9350 sends WMI keypress events that aren't enumerated in the DMI table. Add a table listing them. To avoid breaking things that worked before, these un-enumerated hotkeys won't be used if the DMI table maps them to something else.
FWIW, it appears that the DMI table may be a legacy thing and we might want to rethink how we handle events in general. As an example, a whole lot of things map to
KEY_PROG3via the DMI table.So far, this doesn't send keypress events for any of the new events. Depnding on whether we figure out exactly what needs to happen to get the wireless button working in time for Linux 4.5, we might want to temporarily handle it in dell-wmi.
Signed-off-by Andy Lutomirski <[email protected]>--- drivers/platform/x86/dell-wmi.c | 59 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 7 deletions(-)drivers/platform/x86/dell-wmi.c +48
-6@@ -161,6 +161,27 @@ static const u16 bios_to_linux_keycode[256] __initconst = { [255] = KEY_PROG3, }; +/* These are applied if the hk table is present and doesn't override them. */ +static const struct key_entry dell_wmi_extra_keymap[]__initconst = { +/* Fn-lock */ + {KE_IGNORE ,0x151 , {KEY_RESERVED } }, + +/* Change keyboard illumination */ + {KE_IGNORE ,0x152 , {KEY_KBDILLUMTOGGLE } }, + +/* +* Radio disable (notify only -- there is no model for which the +* WMI event is supposed to trigger an action. +*/ + {KE_IGNORE ,0x153 , {KEY_RFKILL } }, + +/* RGB keyboard backlight control */ + {KE_IGNORE ,0x154 , {KEY_RESERVED } }, + +/* Stealth mode toggle */ + {KE_IGNORE ,0x155 , {KEY_RESERVED } }, +}; +static struct input_dev *dell_wmi_input_dev;static void dell_wmi_process_key (int reported_key)@@ -319,9 +340,10 @@ static const struct key_entry * __init dell_wmi_prepare_new_keymap(void)int hotkey_num = (dell_bios_hotkey_table->header.length -4 ) /sizeof (struct dell_bios_keymap_entry );struct key_entry *keymap; -int i; +int i, pos =0 , num_bios_keys; - keymap =kcalloc (hotkey_num +1 ,sizeof (struct key_entry ),GFP_KERNEL ); + keymap =kcalloc (hotkey_num +ARRAY_SIZE (dell_wmi_extra_keymap), +sizeof (struct key_entry ),GFP_KERNEL );if (!keymap)return NULL ;@@ -333,14 +355,37 @@ static const struct key_entry * __init dell_wmi_prepare_new_keymap(void)KEY_RESERVED ;if (keycode ==KEY_KBDILLUMTOGGLE ) - keymap[i].type =KE_IGNORE ; + keymap[pos].type =KE_IGNORE ;else - keymap[i].type =KE_KEY ; - keymap[i].code = bios_entry->scancode; - keymap[i].keycode = keycode; + keymap[pos].type =KE_KEY ; + keymap[pos].code = bios_entry->scancode; + keymap[pos].keycode = keycode; + + pos++; + } + + num_bios_keys = pos; + +for (i =0 ; i <ARRAY_SIZE (dell_wmi_extra_keymap); i++) { +int j; + +/* +* Check if we've already found this scancode. This takes +* quadratic time, but it doesn't matter unless the list +* of extra keys gets very long. +*/ +for (j =0 ; j < num_bios_keys; j++) +if (keymap[j].code == dell_wmi_extra_keymap[i].code) + goto skip; + + keymap[pos] = dell_wmi_extra_keymap[i]; + pos++;
drivers/platform/x86/dell-wmi.c static const struct key_entry * __init dell_wmi_prepare_new_keymap(void) · line 391
Quoted 10 lines
drivers/platform/x86/dell-wmi.c +4
-1+ +skip: + ; } - keymap[hotkey_num].type =KE_END ; + keymap[pos].type =KE_END ;return keymap; }
I agree, if you don't come up with a solution for using INT33D5 for 4.5, you may as well repurpose the WMI notification temporarily.
Re: [PATCH v2 2/3] dell-wmi: Support new hotkeys on the XPS 13 9350 (Skylake)
In reply to Andy LutomirskiQuoted 24 lines · Andy Lutomirski
The XPS 13 9350 sends WMI keypress events that aren't enumerated in the DMI table. Add a table listing them. To avoid breaking things that worked before, these un-enumerated hotkeys won't be used if the DMI table maps them to something else.
FWIW, it appears that the DMI table may be a legacy thing and we might want to rethink how we handle events in general. As an example, a whole lot of things map to
KEY_PROG3via the DMI table.So far, this doesn't send keypress events for any of the new events. Depnding on whether we figure out exactly what needs to happen to get the wireless button working in time for Linux 4.5, we might want to temporarily handle it in dell-wmi.
Signed-off-by Andy Lutomirski <[email protected]>--- drivers/platform/x86/dell-wmi.c | 59 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 7 deletions(-)drivers/platform/x86/dell-wmi.c +0
-0
drivers/platform/x86/dell-wmi.c static const u16 bios_to_linux_keycode[256] __initconst = { · line 164
Quoted 4 lines
drivers/platform/x86/dell-wmi.c +1
-0@@ -161,6 +161,27 @@ static const u16 bios_to_linux_keycode[256] __initconst = { [255] = KEY_PROG3, }; +/* These are applied if the hk table is present and doesn't override them. */
Please do not abbreviate in comments.
Quoted 24 lines
drivers/platform/x86/dell-wmi.c +20
-0+static const struct key_entry dell_wmi_extra_keymap[]__initconst = { +/* Fn-lock */ + {KE_IGNORE ,0x151 , {KEY_RESERVED } }, + +/* Change keyboard illumination */ + {KE_IGNORE ,0x152 , {KEY_KBDILLUMTOGGLE } }, + +/* +* Radio disable (notify only -- there is no model for which the +* WMI event is supposed to trigger an action. +*/ + {KE_IGNORE ,0x153 , {KEY_RFKILL } }, + +/* RGB keyboard backlight control */ + {KE_IGNORE ,0x154 , {KEY_RESERVED } }, + +/* Stealth mode toggle */ + {KE_IGNORE ,0x155 , {KEY_RESERVED } }, +}; +static struct input_dev *dell_wmi_input_dev;static void dell_wmi_process_key (int reported_key)
drivers/platform/x86/dell-wmi.c static const struct key_entry * __init dell_wmi_prepare_new_keymap(void) · line 346
Quoted 9 lines
drivers/platform/x86/dell-wmi.c +3
-2@@ -319,9 +340,10 @@ static const struct key_entry * __init dell_wmi_prepare_new_keymap(void)int hotkey_num = (dell_bios_hotkey_table->header.length -4 ) /sizeof (struct dell_bios_keymap_entry );struct key_entry *keymap; -int i; +int i, pos =0 , num_bios_keys; - keymap =kcalloc (hotkey_num +1 ,sizeof (struct key_entry ),GFP_KERNEL ); + keymap =kcalloc (hotkey_num +ARRAY_SIZE (dell_wmi_extra_keymap), +sizeof (struct key_entry ),GFP_KERNEL );
Did something change since our last round of review making the +1 for KE_END no longer necessary? It looks like it should be possible to use all the bios hotkey keymap and all the extra keymap, so we would still need +1 for KE_END.
Quoted 50 lines
drivers/platform/x86/dell-wmi.c +28
-5if (!keymap)return NULL ;@@ -333,14 +355,37 @@ static const struct key_entry * __init dell_wmi_prepare_new_keymap(void)KEY_RESERVED ;if (keycode ==KEY_KBDILLUMTOGGLE ) - keymap[i].type =KE_IGNORE ; + keymap[pos].type =KE_IGNORE ;else - keymap[i].type =KE_KEY ; - keymap[i].code = bios_entry->scancode; - keymap[i].keycode = keycode; + keymap[pos].type =KE_KEY ; + keymap[pos].code = bios_entry->scancode; + keymap[pos].keycode = keycode; + + pos++; + } + + num_bios_keys = pos; + +for (i =0 ; i <ARRAY_SIZE (dell_wmi_extra_keymap); i++) { +int j; + +/* +* Check if we've already found this scancode. This takes +* quadratic time, but it doesn't matter unless the list +* of extra keys gets very long. +*/ +for (j =0 ; j < num_bios_keys; j++) +if (keymap[j].code == dell_wmi_extra_keymap[i].code) + goto skip; + + keymap[pos] = dell_wmi_extra_keymap[i]; + pos++; + +skip: + ; } - keymap[hotkey_num].type =KE_END ; + keymap[pos].type =KE_END ;return keymap; }Signature · 1 line
2.5.0
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Re: [PATCH v2 2/3] dell-wmi: Support new hotkeys on the XPS 13 9350 (Skylake)
Quoted 28 lines · Darren Hart
Quoted 27 lines · Andy Lutomirski
The XPS 13 9350 sends WMI keypress events that aren't enumerated in the DMI table. Add a table listing them. To avoid breaking things that worked before, these un-enumerated hotkeys won't be used if the DMI table maps them to something else.
FWIW, it appears that the DMI table may be a legacy thing and we might want to rethink how we handle events in general. As an example, a whole lot of things map to
KEY_PROG3via the DMI table.So far, this doesn't send keypress events for any of the new events. Depnding on whether we figure out exactly what needs to happen to get the wireless button working in time for Linux 4.5, we might want to temporarily handle it in dell-wmi.
Signed-off-by Andy Lutomirski <[email protected]>--- drivers/platform/x86/dell-wmi.c | 59 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 7 deletions(-)drivers/platform/x86/dell-wmi.c +0
-0@@ -161,6 +161,27 @@ static const u16 bios_to_linux_keycode[256] __initconst = { [255] = KEY_PROG3, };
Quoted 4 lines
drivers/platform/x86/dell-wmi.c static const u16 bios_to_linux_keycode[256] __initconst = { · line 164
Quoted 1 line
drivers/platform/x86/dell-wmi.c +1
-0+/* These are applied if the hk table is present and doesn't override them. */ Please do not abbreviate in comments.
Will fix for v3.
Quoted 32 lines
Quoted 32 lines
drivers/platform/x86/dell-wmi.c +21
-1+static const struct key_entry dell_wmi_extra_keymap[]__initconst = { +/* Fn-lock */ + {KE_IGNORE ,0x151 , {KEY_RESERVED } }, + +/* Change keyboard illumination */ + {KE_IGNORE ,0x152 , {KEY_KBDILLUMTOGGLE } }, + +/* +* Radio disable (notify only -- there is no model for which the +* WMI event is supposed to trigger an action. +*/ + {KE_IGNORE ,0x153 , {KEY_RFKILL } }, + +/* RGB keyboard backlight control */ + {KE_IGNORE ,0x154 , {KEY_RESERVED } }, + +/* Stealth mode toggle */ + {KE_IGNORE ,0x155 , {KEY_RESERVED } }, +}; +static struct input_dev *dell_wmi_input_dev;static void dell_wmi_process_key (int reported_key)@@ -319,9 +340,10 @@ static const struct key_entry * __init dell_wmi_prepare_new_keymap(void)int hotkey_num = (dell_bios_hotkey_table->header.length -4 ) /sizeof (struct dell_bios_keymap_entry );struct key_entry *keymap; -int i; +int i, pos =0 , num_bios_keys;
Quoted 7 lines
drivers/platform/x86/dell-wmi.c static const struct key_entry * __init dell_wmi_prepare_new_keymap(void) · line 346
Quoted 3 lines
drivers/platform/x86/dell-wmi.c +2
-1- keymap =kcalloc (hotkey_num +1 ,sizeof (struct key_entry ),GFP_KERNEL ); + keymap =kcalloc (hotkey_num +ARRAY_SIZE (dell_wmi_extra_keymap), +sizeof (struct key_entry ),GFP_KERNEL );Did something change since our last round of review making the +1 for
KE_ENDno longer necessary? It looks like it should be possible to use all the bios hotkey keymap and all the extra keymap, so we would still need +1 forKE_END.
No, my bad. That's embarrassing :(
--Andy
Re: [PATCH v2 2/3] dell-wmi: Support new hotkeys on the XPS 13 9350 (Skylake)
In reply to Andy Lutomirskidrivers/platform/x86/dell-wmi.c static const struct key_entry * __init dell_wmi_prepare_new_keymap(void) · line 380
Quoted 9 lines · On Monday 30 November 2015 17:02:00 Andy Lutomirski wrote:
drivers/platform/x86/dell-wmi.c +9
-0+/* +* Check if we've already found this scancode. This takes +* quadratic time, but it doesn't matter unless the list +* of extra keys gets very long. +*/ +for (j =0 ; j < num_bios_keys; j++) +if (keymap[j].code == dell_wmi_extra_keymap[i].code) + goto skip; +
Still, my comment about moving this loop into function is valid...
Quoted 6 lines
drivers/platform/x86/dell-wmi.c +5
-0+ keymap[pos] = dell_wmi_extra_keymap[i]; + pos++; + +skip: + ; }
Signature · 6 lines
Pali Rohár [email protected] -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 2/3] dell-wmi: Support new hotkeys on the XPS 13 9350 (Skylake)
Quoted 12 lines · Pali Rohár
drivers/platform/x86/dell-wmi.c static const struct key_entry * __init dell_wmi_prepare_new_keymap(void) · line 380
Quoted 9 lines · On Monday 30 November 2015 17:02:00 Andy Lutomirski wrote:
drivers/platform/x86/dell-wmi.c +9
-0+/* +* Check if we've already found this scancode. This takes +* quadratic time, but it doesn't matter unless the list +* of extra keys gets very long. +*/ +for (j =0 ; j < num_bios_keys; j++) +if (keymap[j].code == dell_wmi_extra_keymap[i].code) + goto skip; +
Quoted 2 lines
Still, my comment about moving this loop into function is valid...
Whoops! Queued for v3.
--Andy
PATCH v2 3/3 dell-wmi: Improve unknown hotkey handling
In reply to Andy LutomirskiIf DMI lists a hotkey that we don't recognize, log and ignore it instead of trying to map it to keycode 0. I haven't seen this happen, but it will help maintain the key map in the future and it will help avoid sending bogus events.
This also improves the message that we log when we get an unknown key event.
--- drivers/platform/x86/dell-wmi.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
drivers/platform/x86/dell-wmi.c +21 -4
@@ -118,6 +118,7 @@ struct dell_bios_hotkey_table {static const struct dell_bios_hotkey_table *dell_bios_hotkey_table; +/* Uninitialized entries here are KEY_RESERVED == 0. */ static const u16 bios_to_linux_keycode[256 ]__initconst = { [0 ] =KEY_MEDIA , [1 ] =KEY_NEXTSONG ,
@@ -191,7 +192,8 @@ static void dell_wmi_process_key(int reported_key) key =sparse_keymap_entry_from_scancode (dell_wmi_input_dev, reported_key);if (!key) { -pr_info ("Unknown key %x pressed\n" , reported_key); +pr_info ("Unknown key with scancode 0x%x pressed\n" , + reported_key);return ; }
@@ -350,9 +352,24 @@ static const struct key_entry * __init dell_wmi_prepare_new_keymap(void)for (i =0 ; i < hotkey_num; i++) {const struct dell_bios_keymap_entry *bios_entry = &dell_bios_hotkey_table->keymap[i]; -u16 keycode = bios_entry->keycode <256 ? - bios_to_linux_keycode[bios_entry->keycode] : -KEY_RESERVED ; + +/* Uninitialized entries are 0 aka KEY_RESERVED. */ +u16 keycode = (bios_entry->keycode < +ARRAY_SIZE (bios_to_linux_keycode)) ? + bios_to_linux_keycode[bios_entry->keycode] : +KEY_RESERVED ; +BUILD_BUG_ON (KEY_RESERVED !=0 ); + +/* +* Log if we find an entry in the DMI table that we don't +* understand. If this happens, we should figure out what +* the entry means and add it to bios_to_linux_keycode. +*/ +if (keycode ==KEY_RESERVED ) { +pr_info ("firmware scancode 0x%x maps to unrecognized keycode 0x%x\n" , + bios_entry->scancode, bios_entry->keycode); +continue ; + }if (keycode ==KEY_KBDILLUMTOGGLE ) keymap[pos].type =KE_IGNORE ;
Signature · 1 line
2.5.0
Re: [PATCH v2 3/3] dell-wmi: Improve unknown hotkey handling
Quoted 10 lines · Andy Lutomirski
If DMI lists a hotkey that we don't recognize, log and ignore it instead of trying to map it to keycode 0. I haven't seen this happen, but it will help maintain the key map in the future and it will help avoid sending bogus events.
This also improves the message that we log when we get an unknown key event.
Signed-off-by Andy Lutomirski <[email protected]>---
Please include the individual patch changelogs here under --- in the patch itself - this helps me build confidence that I am indeed looking at the right patch and the expected changes are here.
Pali, this appears to have the one change you asked for (0x%x instead of %d). I've added the Reviewed-by: Pali Rohár <[email protected]> you provided previously pending this change.
Queued to testing, thanks.
Quoted 57 lines
drivers/platform/x86/dell-wmi.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)drivers/platform/x86/dell-wmi.c +21
-4@@ -118,6 +118,7 @@ struct dell_bios_hotkey_table {static const struct dell_bios_hotkey_table *dell_bios_hotkey_table; +/* Uninitialized entries here are KEY_RESERVED == 0. */ static const u16 bios_to_linux_keycode[256 ]__initconst = { [0 ] =KEY_MEDIA , [1 ] =KEY_NEXTSONG ,@@ -191,7 +192,8 @@ static void dell_wmi_process_key(int reported_key) key =sparse_keymap_entry_from_scancode (dell_wmi_input_dev, reported_key);if (!key) { -pr_info ("Unknown key %x pressed\n" , reported_key); +pr_info ("Unknown key with scancode 0x%x pressed\n" , + reported_key);return ; }@@ -350,9 +352,24 @@ static const struct key_entry * __init dell_wmi_prepare_new_keymap(void)for (i =0 ; i < hotkey_num; i++) {const struct dell_bios_keymap_entry *bios_entry = &dell_bios_hotkey_table->keymap[i]; -u16 keycode = bios_entry->keycode <256 ? - bios_to_linux_keycode[bios_entry->keycode] : -KEY_RESERVED ; + +/* Uninitialized entries are 0 aka KEY_RESERVED. */ +u16 keycode = (bios_entry->keycode < +ARRAY_SIZE (bios_to_linux_keycode)) ? + bios_to_linux_keycode[bios_entry->keycode] : +KEY_RESERVED ; +BUILD_BUG_ON (KEY_RESERVED !=0 ); + +/* +* Log if we find an entry in the DMI table that we don't +* understand. If this happens, we should figure out what +* the entry means and add it to bios_to_linux_keycode. +*/ +if (keycode ==KEY_RESERVED ) { +pr_info ("firmware scancode 0x%x maps to unrecognized keycode 0x%x\n" , + bios_entry->scancode, bios_entry->keycode); +continue ; + }if (keycode ==KEY_KBDILLUMTOGGLE ) keymap[pos].type =KE_IGNORE ;Signature · 1 line
2.5.0
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Re: [PATCH v2 3/3] dell-wmi: Improve unknown hotkey handling
Quoted 9 lines · Darren Hart
Quoted 8 lines · Andy Lutomirski
If DMI lists a hotkey that we don't recognize, log and ignore it instead of trying to map it to keycode 0. I haven't seen this happen, but it will help maintain the key map in the future and it will help avoid sending bogus events.
This also improves the message that we log when we get an unknown key event.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Andy Lutomirski <[email protected]>---
Please include the individual patch changelogs here under --- in the patch itself - this helps me build confidence that I am indeed looking at the right patch and the expected changes are here.
Will do in the future -- different maintainers have different preferences here, I think.
--Andy
Re: [PATCH v2 3/3] dell-wmi: Improve unknown hotkey handling
Quoted 13 lines · Andy Lutomirski
Quoted 12 lines · Darren Hart
Quoted 10 lines · Andy Lutomirski
If DMI lists a hotkey that we don't recognize, log and ignore it instead of trying to map it to keycode 0. I haven't seen this happen, but it will help maintain the key map in the future and it will help avoid sending bogus events.
This also improves the message that we log when we get an unknown key event.
Signed-off-by Andy Lutomirski <[email protected]>---
Quoted 6 lines
Quoted 3 lines
Please include the individual patch changelogs here under --- in the patch itself - this helps me build confidence that I am indeed looking at the right patch and the expected changes are here.
Will do in the future -- different maintainers have different preferences here, I think.
Oh really?
This is the documented process in Documentation/SubmittingPatches Section 14) The canonical patch format...
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Re: [PATCH v2 3/3] dell-wmi: Improve unknown hotkey handling
Quoted 18 lines · Darren Hart
Quoted 17 lines · Andy Lutomirski
Quoted 15 lines · Darren Hart
Quoted 10 lines · Andy Lutomirski
If DMI lists a hotkey that we don't recognize, log and ignore it instead of trying to map it to keycode 0. I haven't seen this happen, but it will help maintain the key map in the future and it will help avoid sending bogus events.
This also improves the message that we log when we get an unknown key event.
Signed-off-by Andy Lutomirski <[email protected]>---
Please include the individual patch changelogs here under --- in the patch itself - this helps me build confidence that I am indeed looking at the right patch and the expected changes are here.
Quoted 8 lines
Quoted 2 lines
Will do in the future -- different maintainers have different preferences here, I think.
Oh really?
This is the documented process in
Documentation/SubmittingPatchesSection 14) The canonical patch format...
Ingo and the other -tip maintainers seem to like all the comments up front on the cover letter. Or at least they haven't complained yet.
Anyway, I'm giving 'git notes' a try to generate nice change comments for v3.
--Andy
Re: [PATCH v2 3/3] dell-wmi: Improve unknown hotkey handling
Quoted 22 lines · Andy Lutomirski
Quoted 21 lines · Darren Hart
Quoted 19 lines · Andy Lutomirski
Quoted 9 lines · Darren Hart
Quoted 8 lines · Andy Lutomirski
If DMI lists a hotkey that we don't recognize, log and ignore it instead of trying to map it to keycode 0. I haven't seen this happen, but it will help maintain the key map in the future and it will help avoid sending bogus events.
This also improves the message that we log when we get an unknown key event.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Andy Lutomirski <[email protected]>---
Please include the individual patch changelogs here under --- in the patch itself - this helps me build confidence that I am indeed looking at the right patch and the expected changes are here.
Will do in the future -- different maintainers have different preferences here, I think.
Quoted 9 lines
Quoted 5 lines
Oh really?
This is the documented process in
Documentation/SubmittingPatchesSection 14) The canonical patch format...Ingo and the other -tip maintainers seem to like all the comments up front on the cover letter. Or at least they haven't complained yet.
Ugh, well, I don't like to ask contributors to treat this subsystem special by sticking to the documentation as much as possible. I really do find the per-patch changelog to be very useful. Thanks for working with me on that.
Quoted 1 line
Anyway, I'm giving 'git notes' a try to generate nice change comments for v3.
If you get a good solution, that would be nice to add to the documentation to help automate the process. Anything we can do to avoid mechanical errors here is goodness.
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Re: [PATCH v2 3/3] dell-wmi: Improve unknown hotkey handling
In reply to Darren HartQuoted 3 lines · On Thursday 03 December 2015 15:38:56 Darren Hart wrote:
Pali, this appears to have the one change you asked for (0x%x instead of %d). I've added the Reviewed-by: Pali Rohár <[email protected]> you provided previously pending this change.
Ok.
Quoted 6 lines
drivers/platform/x86/dell-wmi.c static const struct key_entry * __init dell_wmi_prepare_new_keymap(void) · line 361
Quoted 6 lines
drivers/platform/x86/dell-wmi.c +6
-0+/* Uninitialized entries are 0 aka KEY_RESERVED. */ +u16 keycode = (bios_entry->keycode < +ARRAY_SIZE (bios_to_linux_keycode)) ? + bios_to_linux_keycode[bios_entry->keycode] : +KEY_RESERVED ; +BUILD_BUG_ON (KEY_RESERVED !=0 );
Anyway, Darren what do you think is that BUILD_BUG_ON check needed?
Signature · 2 lines
Pali Rohár [email protected]
Re: [PATCH v2 3/3] dell-wmi: Improve unknown hotkey handling
Quoted 7 lines · Pali Rohár
Quoted 3 lines · On Thursday 03 December 2015 15:38:56 Darren Hart wrote:
Pali, this appears to have the one change you asked for (0x%x instead of %d). I've added the Reviewed-by: Pali Rohár <[email protected]> you provided previously pending this change.
Ok.
Quoted 9 lines
Quoted 6 lines
drivers/platform/x86/dell-wmi.c static const struct key_entry * __init dell_wmi_prepare_new_keymap(void) · line 361
Quoted 6 lines
drivers/platform/x86/dell-wmi.c +6
-0+/* Uninitialized entries are 0 aka KEY_RESERVED. */ +u16 keycode = (bios_entry->keycode < +ARRAY_SIZE (bios_to_linux_keycode)) ? + bios_to_linux_keycode[bios_entry->keycode] : +KEY_RESERVED ; +BUILD_BUG_ON (KEY_RESERVED !=0 );Anyway, Darren what do you think is that
BUILD_BUG_ONcheck needed?
Sorry, my bad. IIRC Darren made that change, I made the other change, and then I resent and we lost this one.
Darren, want to fix it in your tree? If not, I'll include the BUILD_BUG_ON deletion in v3.
--Andy
Re: [PATCH v2 3/3] dell-wmi: Improve unknown hotkey handling
Quoted 15 lines · Andy Lutomirski
Quoted 14 lines · Pali Rohár
Quoted 3 lines · On Thursday 03 December 2015 15:38:56 Darren Hart wrote:
Pali, this appears to have the one change you asked for (0x%x instead of %d). I've added the Reviewed-by: Pali Rohár <[email protected]> you provided previously pending this change.
Ok.
Quoted 6 lines
Quoted 6 lines
drivers/platform/x86/dell-wmi.c +6
-0+/* Uninitialized entries are 0 aka KEY_RESERVED. */ +u16 keycode = (bios_entry->keycode < +ARRAY_SIZE (bios_to_linux_keycode)) ? + bios_to_linux_keycode[bios_entry->keycode] : +KEY_RESERVED ; +BUILD_BUG_ON (KEY_RESERVED !=0 );
Quoted 8 lines
Quoted 2 lines
Anyway, Darren what do you think is that
BUILD_BUG_ONcheck needed?Sorry, my bad. IIRC Darren made that change, I made the other change, and then I resent and we lost this one.
Darren, want to fix it in your tree? If not, I'll include the
BUILD_BUG_ONdeletion in v3.
Thanks for the catch Pali. I've removed this in my tree. No need to resend.
Signature · 6 lines
Darren Hart Intel Open Source Technology Center -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html