All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Hughes <john@Calva.COM>
To: John Hughes <john@calvaedi.com>
Cc: linux-kernel@vger.kernel.org, Mattia Dongili <malattia@linux.it>,
	Stelian Pop <stelian@popies.net>
Subject: Re: Bug: changing keycodes generated by sony-laptop doesn't work
Date: Mon, 17 Oct 2011 11:08:03 +0200	[thread overview]
Message-ID: <4E9BF073.7000509@Calva.COM> (raw)
In-Reply-To: <4E9ADC7C.8030903@calvaedi.com>

[-- Attachment #1: Type: text/plain, Size: 590 bytes --]

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.



[-- Attachment #2: sony-scancode.patch --]
[-- Type: text/x-patch, Size: 1395 bytes --]

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 */

  reply	other threads:[~2011-10-17  9:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-16 11:11 sony-laptop driver: Volume keys on Sony Vaio TX3 don't work John Hughes
2011-10-16 12:30 ` Bug: changing keycodes generated by sony-laptop doesn't work John Hughes
2011-10-16 13:30   ` John Hughes
2011-10-17  9:08     ` John Hughes [this message]
2011-10-16 13:27 ` sony-laptop driver: Volume keys on Sony Vaio TX3 don't work John Hughes
2011-10-16 17:45   ` John Hughes
2011-10-16 18:20     ` Valdis.Kletnieks
2011-10-16 21:38       ` Mattia Dongili
2011-10-16 21:50         ` Valdis.Kletnieks
2011-10-16 23:17           ` John Hughes
2011-10-17 21:43             ` Mattia Dongili
2011-10-18  9:02               ` John Hughes
2011-10-17 21:45           ` Mattia Dongili
2011-10-18  9:07             ` John Hughes
2011-10-19 22:01               ` John Hughes
2011-10-16 23:13       ` John Hughes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E9BF073.7000509@Calva.COM \
    --to=john@calva.com \
    --cc=john@calvaedi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=malattia@linux.it \
    --cc=stelian@popies.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.