Skip to contentSkip to conversation

thinkpad_acpi: Always report scancodes for hotkeys

PATCH Applied Seth Forshee 3 participants 5 messages Jan 14, 2011 – Feb 21, 2011 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thinkpad_acpi: Always report scancodes for hotkeys

Some thinkpad hotkeys report key codes like KEY_FN_F8 when something like KEY_VOLUMEDOWN is desired. Always provide the scan codes in addition to the key codes to assist with debugging these issues. Also send the scan code before the key code to match what other drivers do, as some userspace utilities expect this ordering.

---
 drivers/platform/x86/thinkpad_acpi.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +2 -6
index dd59958..eb99223 100644
@@ -2275,16 +2275,12 @@ static void tpacpi_input_send_key(const unsigned int scancode)
 	if (keycode != KEY_RESERVED) {
 		mutex_lock(&tpacpi_inputdev_send_mutex);
 
+		input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN, scancode);
 		input_report_key(tpacpi_inputdev, keycode, 1);
-		if (keycode == KEY_UNKNOWN)
-			input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN,
-				    scancode);
 		input_sync(tpacpi_inputdev);
 
+		input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN, scancode);
 		input_report_key(tpacpi_inputdev, keycode, 0);
-		if (keycode == KEY_UNKNOWN)
-			input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN,
-				    scancode);
 		input_sync(tpacpi_inputdev);
 
 		mutex_unlock(&tpacpi_inputdev_send_mutex);
Signature · 1 line
1.7.1
#1 lore raw
Quoted 5 lines · Seth Forshee

Some thinkpad hotkeys report key codes like KEY_FN_F8 when something like KEY_VOLUMEDOWN is desired. Always provide the scan codes in addition to the key codes to assist with debugging these issues. Also send the scan code before the key code to match what other drivers do, as some userspace utilities expect this ordering.

Do I have your word of honour that canonical is not going to start using scancodes instead of keycodes in Ubuntu to trigger actions?

Signature · 4 lines
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
#2 lore raw
Quoted 9 lines · Henrique de Moraes Holschuh
Quoted 5 lines · Seth Forshee

Some thinkpad hotkeys report key codes like KEY_FN_F8 when something like KEY_VOLUMEDOWN is desired. Always provide the scan codes in addition to the key codes to assist with debugging these issues. Also send the scan code before the key code to match what other drivers do, as some userspace utilities expect this ordering.

Do I have your word of honour that canonical is not going to start using scancodes instead of keycodes in Ubuntu to trigger actions?

That would be silly. The reason for this change is to aid in collecting the data to update udev's keymaps for non-standard keys (see [1]). udev uses the EVIOCSKEYCODE ioctl to associate the correct key code with the scan codes. We don't intend to use scan codes instead of key codes.

[1] http://git.kernel.org/?p=linux/hotplug/udev.git;a=blob;f=extras/keymap/README.keymap.txt;hb=HEAD

#3 lore raw
Quoted 4 lines · Seth Forshee
Quoted 2 lines

Do I have your word of honour that canonical is not going to start using scancodes instead of keycodes in Ubuntu to trigger actions?

That would be silly. The reason for this change is to aid in collecting

...

Quoted 3 lines

the data to update udev's keymaps for non-standard keys (see [1]). udev uses the EVIOCSKEYCODE ioctl to associate the correct key code with the scan codes. We don't intend to use scan codes instead of key codes.

Very well. I *will* hold you to that. I do not want a repeat of the KEY_VOLUMEUP/DOWN "active notification" fiasco.

Signature · 4 lines
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh