diff mbox

ACPI video: prevent from reporting birghtness keyevents

Message ID 1342162367-10467-1-git-send-email-acelan.kao@canonical.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chia-Lin Kao (AceLan) July 13, 2012, 6:52 a.m. UTC
Prevent ACPI video from reporting brightness keyevents if the driver
already adjust the brightness, or userspace app will adjust the brightness
value again.

We should distinguish keyevent from uevent, keyevent is used to inform the
usespace app to do what the meaning of the key is.
And uevent is used to say that the required action is already taken,
userspace app could monitor uevent to show OSD or do any kind of
notification they want.
The backlight subsystem will emit the uevent once the brightness had
changed, so ACPI video driver doesn't have to report the keyevent.

Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
---
 drivers/acpi/video.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 1e0a9e1..221cff2 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -1546,7 +1546,8 @@  static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
 
 	acpi_notifier_call_chain(device, event, 0);
 
-	if (keycode) {
+	/* Report keyevent only if the driver didn't adjust the brightness */
+	if (keycode && !brightness_switch_enabled) {
 		input_report_key(input, keycode, 1);
 		input_sync(input);
 		input_report_key(input, keycode, 0);