All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] acpi: Don't send KEY_UNKNOWN for random video notifications
@ 2009-12-11 22:40 Matthew Garrett
  2010-04-01  0:57 ` Len Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Garrett @ 2009-12-11 22:40 UTC (permalink / raw)
  To: linux-acpi; +Cc: lenb, Matthew Garrett

I have a machine here that's sending 0xD1 notifications on the video
device once every second or so. I have no idea why (it's a prototype,
it may be broken), but sending KEY_UNKNOWN is unhelpful and results in
the console becoming unusable. Let's not report keys unless we have
something useful to say about them.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
---
 drivers/acpi/video.c |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 05dff63..655183c 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -2100,7 +2100,7 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
 {
 	struct acpi_video_bus *video = acpi_driver_data(device);
 	struct input_dev *input;
-	int keycode;
+	int keycode = 0;
 
 	if (!video)
 		return;
@@ -2136,17 +2136,19 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
 		break;
 
 	default:
-		keycode = KEY_UNKNOWN;
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
 				  "Unsupported event [0x%x]\n", event));
 		break;
 	}
 
 	acpi_notifier_call_chain(device, event, 0);
-	input_report_key(input, keycode, 1);
-	input_sync(input);
-	input_report_key(input, keycode, 0);
-	input_sync(input);
+
+	if (keycode) {
+		input_report_key(input, keycode, 1);
+		input_sync(input);
+		input_report_key(input, keycode, 0);
+		input_sync(input);
+	}
 
 	return;
 }
@@ -2157,7 +2159,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
 	struct acpi_device *device = NULL;
 	struct acpi_video_bus *bus;
 	struct input_dev *input;
-	int keycode;
+	int keycode = 0;
 
 	if (!video_device)
 		return;
@@ -2198,17 +2200,19 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
 		keycode = KEY_DISPLAY_OFF;
 		break;
 	default:
-		keycode = KEY_UNKNOWN;
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
 				  "Unsupported event [0x%x]\n", event));
 		break;
 	}
 
 	acpi_notifier_call_chain(device, event, 0);
-	input_report_key(input, keycode, 1);
-	input_sync(input);
-	input_report_key(input, keycode, 0);
-	input_sync(input);
+
+	if (keycode) {
+		input_report_key(input, keycode, 1);
+		input_sync(input);
+		input_report_key(input, keycode, 0);
+		input_sync(input);
+	}
 
 	return;
 }
@@ -2299,7 +2303,6 @@ static int acpi_video_bus_add(struct acpi_device *device)
 	set_bit(KEY_BRIGHTNESSDOWN, input->keybit);
 	set_bit(KEY_BRIGHTNESS_ZERO, input->keybit);
 	set_bit(KEY_DISPLAY_OFF, input->keybit);
-	set_bit(KEY_UNKNOWN, input->keybit);
 
 	error = input_register_device(input);
 	if (error)
-- 
1.6.5.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] acpi: Don't send KEY_UNKNOWN for random video notifications
  2009-12-11 22:40 [PATCH] acpi: Don't send KEY_UNKNOWN for random video notifications Matthew Garrett
@ 2010-04-01  0:57 ` Len Brown
  2010-04-01  6:57   ` Zhang Rui
  0 siblings, 1 reply; 5+ messages in thread
From: Len Brown @ 2010-04-01  0:57 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: linux-acpi

applied to acpi-test -- looking for ack from rui, the driver maintainer

thanks,
Len Brown, Intel Open Source Technology Center

On Fri, 11 Dec 2009, Matthew Garrett wrote:

> I have a machine here that's sending 0xD1 notifications on the video
> device once every second or so. I have no idea why (it's a prototype,
> it may be broken), but sending KEY_UNKNOWN is unhelpful and results in
> the console becoming unusable. Let's not report keys unless we have
> something useful to say about them.
> 
> Signed-off-by: Matthew Garrett <mjg@redhat.com>
> ---
>  drivers/acpi/video.c |   29 ++++++++++++++++-------------
>  1 files changed, 16 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
> index 05dff63..655183c 100644
> --- a/drivers/acpi/video.c
> +++ b/drivers/acpi/video.c
> @@ -2100,7 +2100,7 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
>  {
>  	struct acpi_video_bus *video = acpi_driver_data(device);
>  	struct input_dev *input;
> -	int keycode;
> +	int keycode = 0;
>  
>  	if (!video)
>  		return;
> @@ -2136,17 +2136,19 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
>  		break;
>  
>  	default:
> -		keycode = KEY_UNKNOWN;
>  		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
>  				  "Unsupported event [0x%x]\n", event));
>  		break;
>  	}
>  
>  	acpi_notifier_call_chain(device, event, 0);
> -	input_report_key(input, keycode, 1);
> -	input_sync(input);
> -	input_report_key(input, keycode, 0);
> -	input_sync(input);
> +
> +	if (keycode) {
> +		input_report_key(input, keycode, 1);
> +		input_sync(input);
> +		input_report_key(input, keycode, 0);
> +		input_sync(input);
> +	}
>  
>  	return;
>  }
> @@ -2157,7 +2159,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
>  	struct acpi_device *device = NULL;
>  	struct acpi_video_bus *bus;
>  	struct input_dev *input;
> -	int keycode;
> +	int keycode = 0;
>  
>  	if (!video_device)
>  		return;
> @@ -2198,17 +2200,19 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
>  		keycode = KEY_DISPLAY_OFF;
>  		break;
>  	default:
> -		keycode = KEY_UNKNOWN;
>  		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
>  				  "Unsupported event [0x%x]\n", event));
>  		break;
>  	}
>  
>  	acpi_notifier_call_chain(device, event, 0);
> -	input_report_key(input, keycode, 1);
> -	input_sync(input);
> -	input_report_key(input, keycode, 0);
> -	input_sync(input);
> +
> +	if (keycode) {
> +		input_report_key(input, keycode, 1);
> +		input_sync(input);
> +		input_report_key(input, keycode, 0);
> +		input_sync(input);
> +	}
>  
>  	return;
>  }
> @@ -2299,7 +2303,6 @@ static int acpi_video_bus_add(struct acpi_device *device)
>  	set_bit(KEY_BRIGHTNESSDOWN, input->keybit);
>  	set_bit(KEY_BRIGHTNESS_ZERO, input->keybit);
>  	set_bit(KEY_DISPLAY_OFF, input->keybit);
> -	set_bit(KEY_UNKNOWN, input->keybit);
>  
>  	error = input_register_device(input);
>  	if (error)
> -- 
> 1.6.5.2
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] acpi: Don't send KEY_UNKNOWN for random video notifications
  2010-04-01  0:57 ` Len Brown
