From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754215Ab1JQJNJ (ORCPT ); Mon, 17 Oct 2011 05:13:09 -0400 Received: from oceanic.CalvaEDI.COM ([89.202.194.168]:37054 "EHLO oceanic.CalvaEDI.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751244Ab1JQJNI (ORCPT ); Mon, 17 Oct 2011 05:13:08 -0400 X-Greylist: delayed 300 seconds by postgrey-1.27 at vger.kernel.org; Mon, 17 Oct 2011 05:13:07 EDT Message-ID: <4E9BF073.7000509@Calva.COM> Date: Mon, 17 Oct 2011 11:08:03 +0200 From: John Hughes User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20110818 Icedove/3.0.11 MIME-Version: 1.0 To: John Hughes CC: linux-kernel@vger.kernel.org, Mattia Dongili , Stelian Pop Subject: Re: Bug: changing keycodes generated by sony-laptop doesn't work References: <4E9ABBF6.3000504@calvaedi.com> <4E9ACE59.2000003@calvaedi.com> <4E9ADC7C.8030903@calvaedi.com> In-Reply-To: <4E9ADC7C.8030903@calvaedi.com> Content-Type: multipart/mixed; boundary="------------090905040409000403000708" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------090905040409000403000708 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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. --------------090905040409000403000708 Content-Type: text/x-patch; name="sony-scancode.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="sony-scancode.patch" 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 */ --------------090905040409000403000708--