* [PATCH 0/5] sony-laptop for 2.6.23
@ 2007-07-10 15:04 Mattia Dongili
2007-07-10 15:04 ` [PATCH 1/5] sony-laptop: add new SNC handlers Mattia Dongili
0 siblings, 1 reply; 6+ messages in thread
From: Mattia Dongili @ 2007-07-10 15:04 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi
Hi Len.
The following patches a targeted to 2.6.23.
Important changes include the scancode enabling work done by Richard Hughes and
support for some recent vaio models. More of them may be added later once I get
answers from users who I asked to run some tests.
Please apply.
Many thanks
---
drivers/misc/sony-laptop.c | 273 ++++++++++++++++++++++++++++++++++++---------
1 file changed, 221 insertions(+), 52 deletions(-)
--
mattia
:wq
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/5] sony-laptop: add new SNC handlers
2007-07-10 15:04 [PATCH 0/5] sony-laptop for 2.6.23 Mattia Dongili
@ 2007-07-10 15:04 ` Mattia Dongili
2007-07-10 15:04 ` [PATCH 2/5] sony-laptop: map wireless switch events to KEY_WLAN Mattia Dongili
0 siblings, 1 reply; 6+ messages in thread
From: Mattia Dongili @ 2007-07-10 15:04 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi, Mattia Dongili
- lid state: GLID
- indicator lamp: GILS/SILS
- multimedia bass gain: GMGB/CMGB
Signed-off-by: Mattia Dongili <malattia@linux.it>
---
drivers/misc/sony-laptop.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 9623eaf..0f378fe 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -487,6 +487,14 @@ SNC_HANDLE_NAMES(audiopower_set, "AZPW");
SNC_HANDLE_NAMES(lanpower_get, "GLNP");
SNC_HANDLE_NAMES(lanpower_set, "LNPW");
+SNC_HANDLE_NAMES(lidstate_get, "GLID");
+
+SNC_HANDLE_NAMES(indicatorlamp_get, "GILS");
+SNC_HANDLE_NAMES(indicatorlamp_set, "SILS");
+
+SNC_HANDLE_NAMES(gainbass_get, "GMGB");
+SNC_HANDLE_NAMES(gainbass_set, "CMGB");
+
SNC_HANDLE_NAMES(PID_get, "GPID");
SNC_HANDLE_NAMES(CTR_get, "GCTR");
@@ -507,6 +515,12 @@ static struct sony_nc_value sony_nc_values[] = {
boolean_validate, 0),
SNC_HANDLE(lanpower, snc_lanpower_get, snc_lanpower_set,
boolean_validate, 1),
+ SNC_HANDLE(lidstate, snc_lidstate_get, NULL,
+ boolean_validate, 0),
+ SNC_HANDLE(indicatorlamp, snc_indicatorlamp_get, snc_indicatorlamp_set,
+ boolean_validate, 0),
+ SNC_HANDLE(gainbass, snc_gainbass_get, snc_gainbass_set,
+ boolean_validate, 0),
/* unknown methods */
SNC_HANDLE(PID, snc_PID_get, NULL, NULL, 1),
SNC_HANDLE(CTR, snc_CTR_get, snc_CTR_set, NULL, 1),
--
1.5.2.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/5] sony-laptop: map wireless switch events to KEY_WLAN
2007-07-10 15:04 ` [PATCH 1/5] sony-laptop: add new SNC handlers Mattia Dongili
@ 2007-07-10 15:04 ` Mattia Dongili
2007-07-10 15:04 ` [PATCH 3/5] Add support for recent Vaios Fn keys (C series for now) Mattia Dongili
0 siblings, 1 reply; 6+ messages in thread
From: Mattia Dongili @ 2007-07-10 15:04 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi, Mattia Dongili
Signed-off-by: Mattia Dongili <malattia@linux.it>
---
drivers/misc/sony-laptop.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 0f378fe..142d660 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -177,6 +177,8 @@ static struct {
{ SONYPI_EVENT_BACK_PRESSED, KEY_BACK },
{ SONYPI_EVENT_HELP_PRESSED, KEY_HELP },
{ SONYPI_EVENT_ZOOM_PRESSED, KEY_ZOOM },
+ { SONYPI_EVENT_WIRELESS_ON, KEY_WLAN },
+ { SONYPI_EVENT_WIRELESS_OFF, KEY_WLAN },
{ SONYPI_EVENT_THUMBPHRASE_PRESSED, BTN_THUMB },
{ 0, 0 },
};
--
1.5.2.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/5] Add support for recent Vaios Fn keys (C series for now)
2007-07-10 15:04 ` [PATCH 2/5] sony-laptop: map wireless switch events to KEY_WLAN Mattia Dongili
@ 2007-07-10 15:04 ` Mattia Dongili
2007-07-10 15:04 ` [PATCH 4/5] Invoke _INI for SNC devices that provide it Mattia Dongili
0 siblings, 1 reply; 6+ messages in thread
From: Mattia Dongili @ 2007-07-10 15:04 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi, Mattia Dongili
Recent Vaios (C, AR, N, FE) need some special initialization
sequence to enable Fn keys interrupts through the Embedded
Controller. Moreover Fn keys have to be decoded internally
using ACPI methods to get the key code.
Thus a new DMI table to add SNC init time callbacks and new
mappings for model-specific key code to generic sony-laptop
code have been added.
Signed-off-by: Mattia Dongili <malattia@linux.it>
---
drivers/misc/sony-laptop.c | 107 ++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 104 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 142d660..43315be 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -705,13 +705,107 @@ static struct backlight_ops sony_backlight_ops = {
};
/*
+ * New SNC-only Vaios event mapping to driver known keys
+ */
+struct sony_nc_event {
+ u8 data;
+ u8 event;
+};
+
+static struct sony_nc_event *sony_nc_events;
+
+/* Vaio C* --maybe also FE*, N* and AR* ?-- special init sequence
+ * for Fn keys
+ */
+static int sony_nc_C_enable(struct dmi_system_id *id)
+{
+ int result = 0;
+
+ printk(KERN_NOTICE DRV_PFX "detected %s\n", id->ident);
+
+ sony_nc_events = id->driver_data;
+
+ if (acpi_callsetfunc(sony_nc_acpi_handle, "SN02", 0x4, &result) < 0
+ || acpi_callsetfunc(sony_nc_acpi_handle, "SN07", 0x2, &result) < 0
+ || acpi_callsetfunc(sony_nc_acpi_handle, "SN02", 0x10, &result) < 0
+ || acpi_callsetfunc(sony_nc_acpi_handle, "SN07", 0x0, &result) < 0
+ || acpi_callsetfunc(sony_nc_acpi_handle, "SN03", 0x2, &result) < 0
+ || acpi_callsetfunc(sony_nc_acpi_handle, "SN07", 0x101, &result) < 0) {
+ printk(KERN_WARNING DRV_PFX "failed to initialize SNC, some "
+ "functionalities may be missing\n");
+ return 1;
+ }
+ return 0;
+}
+
+static struct sony_nc_event sony_C_events[] = {
+ { 0x81, SONYPI_EVENT_FNKEY_F1 },
+ { 0x01, SONYPI_EVENT_FNKEY_RELEASED },
+ { 0x85, SONYPI_EVENT_FNKEY_F5 },
+ { 0x05, SONYPI_EVENT_FNKEY_RELEASED },
+ { 0x86, SONYPI_EVENT_FNKEY_F6 },
+ { 0x06, SONYPI_EVENT_FNKEY_RELEASED },
+ { 0x87, SONYPI_EVENT_FNKEY_F7 },
+ { 0x07, SONYPI_EVENT_FNKEY_RELEASED },
+ { 0x8A, SONYPI_EVENT_FNKEY_F10 },
+ { 0x0A, SONYPI_EVENT_FNKEY_RELEASED },
+ { 0x8C, SONYPI_EVENT_FNKEY_F12 },
+ { 0x0C, SONYPI_EVENT_FNKEY_RELEASED },
+ { 0, 0 },
+};
+
+/* SNC-only model map */
+struct dmi_system_id sony_nc_ids[] = {
+ {
+ .ident = "Sony Vaio C Series",
+ .callback = sony_nc_C_enable,
+ .driver_data = sony_C_events,
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "VGN-C"),
+ },
+ },
+ { }
+};
+
+/*
* ACPI callbacks
*/
static void sony_acpi_notify(acpi_handle handle, u32 event, void *data)
{
- dprintk("sony_acpi_notify, event: %d\n", event);
- sony_laptop_report_input_event(event);
- acpi_bus_generate_event(sony_nc_acpi_device, 1, event);
+ struct sony_nc_event *evmap;
+ u32 ev = event;
+ int result;
+
+ if (ev == 0x92) {
+ /* read the key pressed from EC.GECR
+ * A call to SN07 with 0x0202 will do it as well respecting
+ * the current protocol on different OSes
+ *
+ * Note: the path for GECR may be
+ * \_SB.PCI0.LPCB.EC (C, FE, AR, N and friends)
+ * \_SB.PCI0.PIB.EC0 (VGN-FR notifications are sent directly, no GECR)
+ *
+ * TODO: we may want to do the same for the older GHKE -need
+ * dmi list- so this snippet may become one more callback.
+ */
+ if (acpi_callsetfunc(handle, "SN07", 0x0202, &result) < 0)
+ dprintk("sony_acpi_notify, unable to decode event 0x%.2x\n", ev);
+ else
+ ev = result & 0xFF;
+ }
+
+ if (sony_nc_events)
+ for (evmap = sony_nc_events; evmap->event; evmap++) {
+ if (evmap->data == ev) {
+ ev = evmap->event;
+ break;
+ }
+ }
+
+ dprintk("sony_acpi_notify, event: 0x%.2x\n", ev);
+ sony_laptop_report_input_event(ev);
+ acpi_bus_generate_event(sony_nc_acpi_device, 1, ev);
}
static acpi_status sony_walk_callback(acpi_handle handle, u32 level,
@@ -748,6 +842,10 @@ static int sony_nc_resume(struct acpi_device *device)
break;
}
}
+
+ /* re-initialize models with specific requirements */
+ dmi_check_system(sony_nc_ids);
+
return 0;
}
@@ -811,6 +909,9 @@ static int sony_nc_add(struct acpi_device *device)
}
+ /* initialize models with specific requirements */
+ dmi_check_system(sony_nc_ids);
+
result = sony_pf_add();
if (result)
goto outbacklight;
--
1.5.2.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/5] Invoke _INI for SNC devices that provide it
2007-07-10 15:04 ` [PATCH 3/5] Add support for recent Vaios Fn keys (C series for now) Mattia Dongili
@ 2007-07-10 15:04 ` Mattia Dongili
2007-07-10 15:04 ` [PATCH 5/5] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table Mattia Dongili
0 siblings, 1 reply; 6+ messages in thread
From: Mattia Dongili @ 2007-07-10 15:04 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi, Mattia Dongili
Signed-off-by: Mattia Dongili <malattia@linux.it>
---
drivers/misc/sony-laptop.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 43315be..5300cad 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -864,6 +864,15 @@ static int sony_nc_add(struct acpi_device *device)
sony_nc_acpi_handle = device->handle;
+ /* read device status */
+ result = acpi_bus_get_status(device);
+ /* bail IFF the above call was successful and the device is not present */
+ if (!result && !device->status.present) {
+ dprintk("Device not present\n");
+ result = -ENODEV;
+ goto outwalk;
+ }
+
if (debug) {
status = acpi_walk_namespace(ACPI_TYPE_METHOD, sony_nc_acpi_handle,
1, sony_walk_callback, NULL, NULL);
@@ -874,6 +883,15 @@ static int sony_nc_add(struct acpi_device *device)
}
}
+ /* try to _INI the device if such method exists (ACPI spec 3.0-6.5.1
+ * should be respected as we already checked for the device presence above */
+ if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, METHOD_NAME__INI, &handle))) {
+ dprintk("Invoking _INI\n");
+ if (ACPI_FAILURE(acpi_evaluate_object(sony_nc_acpi_handle, METHOD_NAME__INI,
+ NULL, NULL)))
+ dprintk("_INI Method failed\n");
+ }
+
/* setup input devices and helper fifo */
result = sony_laptop_setup_input();
if (result) {
@@ -886,7 +904,7 @@ static int sony_nc_add(struct acpi_device *device)
ACPI_DEVICE_NOTIFY,
sony_acpi_notify, NULL);
if (ACPI_FAILURE(status)) {
- printk(KERN_WARNING DRV_PFX "unable to install notify handler\n");
+ printk(KERN_WARNING DRV_PFX "unable to install notify handler (%u)\n", status);
result = -ENODEV;
goto outinput;
}
--
1.5.2.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/5] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table.
2007-07-10 15:04 ` [PATCH 4/5] Invoke _INI for SNC devices that provide it Mattia Dongili
@ 2007-07-10 15:04 ` Mattia Dongili
0 siblings, 0 replies; 6+ messages in thread
From: Mattia Dongili @ 2007-07-10 15:04 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi, Richard Hughes, Dmitry Torokhov, Mattia Dongili
From: Richard Hughes <richard@hughsie.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Richard Hughes <richard@hughsie.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
---
drivers/misc/sony-laptop.c | 134 +++++++++++++++++++++++++++----------------
1 files changed, 84 insertions(+), 50 deletions(-)
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 5300cad..39d22b9 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -143,44 +143,69 @@ struct sony_laptop_keypress {
};
/* Correspondance table between sonypi events and input layer events */
-static struct {
- int sonypiev;
- int inputev;
-} sony_laptop_inputkeys[] = {
- { SONYPI_EVENT_CAPTURE_PRESSED, KEY_CAMERA },
- { SONYPI_EVENT_FNKEY_ONLY, KEY_FN },
- { SONYPI_EVENT_FNKEY_ESC, KEY_FN_ESC },
- { SONYPI_EVENT_FNKEY_F1, KEY_FN_F1 },
- { SONYPI_EVENT_FNKEY_F2, KEY_FN_F2 },
- { SONYPI_EVENT_FNKEY_F3, KEY_FN_F3 },
- { SONYPI_EVENT_FNKEY_F4, KEY_FN_F4 },
- { SONYPI_EVENT_FNKEY_F5, KEY_FN_F5 },
- { SONYPI_EVENT_FNKEY_F6, KEY_FN_F6 },
- { SONYPI_EVENT_FNKEY_F7, KEY_FN_F7 },
- { SONYPI_EVENT_FNKEY_F8, KEY_FN_F8 },
- { SONYPI_EVENT_FNKEY_F9, KEY_FN_F9 },
- { SONYPI_EVENT_FNKEY_F10, KEY_FN_F10 },
- { SONYPI_EVENT_FNKEY_F11, KEY_FN_F11 },
- { SONYPI_EVENT_FNKEY_F12, KEY_FN_F12 },
- { SONYPI_EVENT_FNKEY_1, KEY_FN_1 },
- { SONYPI_EVENT_FNKEY_2, KEY_FN_2 },
- { SONYPI_EVENT_FNKEY_D, KEY_FN_D },
- { SONYPI_EVENT_FNKEY_E, KEY_FN_E },
- { SONYPI_EVENT_FNKEY_F, KEY_FN_F },
- { SONYPI_EVENT_FNKEY_S, KEY_FN_S },
- { SONYPI_EVENT_FNKEY_B, KEY_FN_B },
- { SONYPI_EVENT_BLUETOOTH_PRESSED, KEY_BLUE },
- { SONYPI_EVENT_BLUETOOTH_ON, KEY_BLUE },
- { SONYPI_EVENT_PKEY_P1, KEY_PROG1 },
- { SONYPI_EVENT_PKEY_P2, KEY_PROG2 },
- { SONYPI_EVENT_PKEY_P3, KEY_PROG3 },
- { SONYPI_EVENT_BACK_PRESSED, KEY_BACK },
- { SONYPI_EVENT_HELP_PRESSED, KEY_HELP },
- { SONYPI_EVENT_ZOOM_PRESSED, KEY_ZOOM },
- { SONYPI_EVENT_WIRELESS_ON, KEY_WLAN },
- { SONYPI_EVENT_WIRELESS_OFF, KEY_WLAN },
- { SONYPI_EVENT_THUMBPHRASE_PRESSED, BTN_THUMB },
- { 0, 0 },
+static int sony_laptop_input_keycode_map[] = {
+ KEY_RESERVED, /* no event... */
+ KEY_RESERVED, /* SONYPI_EVENT_JOGDIAL_DOWN */
+ KEY_RESERVED, /* SONYPI_EVENT_JOGDIAL_UP */
+ KEY_RESERVED, /* SONYPI_EVENT_JOGDIAL_DOWN_PRESSED */
+ KEY_RESERVED, /* SONYPI_EVENT_JOGDIAL_UP_PRESSED */
+ KEY_RESERVED, /* SONYPI_EVENT_JOGDIAL_PRESSED */
+ KEY_RESERVED, /* SONYPI_EVENT_JOGDIAL_RELEASED */
+ KEY_CAMERA, /* SONYPI_EVENT_CAPTURE_PRESSED */
+ KEY_RESERVED, /* SONYPI_EVENT_CAPTURE_RELEASED */
+ KEY_RESERVED, /* SONYPI_EVENT_CAPTURE_PARTIALPRESSED */
+ KEY_RESERVED, /* SONYPI_EVENT_CAPTURE_PARTIALRELEASED */
+ KEY_FN_ESC, /* SONYPI_EVENT_FNKEY_ESC */
+ KEY_FN_F1, /* SONYPI_EVENT_FNKEY_F1 */
+ KEY_FN_F2, /* SONYPI_EVENT_FNKEY_F2 */
+ KEY_FN_F3, /* SONYPI_EVENT_FNKEY_F3 */
+ KEY_FN_F4, /* SONYPI_EVENT_FNKEY_F4 */
+ KEY_FN_F5, /* SONYPI_EVENT_FNKEY_F5 */
+ KEY_FN_F6, /* SONYPI_EVENT_FNKEY_F6 */
+ KEY_FN_F7, /* SONYPI_EVENT_FNKEY_F7 */
+ KEY_FN_F8, /* SONYPI_EVENT_FNKEY_F8 */
+ KEY_FN_F9, /* SONYPI_EVENT_FNKEY_F9 */
+ KEY_FN_F10, /* SONYPI_EVENT_FNKEY_F10 */
+ KEY_FN_F11, /* SONYPI_EVENT_FNKEY_F11 */
+ KEY_FN_F12, /* SONYPI_EVENT_FNKEY_F12 */
+ KEY_FN_F1, /* SONYPI_EVENT_FNKEY_1 */
+ KEY_FN_F2, /* SONYPI_EVENT_FNKEY_2 */
+ KEY_FN_D, /* SONYPI_EVENT_FNKEY_D */
+ KEY_FN_E, /* SONYPI_EVENT_FNKEY_E */
+ KEY_FN_F, /* SONYPI_EVENT_FNKEY_F */
+ KEY_FN_S, /* SONYPI_EVENT_FNKEY_S */
+ KEY_FN_B, /* SONYPI_EVENT_FNKEY_B */
+ KEY_BLUE, /* SONYPI_EVENT_BLUETOOTH_PRESSED */
+ KEY_PROG1, /* SONYPI_EVENT_PKEY_P1 */
+ KEY_PROG2, /* SONYPI_EVENT_PKEY_P2 */
+ KEY_PROG3, /* SONYPI_EVENT_PKEY_P3 */
+ KEY_BACK, /* SONYPI_EVENT_BACK_PRESSED */
+ KEY_RESERVED, /* SONYPI_EVENT_LID_CLOSED */
+ KEY_RESERVED, /* SONYPI_EVENT_LID_OPENED */
+ KEY_BLUE, /* SONYPI_EVENT_BLUETOOTH_ON */
+ KEY_BLUE, /* SONYPI_EVENT_BLUETOOTH_OFF */
+ KEY_HELP, /* SONYPI_EVENT_HELP_PRESSED */
+ KEY_FN, /* SONYPI_EVENT_FNKEY_ONLY */
+ KEY_RESERVED, /* SONYPI_EVENT_JOGDIAL_FAST_DOWN */
+ KEY_RESERVED, /* SONYPI_EVENT_JOGDIAL_FAST_UP */
+ KEY_RESERVED, /* SONYPI_EVENT_JOGDIAL_FAST_DOWN_PRESSED */
+ KEY_RESERVED, /* SONYPI_EVENT_JOGDIAL_FAST_UP_PRESSED */
+ KEY_RESERVED, /* SONYPI_EVENT_JOGDIAL_VFAST_DOWN */
+ KEY_RESERVED, /* SONYPI_EVENT_JOGDIAL_VFAST_UP */
+ KEY_RESERVED, /* SONYPI_EVENT_JOGDIAL_VFAST_DOWN_PRESSED */
+ KEY_RESERVED, /* SONYPI_EVENT_JOGDIAL_VFAST_UP_PRESSED */
+ KEY_ZOOM, /* SONYPI_EVENT_ZOOM_PRESSED */
+ BTN_THUMB, /* SONYPI_EVENT_THUMBPHRASE_PRESSED */
+ KEY_RESERVED, /* SONYPI_EVENT_MEYE_FACE */
+ KEY_RESERVED, /* SONYPI_EVENT_MEYE_OPPOSITE */
+ KEY_RESERVED, /* SONYPI_EVENT_MEMORYSTICK_INSERT */
+ KEY_RESERVED, /* SONYPI_EVENT_MEMORYSTICK_EJECT */
+ KEY_RESERVED, /* SONYPI_EVENT_ANYBUTTON_RELEASED */
+ KEY_RESERVED, /* SONYPI_EVENT_BATTERY_INSERT */
+ KEY_RESERVED, /* SONYPI_EVENT_BATTERY_REMOVE */
+ KEY_RESERVED, /* SONYPI_EVENT_FNKEY_RELEASED */
+ KEY_WLAN, /* SONYPI_EVENT_WIRELESS_ON */
+ KEY_WLAN, /* SONYPI_EVENT_WIRELESS_OFF */
};
/* release buttons after a short delay if pressed */
@@ -204,7 +229,6 @@ 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 i;
if (event == SONYPI_EVENT_FNKEY_RELEASED) {
/* Nothing, not all VAIOs generate this event */
@@ -233,17 +257,20 @@ static void sony_laptop_report_input_event(u8 event)
break;
default:
- for (i = 0; sony_laptop_inputkeys[i].sonypiev; i++)
- if (event == sony_laptop_inputkeys[i].sonypiev) {
- kp.dev = key_dev;
- kp.key = sony_laptop_inputkeys[i].inputev;
- break;
- }
+ if (event > ARRAY_SIZE (sony_laptop_input_keycode_map)) {
+ dprintk("sony_laptop_report_input_event, event not known: %d\n", event);
+ break;
+ }
+ kp.key = sony_laptop_input_keycode_map[event];
+ if (kp.key != KEY_UNKNOWN)
+ kp.dev = key_dev;
break;
}
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_sync(kp.dev);
kfifo_put(sony_laptop_input.fifo,
(unsigned char *)&kp, sizeof(kp));
@@ -298,11 +325,18 @@ static int sony_laptop_setup_input(void)
key_dev->id.vendor = PCI_VENDOR_ID_SONY;
/* Initialize the Input Drivers: special keys */
- key_dev->evbit[0] = BIT(EV_KEY);
- for (i = 0; sony_laptop_inputkeys[i].sonypiev; i++)
- if (sony_laptop_inputkeys[i].inputev)
- set_bit(sony_laptop_inputkeys[i].inputev,
- key_dev->keybit);
+ set_bit(EV_KEY, key_dev->evbit);
+ set_bit(EV_MSC, key_dev->evbit);
+ set_bit(MSC_SCAN, key_dev->mscbit);
+ key_dev->keycodesize = sizeof(sony_laptop_input_keycode_map[0]);
+ key_dev->keycodemax = ARRAY_SIZE(sony_laptop_input_keycode_map);
+ key_dev->keycode = &sony_laptop_input_keycode_map;
+ for (i = 0; i < ARRAY_SIZE(sony_laptop_input_keycode_map); i++) {
+ if (sony_laptop_input_keycode_map[i] != KEY_RESERVED) {
+ set_bit(sony_laptop_input_keycode_map[i],
+ key_dev->keybit);
+ }
+ }
error = input_register_device(key_dev);
if (error)
--
1.5.2.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-07-10 15:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-10 15:04 [PATCH 0/5] sony-laptop for 2.6.23 Mattia Dongili
2007-07-10 15:04 ` [PATCH 1/5] sony-laptop: add new SNC handlers Mattia Dongili
2007-07-10 15:04 ` [PATCH 2/5] sony-laptop: map wireless switch events to KEY_WLAN Mattia Dongili
2007-07-10 15:04 ` [PATCH 3/5] Add support for recent Vaios Fn keys (C series for now) Mattia Dongili
2007-07-10 15:04 ` [PATCH 4/5] Invoke _INI for SNC devices that provide it Mattia Dongili
2007-07-10 15:04 ` [PATCH 5/5] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table Mattia Dongili
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.