@ 2010-04-01  6:57   ` Zhang Rui
  2010-04-01 12:32     ` Matthew Garrett
  0 siblings, 1 reply; 5+ messages in thread
From: Zhang Rui @ 2010-04-01  6:57 UTC (permalink / raw)
  To: Len Brown; +Cc: Matthew Garrett, linux-acpi

On Thu, 2010-04-01 at 08:57 +0800, Len Brown wrote:
> applied to acpi-test -- looking for ack from rui, the driver maintainer
> 
> thanks,
> Len Brown, Intel Open Source Technology Center
> 
> On Fri, 11 Dec 2009, Matthew Garrett wrote:
> 
> > I have a machine here that's sending 0xD1 notifications on the video
> > device once every second or so. I have no idea why (it's a prototype,
> > it may be broken), but sending KEY_UNKNOWN is unhelpful and results in
> > the console becoming unusable. Let's not report keys unless we have
> > something useful to say about them.
> > 
Hi, Matthew,

can you attach the acpidump of your laptop please?

thanks,
rui


> > Signed-off-by: Matthew Garrett <mjg@redhat.com>
> > ---
> >  drivers/acpi/video.c |   29 ++++++++++++++++-------------
> >  1 files changed, 16 insertions(+), 13 deletions(-)
> > 
> > diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
> > index 05dff63..655183c 100644
> > --- a/drivers/acpi/video.c
> > +++ b/drivers/acpi/video.c
> > @@ -2100,7 +2100,7 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
> >  {
> >  	struct acpi_video_bus *video = acpi_driver_data(device);
> >  	struct input_dev *input;
> > -	int keycode;
> > +	int keycode = 0;
> >  
> >  	if (!video)
> >  		return;
> > @@ -2136,17 +2136,19 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
> >  		break;
> >  
> >  	default:
> > -		keycode = KEY_UNKNOWN;
> >  		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
> >  				  "Unsupported event [0x%x]\n", event));
> >  		break;
> >  	}
> >  
> >  	acpi_notifier_call_chain(device, event, 0);
> > -	input_report_key(input, keycode, 1);
> > -	input_sync(input);
> > -	input_report_key(input, keycode, 0);
> > -	input_sync(input);
> > +
> > +	if (keycode) {
> > +		input_report_key(input, keycode, 1);
> > +		input_sync(input);
> > +		input_report_key(input, keycode, 0);
> > +		input_sync(input);
> > +	}
> >  
> >  	return;
> >  }
> > @@ -2157,7 +2159,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
> >  	struct acpi_device *device = NULL;
> >  	struct acpi_video_bus *bus;
> >  	struct input_dev *input;
> > -	int keycode;
> > +	int keycode = 0;
> >  
> >  	if (!video_device)
> >  		return;
> > @@ -2198,17 +2200,19 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
> >  		keycode = KEY_DISPLAY_OFF;
> >  		break;
> >  	default:
> > -		keycode = KEY_UNKNOWN;
> >  		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
> >  				  "Unsupported event [0x%x]\n", event));
> >  		break;
> >  	}
> >  
> >  	acpi_notifier_call_chain(device, event, 0);
> > -	input_report_key(input, keycode, 1);
> > -	input_sync(input);
> > -	input_report_key(input, keycode, 0);
> > -	input_sync(input);
> > +
> > +	if (keycode) {
> > +		input_report_key(input, keycode, 1);
> > +		input_sync(input);
> > +		input_report_key(input, keycode, 0);
> > +		input_sync(input);
> > +	}
> >  
> >  	return;
> >  }
> > @@ -2299,7 +2303,6 @@ static int acpi_video_bus_add(struct acpi_device *device)
> >  	set_bit(KEY_BRIGHTNESSDOWN, input->keybit);
> >  	set_bit(KEY_BRIGHTNESS_ZERO, input->keybit);
> >  	set_bit(KEY_DISPLAY_OFF, input->keybit);
> > -	set_bit(KEY_UNKNOWN, input->keybit);
> >  
> >  	error = input_register_device(input);
> >  	if (error)
> > -- 
> > 1.6.5.2
> > 
> --
> 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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] acpi: Don't send KEY_UNKNOWN for random video notifications
  2010-04-01  6:57   ` Zhang Rui
@ 2010-04-01 12:32     ` Matthew Garrett
  2010-04-02  1:05       ` Zhang Rui
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Garrett @ 2010-04-01 12:32 UTC (permalink / raw)
  To: Zhang Rui; +Cc: Len Brown, linux-acpi

On Thu, Apr 01, 2010 at 02:57:53PM +0800, Zhang Rui wrote:

> can you attach the acpidump of your laptop please?

Afraid not - it's prototype hardware.

-- 
Matthew Garrett | mjg59@srcf.ucam.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] acpi: Don't send KEY_UNKNOWN for random video notifications
  2010-04-01 12:32     ` Matthew Garrett
@ 2010-04-02  1:05       ` Zhang Rui
  0 siblings, 0 replies; 5+ messages in thread
From: Zhang Rui @ 2010-04-02  1:05 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: Len Brown, linux-acpi

On Thu, 2010-04-01 at 20:32 +0800, Matthew Garrett wrote:
> On Thu, Apr 01, 2010 at 02:57:53PM +0800, Zhang Rui wrote:
> 
> > can you attach the acpidump of your laptop please?
> 
> Afraid not - it's prototype hardware.
> 
that's okay. The patch looks good.
I just want to see why notification 0xD1 is sent out.

Acked-by: Zhang Rui <rui.zhang@intel.com>

thanks,
rui



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-04-02  1:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-11 22:40 [PATCH] acpi: Don't send KEY_UNKNOWN for random video notifications Matthew Garrett
2010-04-01  0:57 ` Len Brown
2010-04-01  6:57   ` Zhang Rui
2010-04-01 12:32     ` Matthew Garrett
2010-04-02  1:05       ` Zhang Rui

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.