linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Len Brown <lenb@kernel.org>
To: Zhang Rui <rui.zhang@intel.com>
Cc: linux-acpi@vger.kernel.org, mjg59@srcf.ucam.org,
	Arjan van de Ven <arjan@infradead.org>
Subject: Re: [PATCH] ACPI video: introduce module parameter auto_handle
Date: Fri, 31 Aug 2007 16:53:27 -0400	[thread overview]
Message-ID: <200708311653.27228.lenb@kernel.org> (raw)
In-Reply-To: <1188380370.3082.121.camel@acpi-hp.sh.intel.com>

This is a step in the right direction,
but the reason that I'm not going to apply this patch is because
this functionality should be handled by drivers/video/output.c
in a generic way.  (For that matter, output.c needs a few more things,
starting with a rename, say to "display_switch.c"?:-)

Also, brightness and display switching should be independent.

thanks,
-Len

On Wednesday 29 August 2007 05:39, Zhang Rui wrote:
> Introduce a new module parameter "auto_handle" to enable/disable
> handling hotkey events in ACPI video driver.
> 
> Now X can get the hotkey events via input layer and handle them
> all by itself, e.g brightness up/down, video output switch, etc.
> 
> With this patch applied,
> ACPI video driver can either handle the events itself or
> do nothing but export them to userspace.
> eg. the X people surely want to
> "echo 0 > /sys/module/video/parameters/auto_handle" so that
> they can take full charge of the video switch thing. :P
> 
> Note: auto_handle is disabled by default.
> 
> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> ---
>  drivers/acpi/video.c |   35 +++++++++++++++++++++++++----------
>  1 file changed, 25 insertions(+), 10 deletions(-)
> 
> Index: linux-2.6/drivers/acpi/video.c
> ===================================================================
> --- linux-2.6.orig/drivers/acpi/video.c
> +++ linux-2.6/drivers/acpi/video.c
> @@ -71,6 +71,9 @@ MODULE_AUTHOR("Bruno Ducrot");
>  MODULE_DESCRIPTION("ACPI Video Driver");
>  MODULE_LICENSE("GPL");
>  
> +static unsigned int auto_handle;
> +module_param(auto_handle, uint, 0644);
> +
>  static int acpi_video_bus_add(struct acpi_device *device);
>  static int acpi_video_bus_remove(struct acpi_device *device, int type);
>  
> @@ -1781,31 +1784,39 @@ static void acpi_video_bus_notify(acpi_h
>  	switch (event) {
>  	case ACPI_VIDEO_NOTIFY_SWITCH:	/* User requested a switch,
>  					 * most likely via hotkey. */
> +		if (auto_handle)
> +			acpi_video_switch_output(video, event);
>  		acpi_bus_generate_proc_event(device, event, 0);
>  		keycode = KEY_SWITCHVIDEOMODE;
>  		break;
>  
>  	case ACPI_VIDEO_NOTIFY_PROBE:	/* User plugged in or removed a video
>  					 * connector. */
> -		acpi_video_device_enumerate(video);
> -		acpi_video_device_rebind(video);
> -		acpi_video_switch_output(video, event);
> +
> +		if (auto_handle) {
> +			acpi_video_device_enumerate(video);
> +			acpi_video_device_rebind(video);
> +			acpi_video_switch_output(video, event);
> +		}
>  		acpi_bus_generate_proc_event(device, event, 0);
>  		keycode = KEY_SWITCHVIDEOMODE;
>  		break;
>  
>  	case ACPI_VIDEO_NOTIFY_CYCLE:	/* Cycle Display output hotkey pressed. */
> -		acpi_video_switch_output(video, event);
> +		if (auto_handle)
> +			acpi_video_switch_output(video, event);
>  		acpi_bus_generate_proc_event(device, event, 0);
>  		keycode = KEY_SWITCHVIDEOMODE;
>  		break;
>  	case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT:	/* Next Display output hotkey pressed. */
> -		acpi_video_switch_output(video, event);
> +		if (auto_handle)
> +			acpi_video_switch_output(video, event);
>  		acpi_bus_generate_proc_event(device, event, 0);
>  		keycode = KEY_VIDEO_NEXT;
>  		break;
>  	case ACPI_VIDEO_NOTIFY_PREV_OUTPUT:	/* previous Display output hotkey pressed. */
> -		acpi_video_switch_output(video, event);
> +		if (auto_handle)
> +			acpi_video_switch_output(video, event);
>  		acpi_bus_generate_proc_event(device, event, 0);
>  		keycode = KEY_VIDEO_PREV;
>  		break;
> @@ -1842,22 +1853,26 @@ static void acpi_video_device_notify(acp
>  
>  	switch (event) {
>  	case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS:	/* Cycle brightness */
> -		acpi_video_switch_brightness(video_device, event);
> +		if (auto_handle)
> +			acpi_video_switch_brightness(video_device, event);
>  		acpi_bus_generate_proc_event(device, event, 0);
>  		keycode = KEY_BRIGHTNESS_CYCLE;
>  		break;
>  	case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS:	/* Increase brightness */
> -		acpi_video_switch_brightness(video_device, event);
> +		if (auto_handle)
> +			acpi_video_switch_brightness(video_device, event);
>  		acpi_bus_generate_proc_event(device, event, 0);
>  		keycode = KEY_BRIGHTNESSUP;
>  		break;
>  	case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS:	/* Decrease brightness */
> -		acpi_video_switch_brightness(video_device, event);
> +		if (auto_handle)
> +			acpi_video_switch_brightness(video_device, event);
>  		acpi_bus_generate_proc_event(device, event, 0);
>  		keycode = KEY_BRIGHTNESSDOWN;
>  		break;
>  	case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS:	/* zero brightnesss */
> -		acpi_video_switch_brightness(video_device, event);
> +		if (auto_handle)
> +			acpi_video_switch_brightness(video_device, event);
>  		acpi_bus_generate_proc_event(device, event, 0);
>  		keycode = KEY_BRIGHTNESS_ZERO;
>  		break;
> -
> 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
> 

      reply	other threads:[~2007-08-31 20:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-29  9:39 [PATCH] ACPI video: introduce module parameter auto_handle Zhang Rui
2007-08-31 20:53 ` Len Brown [this message]

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=200708311653.27228.lenb@kernel.org \
    --to=lenb@kernel.org \
    --cc=arjan@infradead.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=rui.zhang@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).