From 3d9b8132a5233342abd9017f5dd95a6bcd86e368 Mon Sep 17 00:00:00 2001 From: John Hughes Date: Thu, 8 Dec 2011 15:32:11 +1100 Subject: [PATCH] drivers-platform-x86-sony-laptopc-fix-scancodes-v2 Signed-off-by: John Hughes Cc: Dan Carpenter Cc: Mattia Dongili Cc: John Hughes Cc: Matthew Garrett Signed-off-by: Andrew Morton --- drivers/platform/x86/sony-laptop.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 26ef0f34e1be..b8f1b4704d04 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c @@ -347,7 +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; + int scancode = -1; if (event == SONYPI_EVENT_FNKEY_RELEASED || event == SONYPI_EVENT_ANYBUTTON_RELEASED) { @@ -391,8 +391,10 @@ static void sony_laptop_report_input_event(u8 event) } if (kp.dev) { - /* we emit the scancode so we can always remap the key */ - input_event(kp.dev, EV_MSC, MSC_SCAN, scancode); + /* if we have a scancode we emit it so we can always + remap the key */ + if (scancode != -1) + input_event(kp.dev, EV_MSC, MSC_SCAN, scancode); input_report_key(kp.dev, kp.key, 1); input_sync(kp.dev); @@ -468,7 +470,7 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device) jog_dev->name = "Sony Vaio Jogdial"; jog_dev->id.bustype = BUS_ISA; jog_dev->id.vendor = PCI_VENDOR_ID_SONY; - key_dev->dev.parent = &acpi_device->dev; + jog_dev->dev.parent = &acpi_device->dev; input_set_capability(jog_dev, EV_KEY, BTN_MIDDLE); input_set_capability(jog_dev, EV_REL, REL_WHEEL); -- 2.39.5