diff mbox

[57/98] sony-laptop: Add support for extra keyboard events

Message ID 200903291253.05030.matze@welwarsky.de (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Matthias Welwarsky March 29, 2009, 10:53 a.m. UTC
On Saturday 28 March 2009 05:31:32 Len Brown wrote:
> The current sony-laptop code assumes that the keyboard event method is
> always located at slot 2 in the platform code. Remove this assumption and
> add support for some additional hotkeys.

I suggest the following patch to fix a couple of bugs on Vaio Z21:
- fix S1 and S2 hotkeys reporting same key event
- fix undecoded/unknown keys reporting bogus key events



--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Matthew Garrett March 29, 2009, 3:03 p.m. UTC | #1
On Sun, Mar 29, 2009 at 12:53:04PM +0200, Matthias Welwarsky wrote:
>  	{ 0x90, SONYPI_EVENT_PKEY_P1 },
>  	{ 0x10, SONYPI_EVENT_ANYBUTTON_RELEASED },
> -	{ 0x91, SONYPI_EVENT_PKEY_P1 },
> +	{ 0x91, SONYPI_EVENT_PKEY_P2 },
>  	{ 0x11, SONYPI_EVENT_ANYBUTTON_RELEASED },
>  	{ 0x81, SONYPI_EVENT_FNKEY_F1 },
>  	{ 0x01, SONYPI_EVENT_FNKEY_RELEASED },

Oops, yes...

> @@ -929,7 +929,7 @@
>  		if (sony_find_snc_handle(0x127) == ev)
>  			key_handle = 0x127;
>  
> -		if (handle) {
> +		if (key_handle) {

Indeed.

> -		}
> +		} else
> +			sony_laptop_report_input_event(ev);

That doesn't look right, though - sony_laptop_report_input_event expects 
a value that matches the input_index array, and an unprocessed event 
>0x90 isn't going to satisfy that.
Matthias Welwarsky March 29, 2009, 3:51 p.m. UTC | #2
On Sunday 29 March 2009 17:03:38 Matthew Garrett wrote:
> On Sun, Mar 29, 2009 at 12:53:04PM +0200, Matthias Welwarsky wrote:
> >  	{ 0x90, SONYPI_EVENT_PKEY_P1 },
> >  	{ 0x10, SONYPI_EVENT_ANYBUTTON_RELEASED },
> > -	{ 0x91, SONYPI_EVENT_PKEY_P1 },
> > +	{ 0x91, SONYPI_EVENT_PKEY_P2 },
> >  	{ 0x11, SONYPI_EVENT_ANYBUTTON_RELEASED },
> >  	{ 0x81, SONYPI_EVENT_FNKEY_F1 },
> >  	{ 0x01, SONYPI_EVENT_FNKEY_RELEASED },
>
> Oops, yes...
>
> > @@ -929,7 +929,7 @@
> >  		if (sony_find_snc_handle(0x127) == ev)
> >  			key_handle = 0x127;
> >
> > -		if (handle) {
> > +		if (key_handle) {
>
> Indeed.
>
> > -		}
> > +		} else
> > +			sony_laptop_report_input_event(ev);
>
> That doesn't look right, though - sony_laptop_report_input_event expects
> a value that matches the input_index array, and an unprocessed event
> >0x90 isn't going to satisfy that.

The call to sony_laptop_report_input_event() used to be further down, right 
before the call to acpi_bus_generate_proc_event(). It was called 
unconditionally, with whatever value ev happened to have at that time, i.e. 
also unprocessed events < 0x90 or events where the translation failed. Moving 
the call makes sure that only properly processed events are reported. Without, 
I was seeing a lot of bogus events reported, e.g. volume-down when the stamina 
switch was flipped, or when the rf kill switch was operated.


--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Matthew Garrett March 29, 2009, 4:02 p.m. UTC | #3
On Sun, Mar 29, 2009 at 05:51:45PM +0200, Matthias Welwarsky wrote:
> before the call to acpi_bus_generate_proc_event(). It was called 
> unconditionally, with whatever value ev happened to have at that time, i.e. 
> also unprocessed events < 0x90 or events where the translation failed. Moving 
> the call makes sure that only properly processed events are reported. Without, 
> I was seeing a lot of bogus events reported, e.g. volume-down when the stamina 
> switch was flipped, or when the rf kill switch was operated.

Oh, I see. No, you can't just remove it from there - that'll break 
older-style events. I'd add it there without removing the original, but 
then make the rest of the block conditional on the original event not 
being >= 0x90.
diff mbox

Patch

--- sony-laptop.c.orig	2009-03-29 12:41:44.000000000 +0200
+++ sony-laptop.c	2009-03-29 12:43:29.000000000 +0200
@@ -865,7 +865,7 @@ 
 static struct sony_nc_event sony_100_events[] = {
 	{ 0x90, SONYPI_EVENT_PKEY_P1 },
 	{ 0x10, SONYPI_EVENT_ANYBUTTON_RELEASED },
-	{ 0x91, SONYPI_EVENT_PKEY_P1 },
+	{ 0x91, SONYPI_EVENT_PKEY_P2 },
 	{ 0x11, SONYPI_EVENT_ANYBUTTON_RELEASED },
 	{ 0x81, SONYPI_EVENT_FNKEY_F1 },
 	{ 0x01, SONYPI_EVENT_FNKEY_RELEASED },
@@ -929,7 +929,7 @@ 
 		if (sony_find_snc_handle(0x127) == ev)
 			key_handle = 0x127;
 
-		if (handle) {
+		if (key_handle) {
 			struct sony_nc_event *key_event;
 
 			if (sony_call_snc_handle(key_handle, 0x200, &result))
@@ -959,11 +959,11 @@ 
 		} else if (sony_find_snc_handle(0x124) == ev) {
 			sony_nc_rfkill_update();
 			return;
-		}
+		} else
+			sony_laptop_report_input_event(ev);
 	}
 
 	dprintk("sony_acpi_notify, event: 0x%.2x\n", ev);
-	sony_laptop_report_input_event(ev);
 	acpi_bus_generate_proc_event(sony_nc_acpi_device, 1, ev);
 }