public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
Subject: [PATCH] ACPI video: Add video_switch_key option
Date: Wed, 27 Oct 2010 12:39:17 +0200	[thread overview]
Message-ID: <s5hhbg7zzqi.wl%tiwai@suse.de> (raw)

Some HP laptops send ACPI video events per lid open/close, and the
ACPI video driver translates to SWITCHVIDEOMODE input key events.
This behavior confuses the user-space daemon such as
gnome-settings-daemon since it changes the video mode per this key,
which results in a different video mode at each time you open/close
the laptop lid.  Fn-Fx keys are handled differently on such hardware,
thus this key generation is simply superfluous.

This patch adds a module parameter "video_switch_key" to either
assign a different key code for this ACPI event or disable by setting
zero there.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/acpi/video.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 5cd0228..a61162f 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -80,6 +80,8 @@ module_param(brightness_switch_enabled, bool, 0644);
  */
 static int allow_duplicates;
 module_param(allow_duplicates, bool, 0644);
+static int video_switch_key = KEY_SWITCHVIDEOMODE;
+module_param(video_switch_key, int, 0644);
 
 static int register_count = 0;
 static int acpi_video_bus_add(struct acpi_device *device);
@@ -1511,7 +1513,7 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
 	case ACPI_VIDEO_NOTIFY_SWITCH:	/* User requested a switch,
 					 * most likely via hotkey. */
 		acpi_bus_generate_proc_event(device, event, 0);
-		keycode = KEY_SWITCHVIDEOMODE;
+		keycode = video_switch_key;
 		break;
 
 	case ACPI_VIDEO_NOTIFY_PROBE:	/* User plugged in or removed a video
@@ -1519,12 +1521,12 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
 		acpi_video_device_enumerate(video);
 		acpi_video_device_rebind(video);
 		acpi_bus_generate_proc_event(device, event, 0);
-		keycode = KEY_SWITCHVIDEOMODE;
+		keycode = video_switch_key;
 		break;
 
 	case ACPI_VIDEO_NOTIFY_CYCLE:	/* Cycle Display output hotkey pressed. */
 		acpi_bus_generate_proc_event(device, event, 0);
-		keycode = KEY_SWITCHVIDEOMODE;
+		keycode = video_switch_key;
 		break;
 	case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT:	/* Next Display output hotkey pressed. */
 		acpi_bus_generate_proc_event(device, event, 0);
@@ -1736,7 +1738,8 @@ static int acpi_video_bus_add(struct acpi_device *device)
 	input->id.product = 0x06;
 	input->dev.parent = &device->dev;
 	input->evbit[0] = BIT(EV_KEY);
-	set_bit(KEY_SWITCHVIDEOMODE, input->keybit);
+	if (video_switch_key && video_switch_key < KEY_CNT)
+		set_bit(KEY_SWITCHVIDEOMODE, input->keybit);
 	set_bit(KEY_VIDEO_NEXT, input->keybit);
 	set_bit(KEY_VIDEO_PREV, input->keybit);
 	set_bit(KEY_BRIGHTNESS_CYCLE, input->keybit);
-- 
1.7.3.1


             reply	other threads:[~2010-10-27 10:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27 10:39 Takashi Iwai [this message]
2010-11-24  7:05 ` [PATCH] ACPI video: Add video_switch_key option Takashi Iwai
2010-11-24 14:26   ` Matthew Garrett
2010-11-24 14:31     ` Takashi Iwai
2010-11-24 14:35       ` Matthew Garrett
2010-11-24 14:38         ` Takashi Iwai
2010-11-24 14:42           ` Matthew Garrett
2010-11-24 14:45             ` Takashi Iwai
2010-11-24 14:54               ` Matthew Garrett
2010-11-24 15:04                 ` Takashi Iwai
2010-11-24 15:09                   ` Matthew Garrett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hhbg7zzqi.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox