lkml.org 
[lkml]   [2011]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: Bug: changing keycodes generated by sony-laptop doesn't work
On 16/10/11 15:30, John Hughes wrote:
>
> All the scancodes are 7 off, setting the mapping for scancode 0x14
> changes the mapping for what the driver claims is scancode 0x1B.
Actually it's a bit worse than that.

The "scancodes" used by the sony-laptop driver are the indexes into
sony_laptop_input_keycode_map and not the "event" codes at all.

This patch (not yet tested) should fix the scancodes reported by
/lib/udev/keymap.

This just leaves a bug in the keymap files included with udev. I guess
the sony-laptop file in Documentation needs to say where to find the
scancodes.


diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index bbd182e..f148459 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)
struct input_dev *jog_dev = sony_laptop_input.jog_dev;
struct input_dev *key_dev = sony_laptop_input.key_dev;
struct sony_laptop_keypress kp = { NULL };
+ int scancode;

if (event == SONYPI_EVENT_FNKEY_RELEASED ||
event == SONYPI_EVENT_ANYBUTTON_RELEASED) {
@@ -380,8 +381,8 @@ static void sony_laptop_report_input_event(u8 event)
dprintk("sony_laptop_report_input_event, event not known: %d\n", event);
break;
}
- if (sony_laptop_input_index[event] != -1) {
- kp.key = sony_laptop_input_keycode_map[sony_laptop_input_index[event]];
+ if ((scancode = sony_laptop_input_index[event]) != -1) {
+ kp.key = sony_laptop_input_keycode_map[scancode];
if (kp.key != KEY_UNKNOWN)
kp.dev = key_dev;
}
@@ -389,9 +390,9 @@ static void sony_laptop_report_input_event(u8 event)
}

if (kp.dev) {
- input_report_key(kp.dev, kp.key, 1);
/* we emit the scancode so we can always remap the key */
- input_event(kp.dev, EV_MSC, MSC_SCAN, event);
+ input_event(kp.dev, EV_MSC, MSC_SCAN, scancode);
+ input_report_key(kp.dev, kp.key, 1);
input_sync(kp.dev);

/* schedule key release */
\
 
 \ /
  Last update: 2011-10-17 11:15    [W:0.146 / U:0.896 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site