* [PATCH 0/7] sony-laptop for 2.6.23 (updated) @ 2007-07-15 17:34 Mattia Dongili 2007-07-15 17:34 ` [PATCH 1/7] sony-laptop: add new SNC handlers Mattia Dongili 2007-07-22 4:37 ` [PATCH 0/7] sony-laptop for 2.6.23 (updated) Len Brown 0 siblings, 2 replies; 30+ messages in thread From: Mattia Dongili @ 2007-07-15 17:34 UTC (permalink / raw) To: Len Brown; +Cc: linux-acpi, Stelian Pop Hi Len, These patches a targeted to 2.6.23. I updated the previous series with a couple more patches one of which fixes a bug present in 2.6.22 and that I'll push to the stable maintainers. Important changes include the scancode enabling work done by Richard Hughes and support for some recent vaio models. Many thanks --- drivers/misc/sony-laptop.c | 312 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 252 insertions(+), 60 deletions(-) -- mattia :wq ^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 1/7] sony-laptop: add new SNC handlers 2007-07-15 17:34 [PATCH 0/7] sony-laptop for 2.6.23 (updated) Mattia Dongili @ 2007-07-15 17:34 ` Mattia Dongili 2007-07-15 17:34 ` [PATCH 2/7] sony-laptop: map wireless switch events to KEY_WLAN Mattia Dongili 2007-07-22 4:37 ` [PATCH 0/7] sony-laptop for 2.6.23 (updated) Len Brown 1 sibling, 1 reply; 30+ messages in thread From: Mattia Dongili @ 2007-07-15 17:34 UTC (permalink / raw) To: Len Brown; +Cc: linux-acpi, Stelian Pop, 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 8ee0321..2063de7 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] 30+ messages in thread
* [PATCH 2/7] sony-laptop: map wireless switch events to KEY_WLAN 2007-07-15 17:34 ` [PATCH 1/7] sony-laptop: add new SNC handlers Mattia Dongili @ 2007-07-15 17:34 ` Mattia Dongili 2007-07-15 17:34 ` [PATCH 3/7] Add support for recent Vaios Fn keys (C series for now) Mattia Dongili 0 siblings, 1 reply; 30+ messages in thread From: Mattia Dongili @ 2007-07-15 17:34 UTC (permalink / raw) To: Len Brown; +Cc: linux-acpi, Stelian Pop, 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 2063de7..9e27616 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] 30+ messages in thread
* [PATCH 3/7] Add support for recent Vaios Fn keys (C series for now) 2007-07-15 17:34 ` [PATCH 2/7] sony-laptop: map wireless switch events to KEY_WLAN Mattia Dongili @ 2007-07-15 17:34 ` Mattia Dongili 2007-07-15 17:34 ` [PATCH 4/7] Invoke _INI for SNC devices that provide it Mattia Dongili 0 siblings, 1 reply; 30+ messages in thread From: Mattia Dongili @ 2007-07-15 17:34 UTC (permalink / raw) To: Len Brown; +Cc: linux-acpi, Stelian Pop, 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 9e27616..ecac39b 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] 30+ messages in thread
* [PATCH 4/7] Invoke _INI for SNC devices that provide it 2007-07-15 17:34 ` [PATCH 3/7] Add support for recent Vaios Fn keys (C series for now) Mattia Dongili @ 2007-07-15 17:34 ` Mattia Dongili 2007-07-15 17:34 ` [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table Mattia Dongili 0 siblings, 1 reply; 30+ messages in thread From: Mattia Dongili @ 2007-07-15 17:34 UTC (permalink / raw) To: Len Brown; +Cc: linux-acpi, Stelian Pop, 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 ecac39b..4b15f0c 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] 30+ messages in thread
* [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-15 17:34 ` [PATCH 4/7] Invoke _INI for SNC devices that provide it Mattia Dongili @ 2007-07-15 17:34 ` Mattia Dongili 2007-07-15 17:34 ` [PATCH 6/7] Add Vaio FE to the special init sequence Mattia Dongili ` (2 more replies) 0 siblings, 3 replies; 30+ messages in thread From: Mattia Dongili @ 2007-07-15 17:34 UTC (permalink / raw) To: Len Brown Cc: linux-acpi, Stelian Pop, 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 4b15f0c..916b477 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] 30+ messages in thread
* [PATCH 6/7] Add Vaio FE to the special init sequence 2007-07-15 17:34 ` [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table Mattia Dongili @ 2007-07-15 17:34 ` Mattia Dongili 2007-07-15 17:34 ` [PATCH 7/7] Fix event reading in sony-laptop Mattia Dongili 2007-07-15 21:11 ` [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table Matthew Garrett 2007-07-16 13:22 ` Dmitry Torokhov 2 siblings, 1 reply; 30+ messages in thread From: Mattia Dongili @ 2007-07-15 17:34 UTC (permalink / raw) To: Len Brown; +Cc: linux-acpi, Stelian Pop, Mattia Dongili The Vaio FE series uses the same sequence as Vaio C series Signed-off-by: Mattia Dongili <malattia@linux.it> --- drivers/misc/sony-laptop.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c index 916b477..6909714 100644 --- a/drivers/misc/sony-laptop.c +++ b/drivers/misc/sony-laptop.c @@ -791,6 +791,15 @@ static struct sony_nc_event sony_C_events[] = { /* SNC-only model map */ struct dmi_system_id sony_nc_ids[] = { { + .ident = "Sony Vaio FE 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-FE"), + }, + }, + { .ident = "Sony Vaio C Series", .callback = sony_nc_C_enable, .driver_data = sony_C_events, -- 1.5.2.3 ^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 7/7] Fix event reading in sony-laptop 2007-07-15 17:34 ` [PATCH 6/7] Add Vaio FE to the special init sequence Mattia Dongili @ 2007-07-15 17:34 ` Mattia Dongili 0 siblings, 0 replies; 30+ messages in thread From: Mattia Dongili @ 2007-07-15 17:34 UTC (permalink / raw) To: Len Brown; +Cc: linux-acpi, Stelian Pop, Mattia Dongili, Andrei Paskevich The rewritten event reading code from sonypi was absolutely wrong, this patche makes things functional for type2 and type1 models. Cc: Andrei Paskevich <andrei@capet.iut-fbleau.fr> Signed-off-by: Mattia Dongili <malattia@linux.it> --- drivers/misc/sony-laptop.c | 30 ++++++++++++++++++++++-------- 1 files changed, 22 insertions(+), 8 deletions(-) diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c index 6909714..4831e72 100644 --- a/drivers/misc/sony-laptop.c +++ b/drivers/misc/sony-laptop.c @@ -1086,7 +1086,9 @@ static struct acpi_driver sony_nc_driver = { #define SONYPI_DEVICE_TYPE2 0x00000002 #define SONYPI_DEVICE_TYPE3 0x00000004 -#define SONY_PIC_EV_MASK 0xff +#define SONYPI_TYPE1_OFFSET 0x04 +#define SONYPI_TYPE2_OFFSET 0x12 +#define SONYPI_TYPE3_OFFSET 0x12 struct sony_pic_ioport { struct acpi_resource_io io; @@ -1100,6 +1102,7 @@ struct sony_pic_irq { struct sony_pic_dev { int model; + u16 evport_offset; u8 camera_power; u8 bluetooth_power; u8 wwan_power; @@ -2176,20 +2179,17 @@ end: static irqreturn_t sony_pic_irq(int irq, void *dev_id) { int i, j; - u32 port_val = 0; u8 ev = 0; u8 data_mask = 0; u8 device_event = 0; struct sony_pic_dev *dev = (struct sony_pic_dev *) dev_id; - acpi_os_read_port(dev->cur_ioport->io.minimum, &port_val, - dev->cur_ioport->io.address_length); - ev = port_val & SONY_PIC_EV_MASK; - data_mask = 0xff & (port_val >> (dev->cur_ioport->io.address_length - 8)); + ev = inb_p(dev->cur_ioport->io.minimum); + data_mask = inb_p(dev->cur_ioport->io.minimum + dev->evport_offset); - dprintk("event (0x%.8x [%.2x] [%.2x]) at port 0x%.4x\n", - port_val, ev, data_mask, dev->cur_ioport->io.minimum); + dprintk("event ([%.2x] [%.2x]) at port 0x%.4x(+0x%.2x)\n", + ev, data_mask, dev->cur_ioport->io.minimum, dev->evport_offset); if (ev == 0x00 || ev == 0xff) return IRQ_HANDLED; @@ -2280,6 +2280,20 @@ static int sony_pic_add(struct acpi_device *device) spic_dev.model = sony_pic_detect_device_type(); mutex_init(&spic_dev.lock); + /* model specific characteristics */ + switch(spic_dev.model) { + case SONYPI_DEVICE_TYPE1: + spic_dev.evport_offset = SONYPI_TYPE1_OFFSET; + break; + case SONYPI_DEVICE_TYPE3: + spic_dev.evport_offset = SONYPI_TYPE3_OFFSET; + break; + case SONYPI_DEVICE_TYPE2: + default: + spic_dev.evport_offset = SONYPI_TYPE2_OFFSET; + break; + } + /* read _PRS resources */ result = sony_pic_possible_resources(device); if (result) { -- 1.5.2.3 ^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-15 17:34 ` [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table Mattia Dongili 2007-07-15 17:34 ` [PATCH 6/7] Add Vaio FE to the special init sequence Mattia Dongili @ 2007-07-15 21:11 ` Matthew Garrett 2007-07-16 17:06 ` Richard Hughes 2007-07-16 13:22 ` Dmitry Torokhov 2 siblings, 1 reply; 30+ messages in thread From: Matthew Garrett @ 2007-07-15 21:11 UTC (permalink / raw) To: Mattia Dongili Cc: Len Brown, linux-acpi, Stelian Pop, Richard Hughes, Dmitry Torokhov On Mon, Jul 16, 2007 at 02:34:37AM +0900, Mattia Dongili wrote: > + /* we emit the scancode so we can always remap the key */ > + input_event(kp.dev, EV_MSC, MSC_SCAN, event); As I said to Henrique, I don't think this is the right solution. We know what these keys do - we should send the appropriate keycode, rather than asking userspace to remap it. -- Matthew Garrett | mjg59@srcf.ucam.org ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-15 21:11 ` [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table Matthew Garrett @ 2007-07-16 17:06 ` Richard Hughes 2007-07-16 18:09 ` Matthew Garrett 0 siblings, 1 reply; 30+ messages in thread From: Richard Hughes @ 2007-07-16 17:06 UTC (permalink / raw) To: Matthew Garrett Cc: Mattia Dongili, Len Brown, linux-acpi, Stelian Pop, Richard Hughes, Dmitry Torokhov On Sun, 2007-07-15 at 22:11 +0100, Matthew Garrett wrote: > On Mon, Jul 16, 2007 at 02:34:37AM +0900, Mattia Dongili wrote: > > + /* we emit the scancode so we can always remap the key */ > > + input_event(kp.dev, EV_MSC, MSC_SCAN, event); > > As I said to Henrique, I don't think this is the right solution. We know > what these keys do - we should send the appropriate keycode, rather than > asking userspace to remap it. We don't - the decal on FnF2 changes between different models, and I'm sure others are the same. Richard. ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-16 17:06 ` Richard Hughes @ 2007-07-16 18:09 ` Matthew Garrett 2007-07-17 10:37 ` Richard Hughes 0 siblings, 1 reply; 30+ messages in thread From: Matthew Garrett @ 2007-07-16 18:09 UTC (permalink / raw) To: Richard Hughes Cc: Mattia Dongili, Len Brown, linux-acpi, Stelian Pop, Richard Hughes, Dmitry Torokhov On Mon, Jul 16, 2007 at 06:06:05PM +0100, Richard Hughes wrote: > On Sun, 2007-07-15 at 22:11 +0100, Matthew Garrett wrote: > > On Mon, Jul 16, 2007 at 02:34:37AM +0900, Mattia Dongili wrote: > > > + /* we emit the scancode so we can always remap the key */ > > > + input_event(kp.dev, EV_MSC, MSC_SCAN, event); > > > > As I said to Henrique, I don't think this is the right solution. We know > > what these keys do - we should send the appropriate keycode, rather than > > asking userspace to remap it. > > We don't - the decal on FnF2 changes between different models, and I'm > sure others are the same. That's fine, we have information that lets us distinguish between models. -- Matthew Garrett | mjg59@srcf.ucam.org ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-16 18:09 ` Matthew Garrett @ 2007-07-17 10:37 ` Richard Hughes 2007-07-17 10:46 ` Matthew Garrett 2007-07-18 11:45 ` Mattia Dongili 0 siblings, 2 replies; 30+ messages in thread From: Richard Hughes @ 2007-07-17 10:37 UTC (permalink / raw) To: Matthew Garrett Cc: Mattia Dongili, Len Brown, linux-acpi, Stelian Pop, Richard Hughes, Dmitry Torokhov On Mon, 2007-07-16 at 19:09 +0100, Matthew Garrett wrote: > > That's fine, we have information that lets us distinguish between > models. Yes, but the consensus I seemed to get from previous mails was that the matching quirks should be done in userspace where possible. The current FDI thing lets a user edit a simple text xml file and stuff just works. I'm not sure asking user to compile custom kernel modules to test out new keymaps is feasible, at least for the majority of linux users. Richard. ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-17 10:37 ` Richard Hughes @ 2007-07-17 10:46 ` Matthew Garrett 2007-07-18 11:45 ` Mattia Dongili 1 sibling, 0 replies; 30+ messages in thread From: Matthew Garrett @ 2007-07-17 10:46 UTC (permalink / raw) To: Richard Hughes Cc: Mattia Dongili, Len Brown, linux-acpi, Stelian Pop, Richard Hughes, Dmitry Torokhov On Tue, Jul 17, 2007 at 11:37:33AM +0100, Richard Hughes wrote: > On Mon, 2007-07-16 at 19:09 +0100, Matthew Garrett wrote: > > > > That's fine, we have information that lets us distinguish between > > models. > > Yes, but the consensus I seemed to get from previous mails was that the > matching quirks should be done in userspace where possible. The current > FDI thing lets a user edit a simple text xml file and stuff just works. > I'm not sure asking user to compile custom kernel modules to test out > new keymaps is feasible, at least for the majority of linux users. That doesn't match what the kernel currently does. It's still possible to send the custom scancode (unless I'm entirely misreading this) and remap if the user genuinely does have a weird keymap, so all you're doing is moving small tables from one part of disk to the other - they'll be flagged __initdata, so there's no runtime overhead. On the other hand, you get the advantage that the keys just work. -- Matthew Garrett | mjg59@srcf.ucam.org ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-17 10:37 ` Richard Hughes 2007-07-17 10:46 ` Matthew Garrett @ 2007-07-18 11:45 ` Mattia Dongili 2007-07-18 14:28 ` Matthew Garrett 1 sibling, 1 reply; 30+ messages in thread From: Mattia Dongili @ 2007-07-18 11:45 UTC (permalink / raw) To: Richard Hughes Cc: Matthew Garrett, Len Brown, linux-acpi, Stelian Pop, Richard Hughes, Dmitry Torokhov On Tue, Jul 17, 2007 at 11:37:33AM +0100, Richard Hughes wrote: > On Mon, 2007-07-16 at 19:09 +0100, Matthew Garrett wrote: > > > > That's fine, we have information that lets us distinguish between > > models. Well, I don't think we have all, at least I don't and anyway it's nice to have some way to add new models that doesn't require waiting for a new kernel to be available. > Yes, but the consensus I seemed to get from previous mails was that the > matching quirks should be done in userspace where possible. The current > FDI thing lets a user edit a simple text xml file and stuff just works. > I'm not sure asking user to compile custom kernel modules to test out > new keymaps is feasible, at least for the majority of linux users. Yep, I agree. -- mattia :wq! ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-18 11:45 ` Mattia Dongili @ 2007-07-18 14:28 ` Matthew Garrett 2007-07-18 15:05 ` Dmitry Torokhov 2007-07-19 15:51 ` Mattia Dongili 0 siblings, 2 replies; 30+ messages in thread From: Matthew Garrett @ 2007-07-18 14:28 UTC (permalink / raw) To: Mattia Dongili Cc: Richard Hughes, Len Brown, linux-acpi, Stelian Pop, Richard Hughes, Dmitry Torokhov On Wed, Jul 18, 2007 at 08:45:19PM +0900, Mattia Dongili wrote: > On Tue, Jul 17, 2007 at 11:37:33AM +0100, Richard Hughes wrote: > > On Mon, 2007-07-16 at 19:09 +0100, Matthew Garrett wrote: > > > > > > That's fine, we have information that lets us distinguish between > > > models. > > Well, I don't think we have all, at least I don't and anyway it's nice > to have some way to add new models that doesn't require waiting for a new > kernel to be available. They can still be overridden in exactly the same way - it's just a question of sending useful defaults on most machines. If a user finds that the defaults don't work they can still be remapped via hal, but the aim should be for that to be unnecessary where possible. -- Matthew Garrett | mjg59@srcf.ucam.org ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-18 14:28 ` Matthew Garrett @ 2007-07-18 15:05 ` Dmitry Torokhov 2007-07-18 15:17 ` Richard Hughes 2007-07-19 15:51 ` Mattia Dongili 1 sibling, 1 reply; 30+ messages in thread From: Dmitry Torokhov @ 2007-07-18 15:05 UTC (permalink / raw) To: Matthew Garrett Cc: Mattia Dongili, Richard Hughes, Len Brown, linux-acpi, Stelian Pop, Richard Hughes On 7/18/07, Matthew Garrett <mjg59@srcf.ucam.org> wrote: > On Wed, Jul 18, 2007 at 08:45:19PM +0900, Mattia Dongili wrote: > > On Tue, Jul 17, 2007 at 11:37:33AM +0100, Richard Hughes wrote: > > > On Mon, 2007-07-16 at 19:09 +0100, Matthew Garrett wrote: > > > > > > > > That's fine, we have information that lets us distinguish between > > > > models. > > > > Well, I don't think we have all, at least I don't and anyway it's nice > > to have some way to add new models that doesn't require waiting for a new > > kernel to be available. > > They can still be overridden in exactly the same way - it's just a > question of sending useful defaults on most machines. If a user finds > that the defaults don't work they can still be remapped via hal, but the > aim should be for that to be unnecessary where possible. > I guess it all depends on how well HAL updates will be integrated with distributions and whether users update kernels more often than the rest of the system. For example I am still using FC 3 (I was going to upgrade to 7 but I guess it won't happen until 8 is released ;) ) so for me kernel is better ;) I think we should continue adding keymaps to kernel until everyone is using HAL's facilities to load keymaps and then stop. Does this make sense? -- Dmitry ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-18 15:05 ` Dmitry Torokhov @ 2007-07-18 15:17 ` Richard Hughes 2007-07-18 16:02 ` Dmitry Torokhov 2007-07-18 16:25 ` Matthew Garrett 0 siblings, 2 replies; 30+ messages in thread From: Richard Hughes @ 2007-07-18 15:17 UTC (permalink / raw) To: Dmitry Torokhov Cc: Matthew Garrett, Mattia Dongili, Len Brown, linux-acpi, Stelian Pop, Richard Hughes On Wed, 2007-07-18 at 11:05 -0400, Dmitry Torokhov wrote: > > I think we should continue adding keymaps to kernel until everyone is > using HAL's facilities to load keymaps and then stop. Does this make > sense? I don't think so. The whole idea of hal-info is that we can update a 14k noarch package every week if needed, that will work on pretty much any hal version. I'm not sure people running FC3 systems are going to be running git kernels for new keymaps. Richard. ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-18 15:17 ` Richard Hughes @ 2007-07-18 16:02 ` Dmitry Torokhov 2007-07-18 16:20 ` Richard Hughes 2007-07-18 16:25 ` Matthew Garrett 1 sibling, 1 reply; 30+ messages in thread From: Dmitry Torokhov @ 2007-07-18 16:02 UTC (permalink / raw) To: Richard Hughes Cc: Matthew Garrett, Mattia Dongili, Len Brown, linux-acpi, Stelian Pop, Richard Hughes On 7/18/07, Richard Hughes <hughsient@gmail.com> wrote: > On Wed, 2007-07-18 at 11:05 -0400, Dmitry Torokhov wrote: > > > > I think we should continue adding keymaps to kernel until everyone is > > using HAL's facilities to load keymaps and then stop. Does this make > > sense? > > I don't think so. The whole idea of hal-info is that we can update a 14k > noarch package every week if needed, that will work on pretty much any > hal version. > > I'm not sure people running FC3 systems are going to be running git > kernels for new keymaps. > What distributions cirrently use the new HAL facilities? I am not saying that we want support FC3 but what about FC6, FC7? Ubuntu, Debian? -- Dmitry ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-18 16:02 ` Dmitry Torokhov @ 2007-07-18 16:20 ` Richard Hughes 0 siblings, 0 replies; 30+ messages in thread From: Richard Hughes @ 2007-07-18 16:20 UTC (permalink / raw) To: Dmitry Torokhov Cc: Matthew Garrett, Mattia Dongili, Len Brown, linux-acpi, Stelian Pop, Richard Hughes On Wed, 2007-07-18 at 12:02 -0400, Dmitry Torokhov wrote: > What distributions cirrently use the new HAL facilities? I am not > saying that we want support FC3 but what about FC6, FC7? Ubuntu, > Debian? Currently Fedora and RHEL 5.1 but I believe ubuntu has plans for gutsy. Basically if you use a new HAL (>=0.5.9), you have to use hal-info. Distro's will have to comply :-) Richard. ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-18 15:17 ` Richard Hughes 2007-07-18 16:02 ` Dmitry Torokhov @ 2007-07-18 16:25 ` Matthew Garrett 2007-07-18 16:39 ` Dmitry Torokhov 2007-07-18 16:44 ` Richard Hughes 1 sibling, 2 replies; 30+ messages in thread From: Matthew Garrett @ 2007-07-18 16:25 UTC (permalink / raw) To: Richard Hughes Cc: Dmitry Torokhov, Mattia Dongili, Len Brown, linux-acpi, Stelian Pop, Richard Hughes On Wed, Jul 18, 2007 at 04:17:02PM +0100, Richard Hughes wrote: > On Wed, 2007-07-18 at 11:05 -0400, Dmitry Torokhov wrote: > > > > I think we should continue adding keymaps to kernel until everyone is > > using HAL's facilities to load keymaps and then stop. Does this make > > sense? > > I don't think so. The whole idea of hal-info is that we can update a 14k > noarch package every week if needed, that will work on pretty much any > hal version. > > I'm not sure people running FC3 systems are going to be running git > kernels for new keymaps. This isn't an either/or situation. If you have a hal keymap then the system will still work. The question is what to do in the absence of hal. The kernel can either provide sane defaults (that might be wrong in a couple of cases) or it can provide keys that are pretty much guaranteed to do nothing. I think doing our best to make things work even if hal isn't there is sensible - if hal /is/ there, we've lost nothing. -- Matthew Garrett | mjg59@srcf.ucam.org ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-18 16:25 ` Matthew Garrett @ 2007-07-18 16:39 ` Dmitry Torokhov 2007-07-18 16:44 ` Richard Hughes 1 sibling, 0 replies; 30+ messages in thread From: Dmitry Torokhov @ 2007-07-18 16:39 UTC (permalink / raw) To: Matthew Garrett Cc: Richard Hughes, Mattia Dongili, Len Brown, linux-acpi, Stelian Pop, Richard Hughes On 7/18/07, Matthew Garrett <mjg59@srcf.ucam.org> wrote: > On Wed, Jul 18, 2007 at 04:17:02PM +0100, Richard Hughes wrote: > > On Wed, 2007-07-18 at 11:05 -0400, Dmitry Torokhov wrote: > > > > > > I think we should continue adding keymaps to kernel until everyone is > > > using HAL's facilities to load keymaps and then stop. Does this make > > > sense? > > > > I don't think so. The whole idea of hal-info is that we can update a 14k > > noarch package every week if needed, that will work on pretty much any > > hal version. > > > > I'm not sure people running FC3 systems are going to be running git > > kernels for new keymaps. > > This isn't an either/or situation. If you have a hal keymap then the > system will still work. The question is what to do in the absence of > hal. The kernel can either provide sane defaults (that might be wrong in > a couple of cases) or it can provide keys that are pretty much > guaranteed to do nothing. I think doing our best to make things work > even if hal isn't there is sensible - if hal /is/ there, we've lost > nothing. > There is burden in maintaining the same data in 2 different places (kernel/HAL). I think pretty soon everyone will be using never HAL (like everyone uses udev) and we can stop adding keymaps into kernel. But for now if we want to support not so outdated distributions we can add keymaps to the kernel drivers. -- Dmitry ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-18 16:25 ` Matthew Garrett 2007-07-18 16:39 ` Dmitry Torokhov @ 2007-07-18 16:44 ` Richard Hughes 2007-07-18 16:56 ` Matthew Garrett 1 sibling, 1 reply; 30+ messages in thread From: Richard Hughes @ 2007-07-18 16:44 UTC (permalink / raw) To: Matthew Garrett Cc: Dmitry Torokhov, Mattia Dongili, Len Brown, linux-acpi, Stelian Pop, Richard Hughes On Wed, 2007-07-18 at 17:25 +0100, Matthew Garrett wrote: > This isn't an either/or situation. If you have a hal keymap then the > system will still work. The question is what to do in the absence of > hal. The kernel can either provide sane defaults (that might be wrong > in a couple of cases) or it can provide keys that are pretty much > guaranteed to do nothing. I think doing our best to make things work > even if hal isn't there is sensible - if hal /is/ there, we've lost > nothing. The only reason we set the keys to KEY_UNKNOWN is so we still emit acpi events (and not change the interface) if we are using an old HAL to not break stuff like acpid and tpd. We could just do: * emit acpi event _and_ input event if we probably know the button * just emit input events (for known keys) and just don't emit any acpi events at all Richard. ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-18 16:44 ` Richard Hughes @ 2007-07-18 16:56 ` Matthew Garrett 0 siblings, 0 replies; 30+ messages in thread From: Matthew Garrett @ 2007-07-18 16:56 UTC (permalink / raw) To: Richard Hughes Cc: Dmitry Torokhov, Mattia Dongili, Len Brown, linux-acpi, Stelian Pop, Richard Hughes On Wed, Jul 18, 2007 at 05:44:19PM +0100, Richard Hughes wrote: > On Wed, 2007-07-18 at 17:25 +0100, Matthew Garrett wrote: > > This isn't an either/or situation. If you have a hal keymap then the > > system will still work. The question is what to do in the absence of > > hal. The kernel can either provide sane defaults (that might be wrong > > in a couple of cases) or it can provide keys that are pretty much > > guaranteed to do nothing. I think doing our best to make things work > > even if hal isn't there is sensible - if hal /is/ there, we've lost > > nothing. > > The only reason we set the keys to KEY_UNKNOWN is so we still emit acpi > events (and not change the interface) if we are using an old HAL to not > break stuff like acpid and tpd. I was thinking more of the ones that are just flagged as KEY_FN_F1 at the moment. -- Matthew Garrett | mjg59@srcf.ucam.org ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-18 14:28 ` Matthew Garrett 2007-07-18 15:05 ` Dmitry Torokhov @ 2007-07-19 15:51 ` Mattia Dongili 1 sibling, 0 replies; 30+ messages in thread From: Mattia Dongili @ 2007-07-19 15:51 UTC (permalink / raw) To: Matthew Garrett Cc: Richard Hughes, Len Brown, linux-acpi, Stelian Pop, Richard Hughes, Dmitry Torokhov On Wed, Jul 18, 2007 at 03:28:01PM +0100, Matthew Garrett wrote: > On Wed, Jul 18, 2007 at 08:45:19PM +0900, Mattia Dongili wrote: > > On Tue, Jul 17, 2007 at 11:37:33AM +0100, Richard Hughes wrote: > > > On Mon, 2007-07-16 at 19:09 +0100, Matthew Garrett wrote: > > > > > > > > That's fine, we have information that lets us distinguish between > > > > models. > > > > Well, I don't think we have all, at least I don't and anyway it's nice > > to have some way to add new models that doesn't require waiting for a new > > kernel to be available. > > They can still be overridden in exactly the same way - it's just a > question of sending useful defaults on most machines. If a user finds > that the defaults don't work they can still be remapped via hal, but the > aim should be for that to be unnecessary where possible. BTW, isn't backward compatibility an issue here? How do input devices deal with changes in keycodes they send? -- mattia :wq! ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-15 17:34 ` [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table Mattia Dongili 2007-07-15 17:34 ` [PATCH 6/7] Add Vaio FE to the special init sequence Mattia Dongili 2007-07-15 21:11 ` [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table Matthew Garrett @ 2007-07-16 13:22 ` Dmitry Torokhov 2007-07-18 11:33 ` Mattia Dongili 2007-07-18 11:45 ` Mattia Dongili 2 siblings, 2 replies; 30+ messages in thread From: Dmitry Torokhov @ 2007-07-16 13:22 UTC (permalink / raw) To: Mattia Dongili; +Cc: Len Brown, linux-acpi, Stelian Pop, Richard Hughes Hi Mattia, On 7/15/07, Mattia Dongili <malattia@linux.it> wrote: > +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 */ Jogdial events are never passed through key_dev, do they? If so then we should not allow remapping them as it is pointless. EVCSKEYCODE shoudl return -EINVAL wehn trying to remap them. > + 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_BLUE is a blue-colored key on some Remote Controls. You want KEY_BLUETOOTH here. > + 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 */ EV_SW/SW_LID unless LID events are delivered through ACPI (in which case we should hide these events completely). > + KEY_BLUE, /* SONYPI_EVENT_BLUETOOTH_ON */ > + KEY_BLUE, /* SONYPI_EVENT_BLUETOOTH_OFF */ KEY_BLUETOOTH. > + 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 */ Do we really want let userspace remap this event? > + 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); Looks like whitespace damage here... -- Dmitry ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-16 13:22 ` Dmitry Torokhov @ 2007-07-18 11:33 ` Mattia Dongili 2007-07-19 17:01 ` Mattia Dongili 2007-07-18 11:45 ` Mattia Dongili 1 sibling, 1 reply; 30+ messages in thread From: Mattia Dongili @ 2007-07-18 11:33 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: Len Brown, linux-acpi, Stelian Pop, Richard Hughes On Mon, Jul 16, 2007 at 09:22:28AM -0400, Dmitry Torokhov wrote: > Hi Mattia, > > On 7/15/07, Mattia Dongili <malattia@linux.it> wrote: >> +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 */ > > Jogdial events are never passed through key_dev, do they? If so then > we should not allow remapping them as it is pointless. EVCSKEYCODE > shoudl return -EINVAL wehn trying to remap them. yes, JOG events are going to the other input_dev. ... >> + KEY_RESERVED, /* SONYPI_EVENT_LID_CLOSED */ >> + KEY_RESERVED, /* SONYPI_EVENT_LID_OPENED */ > > EV_SW/SW_LID unless LID events are delivered through ACPI (in which > case we should hide these events completely). every event except jogdial's is also being delivered through ACPI. Will hide these from input then. ... >> + KEY_RESERVED, /* SONYPI_EVENT_ANYBUTTON_RELEASED */ >> + KEY_RESERVED, /* SONYPI_EVENT_BATTERY_INSERT */ >> + KEY_RESERVED, /* SONYPI_EVENT_BATTERY_REMOVE */ ACPI only stuff as well? >> + KEY_RESERVED, /* SONYPI_EVENT_FNKEY_RELEASED */ > > Do we really want let userspace remap this event? hehehe, no, I don't think so. Thanks for the comments -- mattia :wq! ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-18 11:33 ` Mattia Dongili @ 2007-07-19 17:01 ` Mattia Dongili 2007-07-22 4:36 ` Len Brown 0 siblings, 1 reply; 30+ messages in thread From: Mattia Dongili @ 2007-07-19 17:01 UTC (permalink / raw) To: Dmitry Torokhov Cc: Len Brown, linux-acpi, Stelian Pop, Richard Hughes, Matthew Garrett Hi, the following is the only way I could think of to hide some events as per Dmitry suggestions while still using the default {set,get}keycode implementation. Unfortunately I don't have enough time to put more work in the sony-laptop module right now. I'll send an updated patch series later (tomorrow?). commit 20c3d84c721706fd0893ba5f73c1b4f1c231322b Author: Richard Hughes <richard@hughsie.com> Date: Fri Jul 20 01:41:57 2007 +0900 Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Richard Hughes <richard@hughsie.com> Signed-off-by: Mattia Dongili <malattia@linux.it> diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c index 5300cad..af69b3b 100644 --- a/drivers/misc/sony-laptop.c +++ b/drivers/misc/sony-laptop.c @@ -142,45 +142,124 @@ struct sony_laptop_keypress { int key; }; -/* 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 }, +/* Correspondance table between sonypi events + * and input layer indexes in the keymap + */ +static int sony_laptop_input_index[] = { + -1, /* no event */ + -1, /* SONYPI_EVENT_JOGDIAL_DOWN */ + -1, /* SONYPI_EVENT_JOGDIAL_UP */ + -1, /* SONYPI_EVENT_JOGDIAL_DOWN_PRESSED */ + -1, /* SONYPI_EVENT_JOGDIAL_UP_PRESSED */ + -1, /* SONYPI_EVENT_JOGDIAL_PRESSED */ + -1, /* SONYPI_EVENT_JOGDIAL_RELEASED */ + 0, /* SONYPI_EVENT_CAPTURE_PRESSED */ + 1, /* SONYPI_EVENT_CAPTURE_RELEASED */ + 2, /* SONYPI_EVENT_CAPTURE_PARTIALPRESSED */ + 3, /* SONYPI_EVENT_CAPTURE_PARTIALRELEASED */ + 4, /* SONYPI_EVENT_FNKEY_ESC */ + 5, /* SONYPI_EVENT_FNKEY_F1 */ + 6, /* SONYPI_EVENT_FNKEY_F2 */ + 7, /* SONYPI_EVENT_FNKEY_F3 */ + 8, /* SONYPI_EVENT_FNKEY_F4 */ + 9, /* SONYPI_EVENT_FNKEY_F5 */ + 10, /* SONYPI_EVENT_FNKEY_F6 */ + 11, /* SONYPI_EVENT_FNKEY_F7 */ + 12, /* SONYPI_EVENT_FNKEY_F8 */ + 13, /* SONYPI_EVENT_FNKEY_F9 */ + 14, /* SONYPI_EVENT_FNKEY_F10 */ + 15, /* SONYPI_EVENT_FNKEY_F11 */ + 16, /* SONYPI_EVENT_FNKEY_F12 */ + 17, /* SONYPI_EVENT_FNKEY_1 */ + 18, /* SONYPI_EVENT_FNKEY_2 */ + 19, /* SONYPI_EVENT_FNKEY_D */ + 20, /* SONYPI_EVENT_FNKEY_E */ + 21, /* SONYPI_EVENT_FNKEY_F */ + 22, /* SONYPI_EVENT_FNKEY_S */ + 23, /* SONYPI_EVENT_FNKEY_B */ + 24, /* SONYPI_EVENT_BLUETOOTH_PRESSED */ + 25, /* SONYPI_EVENT_PKEY_P1 */ + 26, /* SONYPI_EVENT_PKEY_P2 */ + 27, /* SONYPI_EVENT_PKEY_P3 */ + 28, /* SONYPI_EVENT_BACK_PRESSED */ + -1, /* SONYPI_EVENT_LID_CLOSED */ + -1, /* SONYPI_EVENT_LID_OPENED */ + 29, /* SONYPI_EVENT_BLUETOOTH_ON */ + 30, /* SONYPI_EVENT_BLUETOOTH_OFF */ + 31, /* SONYPI_EVENT_HELP_PRESSED */ + 32, /* SONYPI_EVENT_FNKEY_ONLY */ + 33, /* SONYPI_EVENT_JOGDIAL_FAST_DOWN */ + 34, /* SONYPI_EVENT_JOGDIAL_FAST_UP */ + 35, /* SONYPI_EVENT_JOGDIAL_FAST_DOWN_PRESSED */ + 36, /* SONYPI_EVENT_JOGDIAL_FAST_UP_PRESSED */ + 37, /* SONYPI_EVENT_JOGDIAL_VFAST_DOWN */ + 38, /* SONYPI_EVENT_JOGDIAL_VFAST_UP */ + 39, /* SONYPI_EVENT_JOGDIAL_VFAST_DOWN_PRESSED */ + 40, /* SONYPI_EVENT_JOGDIAL_VFAST_UP_PRESSED */ + 41, /* SONYPI_EVENT_ZOOM_PRESSED */ + 42, /* SONYPI_EVENT_THUMBPHRASE_PRESSED */ + 43, /* SONYPI_EVENT_MEYE_FACE */ + 44, /* SONYPI_EVENT_MEYE_OPPOSITE */ + 45, /* SONYPI_EVENT_MEMORYSTICK_INSERT */ + 46, /* SONYPI_EVENT_MEMORYSTICK_EJECT */ + -1, /* SONYPI_EVENT_ANYBUTTON_RELEASED */ + -1, /* SONYPI_EVENT_BATTERY_INSERT */ + -1, /* SONYPI_EVENT_BATTERY_REMOVE */ + -1, /* SONYPI_EVENT_FNKEY_RELEASED */ + 47, /* SONYPI_EVENT_WIRELESS_ON */ + 48, /* SONYPI_EVENT_WIRELESS_OFF */ +}; + +static int sony_laptop_input_keycode_map[] = { + KEY_CAMERA, /* 0 SONYPI_EVENT_CAPTURE_PRESSED */ + KEY_RESERVED, /* 1 SONYPI_EVENT_CAPTURE_RELEASED */ + KEY_RESERVED, /* 2 SONYPI_EVENT_CAPTURE_PARTIALPRESSED */ + KEY_RESERVED, /* 3 SONYPI_EVENT_CAPTURE_PARTIALRELEASED */ + KEY_FN_ESC, /* 4 SONYPI_EVENT_FNKEY_ESC */ + KEY_FN_F1, /* 5 SONYPI_EVENT_FNKEY_F1 */ + KEY_FN_F2, /* 6 SONYPI_EVENT_FNKEY_F2 */ + KEY_FN_F3, /* 7 SONYPI_EVENT_FNKEY_F3 */ + KEY_FN_F4, /* 8 SONYPI_EVENT_FNKEY_F4 */ + KEY_FN_F5, /* 9 SONYPI_EVENT_FNKEY_F5 */ + KEY_FN_F6, /* 10 SONYPI_EVENT_FNKEY_F6 */ + KEY_FN_F7, /* 11 SONYPI_EVENT_FNKEY_F7 */ + KEY_FN_F8, /* 12 SONYPI_EVENT_FNKEY_F8 */ + KEY_FN_F9, /* 13 SONYPI_EVENT_FNKEY_F9 */ + KEY_FN_F10, /* 14 SONYPI_EVENT_FNKEY_F10 */ + KEY_FN_F11, /* 15 SONYPI_EVENT_FNKEY_F11 */ + KEY_FN_F12, /* 16 SONYPI_EVENT_FNKEY_F12 */ + KEY_FN_F1, /* 17 SONYPI_EVENT_FNKEY_1 */ + KEY_FN_F2, /* 18 SONYPI_EVENT_FNKEY_2 */ + KEY_FN_D, /* 19 SONYPI_EVENT_FNKEY_D */ + KEY_FN_E, /* 20 SONYPI_EVENT_FNKEY_E */ + KEY_FN_F, /* 21 SONYPI_EVENT_FNKEY_F */ + KEY_FN_S, /* 22 SONYPI_EVENT_FNKEY_S */ + KEY_FN_B, /* 23 SONYPI_EVENT_FNKEY_B */ + KEY_BLUETOOTH, /* 24 SONYPI_EVENT_BLUETOOTH_PRESSED */ + KEY_PROG1, /* 25 SONYPI_EVENT_PKEY_P1 */ + KEY_PROG2, /* 26 SONYPI_EVENT_PKEY_P2 */ + KEY_PROG3, /* 27 SONYPI_EVENT_PKEY_P3 */ + KEY_BACK, /* 28 SONYPI_EVENT_BACK_PRESSED */ + KEY_BLUETOOTH, /* 29 SONYPI_EVENT_BLUETOOTH_ON */ + KEY_BLUETOOTH, /* 30 SONYPI_EVENT_BLUETOOTH_OFF */ + KEY_HELP, /* 31 SONYPI_EVENT_HELP_PRESSED */ + KEY_FN, /* 32 SONYPI_EVENT_FNKEY_ONLY */ + KEY_RESERVED, /* 33 SONYPI_EVENT_JOGDIAL_FAST_DOWN */ + KEY_RESERVED, /* 34 SONYPI_EVENT_JOGDIAL_FAST_UP */ + KEY_RESERVED, /* 35 SONYPI_EVENT_JOGDIAL_FAST_DOWN_PRESSED */ + KEY_RESERVED, /* 36 SONYPI_EVENT_JOGDIAL_FAST_UP_PRESSED */ + KEY_RESERVED, /* 37 SONYPI_EVENT_JOGDIAL_VFAST_DOWN */ + KEY_RESERVED, /* 38 SONYPI_EVENT_JOGDIAL_VFAST_UP */ + KEY_RESERVED, /* 39 SONYPI_EVENT_JOGDIAL_VFAST_DOWN_PRESSED */ + KEY_RESERVED, /* 40 SONYPI_EVENT_JOGDIAL_VFAST_UP_PRESSED */ + KEY_ZOOM, /* 41 SONYPI_EVENT_ZOOM_PRESSED */ + BTN_THUMB, /* 42 SONYPI_EVENT_THUMBPHRASE_PRESSED */ + KEY_RESERVED, /* 43 SONYPI_EVENT_MEYE_FACE */ + KEY_RESERVED, /* 44 SONYPI_EVENT_MEYE_OPPOSITE */ + KEY_RESERVED, /* 45 SONYPI_EVENT_MEMORYSTICK_INSERT */ + KEY_RESERVED, /* 46 SONYPI_EVENT_MEMORYSTICK_EJECT */ + KEY_WLAN, /* 47 SONYPI_EVENT_WIRELESS_ON */ + KEY_WLAN, /* 48 SONYPI_EVENT_WIRELESS_OFF */ }; /* release buttons after a short delay if pressed */ @@ -204,7 +283,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 +311,22 @@ 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) { + if (event > ARRAY_SIZE (sony_laptop_input_keycode_map)) { + 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 (kp.key != KEY_UNKNOWN) kp.dev = key_dev; - kp.key = sony_laptop_inputkeys[i].inputev; - break; - } + } 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 +381,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) -- mattia :wq! ^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-19 17:01 ` Mattia Dongili @ 2007-07-22 4:36 ` Len Brown 0 siblings, 0 replies; 30+ messages in thread From: Len Brown @ 2007-07-22 4:36 UTC (permalink / raw) To: Mattia Dongili Cc: Dmitry Torokhov, linux-acpi, Stelian Pop, Richard Hughes, Matthew Garrett okay, I replaced the original 5/7 with this one. thanks, -Len ps. helpful when you can include "sony-laptop:" on the subject line On Thursday 19 July 2007 13:01, Mattia Dongili wrote: > Hi, > the following is the only way I could think of to hide some events as > per Dmitry suggestions while still using the default {set,get}keycode > implementation. > Unfortunately I don't have enough time to put more work in the > sony-laptop module right now. > > I'll send an updated patch series later (tomorrow?). > > commit 20c3d84c721706fd0893ba5f73c1b4f1c231322b > Author: Richard Hughes <richard@hughsie.com> > Date: Fri Jul 20 01:41:57 2007 +0900 > > Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. > > Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> > Signed-off-by: Richard Hughes <richard@hughsie.com> > Signed-off-by: Mattia Dongili <malattia@linux.it> > > diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c > index 5300cad..af69b3b 100644 > --- a/drivers/misc/sony-laptop.c > +++ b/drivers/misc/sony-laptop.c > @@ -142,45 +142,124 @@ struct sony_laptop_keypress { > int key; > }; > > -/* 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 }, > +/* Correspondance table between sonypi events > + * and input layer indexes in the keymap > + */ > +static int sony_laptop_input_index[] = { > + -1, /* no event */ > + -1, /* SONYPI_EVENT_JOGDIAL_DOWN */ > + -1, /* SONYPI_EVENT_JOGDIAL_UP */ > + -1, /* SONYPI_EVENT_JOGDIAL_DOWN_PRESSED */ > + -1, /* SONYPI_EVENT_JOGDIAL_UP_PRESSED */ > + -1, /* SONYPI_EVENT_JOGDIAL_PRESSED */ > + -1, /* SONYPI_EVENT_JOGDIAL_RELEASED */ > + 0, /* SONYPI_EVENT_CAPTURE_PRESSED */ > + 1, /* SONYPI_EVENT_CAPTURE_RELEASED */ > + 2, /* SONYPI_EVENT_CAPTURE_PARTIALPRESSED */ > + 3, /* SONYPI_EVENT_CAPTURE_PARTIALRELEASED */ > + 4, /* SONYPI_EVENT_FNKEY_ESC */ > + 5, /* SONYPI_EVENT_FNKEY_F1 */ > + 6, /* SONYPI_EVENT_FNKEY_F2 */ > + 7, /* SONYPI_EVENT_FNKEY_F3 */ > + 8, /* SONYPI_EVENT_FNKEY_F4 */ > + 9, /* SONYPI_EVENT_FNKEY_F5 */ > + 10, /* SONYPI_EVENT_FNKEY_F6 */ > + 11, /* SONYPI_EVENT_FNKEY_F7 */ > + 12, /* SONYPI_EVENT_FNKEY_F8 */ > + 13, /* SONYPI_EVENT_FNKEY_F9 */ > + 14, /* SONYPI_EVENT_FNKEY_F10 */ > + 15, /* SONYPI_EVENT_FNKEY_F11 */ > + 16, /* SONYPI_EVENT_FNKEY_F12 */ > + 17, /* SONYPI_EVENT_FNKEY_1 */ > + 18, /* SONYPI_EVENT_FNKEY_2 */ > + 19, /* SONYPI_EVENT_FNKEY_D */ > + 20, /* SONYPI_EVENT_FNKEY_E */ > + 21, /* SONYPI_EVENT_FNKEY_F */ > + 22, /* SONYPI_EVENT_FNKEY_S */ > + 23, /* SONYPI_EVENT_FNKEY_B */ > + 24, /* SONYPI_EVENT_BLUETOOTH_PRESSED */ > + 25, /* SONYPI_EVENT_PKEY_P1 */ > + 26, /* SONYPI_EVENT_PKEY_P2 */ > + 27, /* SONYPI_EVENT_PKEY_P3 */ > + 28, /* SONYPI_EVENT_BACK_PRESSED */ > + -1, /* SONYPI_EVENT_LID_CLOSED */ > + -1, /* SONYPI_EVENT_LID_OPENED */ > + 29, /* SONYPI_EVENT_BLUETOOTH_ON */ > + 30, /* SONYPI_EVENT_BLUETOOTH_OFF */ > + 31, /* SONYPI_EVENT_HELP_PRESSED */ > + 32, /* SONYPI_EVENT_FNKEY_ONLY */ > + 33, /* SONYPI_EVENT_JOGDIAL_FAST_DOWN */ > + 34, /* SONYPI_EVENT_JOGDIAL_FAST_UP */ > + 35, /* SONYPI_EVENT_JOGDIAL_FAST_DOWN_PRESSED */ > + 36, /* SONYPI_EVENT_JOGDIAL_FAST_UP_PRESSED */ > + 37, /* SONYPI_EVENT_JOGDIAL_VFAST_DOWN */ > + 38, /* SONYPI_EVENT_JOGDIAL_VFAST_UP */ > + 39, /* SONYPI_EVENT_JOGDIAL_VFAST_DOWN_PRESSED */ > + 40, /* SONYPI_EVENT_JOGDIAL_VFAST_UP_PRESSED */ > + 41, /* SONYPI_EVENT_ZOOM_PRESSED */ > + 42, /* SONYPI_EVENT_THUMBPHRASE_PRESSED */ > + 43, /* SONYPI_EVENT_MEYE_FACE */ > + 44, /* SONYPI_EVENT_MEYE_OPPOSITE */ > + 45, /* SONYPI_EVENT_MEMORYSTICK_INSERT */ > + 46, /* SONYPI_EVENT_MEMORYSTICK_EJECT */ > + -1, /* SONYPI_EVENT_ANYBUTTON_RELEASED */ > + -1, /* SONYPI_EVENT_BATTERY_INSERT */ > + -1, /* SONYPI_EVENT_BATTERY_REMOVE */ > + -1, /* SONYPI_EVENT_FNKEY_RELEASED */ > + 47, /* SONYPI_EVENT_WIRELESS_ON */ > + 48, /* SONYPI_EVENT_WIRELESS_OFF */ > +}; > + > +static int sony_laptop_input_keycode_map[] = { > + KEY_CAMERA, /* 0 SONYPI_EVENT_CAPTURE_PRESSED */ > + KEY_RESERVED, /* 1 SONYPI_EVENT_CAPTURE_RELEASED */ > + KEY_RESERVED, /* 2 SONYPI_EVENT_CAPTURE_PARTIALPRESSED */ > + KEY_RESERVED, /* 3 SONYPI_EVENT_CAPTURE_PARTIALRELEASED */ > + KEY_FN_ESC, /* 4 SONYPI_EVENT_FNKEY_ESC */ > + KEY_FN_F1, /* 5 SONYPI_EVENT_FNKEY_F1 */ > + KEY_FN_F2, /* 6 SONYPI_EVENT_FNKEY_F2 */ > + KEY_FN_F3, /* 7 SONYPI_EVENT_FNKEY_F3 */ > + KEY_FN_F4, /* 8 SONYPI_EVENT_FNKEY_F4 */ > + KEY_FN_F5, /* 9 SONYPI_EVENT_FNKEY_F5 */ > + KEY_FN_F6, /* 10 SONYPI_EVENT_FNKEY_F6 */ > + KEY_FN_F7, /* 11 SONYPI_EVENT_FNKEY_F7 */ > + KEY_FN_F8, /* 12 SONYPI_EVENT_FNKEY_F8 */ > + KEY_FN_F9, /* 13 SONYPI_EVENT_FNKEY_F9 */ > + KEY_FN_F10, /* 14 SONYPI_EVENT_FNKEY_F10 */ > + KEY_FN_F11, /* 15 SONYPI_EVENT_FNKEY_F11 */ > + KEY_FN_F12, /* 16 SONYPI_EVENT_FNKEY_F12 */ > + KEY_FN_F1, /* 17 SONYPI_EVENT_FNKEY_1 */ > + KEY_FN_F2, /* 18 SONYPI_EVENT_FNKEY_2 */ > + KEY_FN_D, /* 19 SONYPI_EVENT_FNKEY_D */ > + KEY_FN_E, /* 20 SONYPI_EVENT_FNKEY_E */ > + KEY_FN_F, /* 21 SONYPI_EVENT_FNKEY_F */ > + KEY_FN_S, /* 22 SONYPI_EVENT_FNKEY_S */ > + KEY_FN_B, /* 23 SONYPI_EVENT_FNKEY_B */ > + KEY_BLUETOOTH, /* 24 SONYPI_EVENT_BLUETOOTH_PRESSED */ > + KEY_PROG1, /* 25 SONYPI_EVENT_PKEY_P1 */ > + KEY_PROG2, /* 26 SONYPI_EVENT_PKEY_P2 */ > + KEY_PROG3, /* 27 SONYPI_EVENT_PKEY_P3 */ > + KEY_BACK, /* 28 SONYPI_EVENT_BACK_PRESSED */ > + KEY_BLUETOOTH, /* 29 SONYPI_EVENT_BLUETOOTH_ON */ > + KEY_BLUETOOTH, /* 30 SONYPI_EVENT_BLUETOOTH_OFF */ > + KEY_HELP, /* 31 SONYPI_EVENT_HELP_PRESSED */ > + KEY_FN, /* 32 SONYPI_EVENT_FNKEY_ONLY */ > + KEY_RESERVED, /* 33 SONYPI_EVENT_JOGDIAL_FAST_DOWN */ > + KEY_RESERVED, /* 34 SONYPI_EVENT_JOGDIAL_FAST_UP */ > + KEY_RESERVED, /* 35 SONYPI_EVENT_JOGDIAL_FAST_DOWN_PRESSED */ > + KEY_RESERVED, /* 36 SONYPI_EVENT_JOGDIAL_FAST_UP_PRESSED */ > + KEY_RESERVED, /* 37 SONYPI_EVENT_JOGDIAL_VFAST_DOWN */ > + KEY_RESERVED, /* 38 SONYPI_EVENT_JOGDIAL_VFAST_UP */ > + KEY_RESERVED, /* 39 SONYPI_EVENT_JOGDIAL_VFAST_DOWN_PRESSED */ > + KEY_RESERVED, /* 40 SONYPI_EVENT_JOGDIAL_VFAST_UP_PRESSED */ > + KEY_ZOOM, /* 41 SONYPI_EVENT_ZOOM_PRESSED */ > + BTN_THUMB, /* 42 SONYPI_EVENT_THUMBPHRASE_PRESSED */ > + KEY_RESERVED, /* 43 SONYPI_EVENT_MEYE_FACE */ > + KEY_RESERVED, /* 44 SONYPI_EVENT_MEYE_OPPOSITE */ > + KEY_RESERVED, /* 45 SONYPI_EVENT_MEMORYSTICK_INSERT */ > + KEY_RESERVED, /* 46 SONYPI_EVENT_MEMORYSTICK_EJECT */ > + KEY_WLAN, /* 47 SONYPI_EVENT_WIRELESS_ON */ > + KEY_WLAN, /* 48 SONYPI_EVENT_WIRELESS_OFF */ > }; > > /* release buttons after a short delay if pressed */ > @@ -204,7 +283,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 +311,22 @@ 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) { > + if (event > ARRAY_SIZE (sony_laptop_input_keycode_map)) { > + 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 (kp.key != KEY_UNKNOWN) > kp.dev = key_dev; > - kp.key = sony_laptop_inputkeys[i].inputev; > - break; > - } > + } > 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 +381,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) ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table. 2007-07-16 13:22 ` Dmitry Torokhov 2007-07-18 11:33 ` Mattia Dongili @ 2007-07-18 11:45 ` Mattia Dongili 1 sibling, 0 replies; 30+ messages in thread From: Mattia Dongili @ 2007-07-18 11:45 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: Len Brown, linux-acpi, Stelian Pop, Richard Hughes On Mon, Jul 16, 2007 at 09:22:28AM -0400, Dmitry Torokhov wrote: > Hi Mattia, > > On 7/15/07, Mattia Dongili <malattia@linux.it> wrote: >> +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 */ > > Jogdial events are never passed through key_dev, do they? If so then > we should not allow remapping them as it is pointless. EVCSKEYCODE > shoudl return -EINVAL wehn trying to remap them. yes, JOG events are going to the other input_dev. ... >> + KEY_RESERVED, /* SONYPI_EVENT_LID_CLOSED */ >> + KEY_RESERVED, /* SONYPI_EVENT_LID_OPENED */ > > EV_SW/SW_LID unless LID events are delivered through ACPI (in which > case we should hide these events completely). every event except jogdial's is also being delivered through ACPI. Will hide these from input then. ... >> + KEY_RESERVED, /* SONYPI_EVENT_ANYBUTTON_RELEASED */ >> + KEY_RESERVED, /* SONYPI_EVENT_BATTERY_INSERT */ >> + KEY_RESERVED, /* SONYPI_EVENT_BATTERY_REMOVE */ ACPI only stuff as well? >> + KEY_RESERVED, /* SONYPI_EVENT_FNKEY_RELEASED */ > > Do we really want let userspace remap this event? hehehe, no, I don't think so. Thanks for the comments -- mattia :wq! ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 0/7] sony-laptop for 2.6.23 (updated) 2007-07-15 17:34 [PATCH 0/7] sony-laptop for 2.6.23 (updated) Mattia Dongili 2007-07-15 17:34 ` [PATCH 1/7] sony-laptop: add new SNC handlers Mattia Dongili @ 2007-07-22 4:37 ` Len Brown 1 sibling, 0 replies; 30+ messages in thread From: Len Brown @ 2007-07-22 4:37 UTC (permalink / raw) To: Mattia Dongili; +Cc: linux-acpi, Stelian Pop applied (w/ updated 5/7) thanks, -Len On Sunday 15 July 2007 13:34, Mattia Dongili wrote: > Hi Len, > > These patches a targeted to 2.6.23. > I updated the previous series with a couple more patches one of which fixes a > bug present in 2.6.22 and that I'll push to the stable maintainers. > Important changes include the scancode enabling work done by Richard Hughes and > support for some recent vaio models. > > Many thanks > --- > drivers/misc/sony-laptop.c | 312 ++++++++++++++++++++++++++++++++++++--------- > 1 file changed, 252 insertions(+), 60 deletions(-) ^ permalink raw reply [flat|nested] 30+ messages in thread
end of thread, other threads:[~2007-07-22 4:38 UTC | newest] Thread overview: 30+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-07-15 17:34 [PATCH 0/7] sony-laptop for 2.6.23 (updated) Mattia Dongili 2007-07-15 17:34 ` [PATCH 1/7] sony-laptop: add new SNC handlers Mattia Dongili 2007-07-15 17:34 ` [PATCH 2/7] sony-laptop: map wireless switch events to KEY_WLAN Mattia Dongili 2007-07-15 17:34 ` [PATCH 3/7] Add support for recent Vaios Fn keys (C series for now) Mattia Dongili 2007-07-15 17:34 ` [PATCH 4/7] Invoke _INI for SNC devices that provide it Mattia Dongili 2007-07-15 17:34 ` [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table Mattia Dongili 2007-07-15 17:34 ` [PATCH 6/7] Add Vaio FE to the special init sequence Mattia Dongili 2007-07-15 17:34 ` [PATCH 7/7] Fix event reading in sony-laptop Mattia Dongili 2007-07-15 21:11 ` [PATCH 5/7] Make the driver use MSC_SCAN and a setkeycode and getkeycode key table Matthew Garrett 2007-07-16 17:06 ` Richard Hughes 2007-07-16 18:09 ` Matthew Garrett 2007-07-17 10:37 ` Richard Hughes 2007-07-17 10:46 ` Matthew Garrett 2007-07-18 11:45 ` Mattia Dongili 2007-07-18 14:28 ` Matthew Garrett 2007-07-18 15:05 ` Dmitry Torokhov 2007-07-18 15:17 ` Richard Hughes 2007-07-18 16:02 ` Dmitry Torokhov 2007-07-18 16:20 ` Richard Hughes 2007-07-18 16:25 ` Matthew Garrett 2007-07-18 16:39 ` Dmitry Torokhov 2007-07-18 16:44 ` Richard Hughes 2007-07-18 16:56 ` Matthew Garrett 2007-07-19 15:51 ` Mattia Dongili 2007-07-16 13:22 ` Dmitry Torokhov 2007-07-18 11:33 ` Mattia Dongili 2007-07-19 17:01 ` Mattia Dongili 2007-07-22 4:36 ` Len Brown 2007-07-18 11:45 ` Mattia Dongili 2007-07-22 4:37 ` [PATCH 0/7] sony-laptop for 2.6.23 (updated) Len Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox