acpi: Don't send KEY_UNKNOWN for random video notifications
PATCH 1/1 acpi: Don't send KEY_UNKNOWN for random video notifications
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.
--- drivers/acpi/video.c | 29 ++++++++++++++++------------- 1 files changed, 16 insertions(+), 13 deletions(-)
drivers/acpi/video.c +16 -13
@@ -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)
Signature · 1 line
1.6.5.2
Len Brown
reviewerapplied to acpi-test -- looking for ack from rui, the driver maintainer
thanks,
Len Brown, Intel Open Source Technology Center
Quoted 94 lines · Matthew Garrett
I have a machine here that's sending
0xD1notifications on the video device once every second or so. I have no idea why (it's a prototype, it may be broken), but sendingKEY_UNKNOWNis 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 <[email protected]>--- drivers/acpi/video.c | 29 ++++++++++++++++------------- 1 files changed, 16 insertions(+), 13 deletions(-)drivers/acpi/video.c +16
-13@@ -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)Signature · 1 line
1.6.5.2
Quoted 13 lines · Len Brown
applied to acpi-test -- looking for ack from rui, the driver maintainer
thanks,
Len Brown, Intel Open Source Technology CenterQuoted 6 lines · Matthew Garrett
I have a machine here that's sending
0xD1notifications on the video device once every second or so. I have no idea why (it's a prototype, it may be broken), but sendingKEY_UNKNOWNis 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
Quoted 92 lines
Quoted 88 lines
Signed-off-by Matthew Garrett <[email protected]>--- drivers/acpi/video.c | 29 ++++++++++++++++------------- 1 files changed, 16 insertions(+), 13 deletions(-)drivers/acpi/video.c +16
-13@@ -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)Signature · 1 line
1.6.5.2--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 1 line · Zhang Rui
can you attach the acpidump of your laptop please?
Afraid not - it's prototype hardware.
Signature · 1 line
Matthew Garrett | [email protected]
Zhang Rui
Acked-byQuoted 6 lines · Matthew Garrett
Quoted 1 line · Zhang Rui
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.
thanks,
rui