aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Hughes <john@calvaedi.com>2011-11-16 13:51:57 -0500
committerMatthew Garrett <mjg@redhat.com>2012-03-20 12:02:03 -0400
commit747a562f342895bbb6cfdfcb82104b4b2ae566e6 (patch)
treec21379baf0b872266a4f11ad5364a38d57baf42a
parent4d6446628a92a2cf706c256606b3031fc72a763e (diff)
to fix scancodes returned by sony-laptop driver
Fix scancodes returned by driver to match scancodes used to remap keys. (Before the patch FN/E returned scancode 0x1B, but to remap scancode 0x14 had to be used). The scancodes returned by the sony-laptop driver for function keys did not match the scancodes used to remap keys. Also, since the scancode was sent to the input subsystem after the mapped keysym the /lib/udev/keymap utility was confused about which scancode to report for which keysym. This patch fixes the driver so the correct scancode is shown for each key. It also adds to the documentation a description of where to find the scancodes. Signed-off-by: John Hughes <john@calva.com> Acked-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Matthew Garrett <mjg@redhat.com>
-rw-r--r--Documentation/laptops/sony-laptop.txt5
-rw-r--r--drivers/platform/x86/sony-laptop.c13
2 files changed, 13 insertions, 5 deletions
diff --git a/Documentation/laptops/sony-laptop.txt b/Documentation/laptops/sony-laptop.txt
index 2bd4e82e5d9f..0d5ac7f5287e 100644
--- a/Documentation/laptops/sony-laptop.txt
+++ b/Documentation/laptops/sony-laptop.txt
@@ -17,6 +17,11 @@ subsystem. See the logs of acpid or /proc/acpi/event and
17devices are created by the driver. Additionally, loading the driver with the 17devices are created by the driver. Additionally, loading the driver with the
18debug option will report all events in the kernel log. 18debug option will report all events in the kernel log.
19 19
20The "scancodes" passed to the input system (that can be remapped with udev)
21are indexes to the table "sony_laptop_input_keycode_map" in the sony-laptop.c
22module. For example the "FN/E" key combination (EJECTCD on some models)
23generates the scancode 20 (0x14).
24
20Backlight control: 25Backlight control:
21------------------ 26------------------
22If your laptop model supports it, you will find sysfs files in the 27If your laptop model supports it, you will find sysfs files in the
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 40c470507e50..8a51795aa02a 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -347,6 +347,7 @@ static void sony_laptop_report_input_event(u8 event)
347 struct input_dev *jog_dev = sony_laptop_input.jog_dev; 347 struct input_dev *jog_dev = sony_laptop_input.jog_dev;
348 struct input_dev *key_dev = sony_laptop_input.key_dev; 348 struct input_dev *key_dev = sony_laptop_input.key_dev;
349 struct sony_laptop_keypress kp = { NULL }; 349 struct sony_laptop_keypress kp = { NULL };
350 int scancode = -1;
350 351
351 if (event == SONYPI_EVENT_FNKEY_RELEASED || 352 if (event == SONYPI_EVENT_FNKEY_RELEASED ||
352 event == SONYPI_EVENT_ANYBUTTON_RELEASED) { 353 event == SONYPI_EVENT_ANYBUTTON_RELEASED) {
@@ -380,8 +381,8 @@ static void sony_laptop_report_input_event(u8 event)
380 dprintk("sony_laptop_report_input_event, event not known: %d\n", event); 381 dprintk("sony_laptop_report_input_event, event not known: %d\n", event);
381 break; 382 break;
382 } 383 }
383 if (sony_laptop_input_index[event] != -1) { 384 if ((scancode = sony_laptop_input_index[event]) != -1) {
384 kp.key = sony_laptop_input_keycode_map[sony_laptop_input_index[event]]; 385 kp.key = sony_laptop_input_keycode_map[scancode];
385 if (kp.key != KEY_UNKNOWN) 386 if (kp.key != KEY_UNKNOWN)
386 kp.dev = key_dev; 387 kp.dev = key_dev;
387 } 388 }
@@ -389,9 +390,11 @@ static void sony_laptop_report_input_event(u8 event)
389 } 390 }
390 391
391 if (kp.dev) { 392 if (kp.dev) {
393 /* if we have a scancode we emit it so we can always
394 remap the key */
395 if (scancode != -1)
396 input_event(kp.dev, EV_MSC, MSC_SCAN, scancode);
392 input_report_key(kp.dev, kp.key, 1); 397 input_report_key(kp.dev, kp.key, 1);
393 /* we emit the scancode so we can always remap the key */
394 input_event(kp.dev, EV_MSC, MSC_SCAN, event);
395 input_sync(kp.dev); 398 input_sync(kp.dev);
396 399
397 /* schedule key release */ 400 /* schedule key release */
@@ -466,7 +469,7 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device)
466 jog_dev->name = "Sony Vaio Jogdial"; 469 jog_dev->name = "Sony Vaio Jogdial";
467 jog_dev->id.bustype = BUS_ISA; 470 jog_dev->id.bustype = BUS_ISA;
468 jog_dev->id.vendor = PCI_VENDOR_ID_SONY; 471 jog_dev->id.vendor = PCI_VENDOR_ID_SONY;
469 key_dev->dev.parent = &acpi_device->dev; 472 jog_dev->dev.parent = &acpi_device->dev;
470 473
471 input_set_capability(jog_dev, EV_KEY, BTN_MIDDLE); 474 input_set_capability(jog_dev, EV_KEY, BTN_MIDDLE);
472 input_set_capability(jog_dev, EV_REL, REL_WHEEL); 475 input_set_capability(jog_dev, EV_REL, REL_WHEEL);