[Pm-utils] [PATCH] Set default quirk policy based on drivers

Stefan Seyfried seife at suse.de
Sat May 17 15:22:01 PDT 2008


Victor Lowther wrote:

> In that case, the way I would handle things would be to just disable
> 99video if our kernel drivers are smart enough in a separate hook --
> something alongthe lines of:
> 
> #!/bin/sh
> 
> . "${PM_FUNCTIONS}"
> 
> smart_kernel_video() 
> {
>         # If we are using an ATI or nVidia binary driver, do nothing.
> 	[ -d /sys/module/nvidia -o -d /sys/module/fglrx ] && return 0;
> 
> 	local kernel_rev="$(uname -r |awk -F '[_-]' '{print $1}')"
>         # Intel can to the same thing, but only at or after kernel 2.6.26.
> 	# FIXME: a more accurate way of testing this?
> 	[ -d /sys/module/i915 ] && \
> 	    [ "$kernel_rev" >= "2.6.26" ] && return 0;

which version of "[" does support this? Mine doesn't.

> 	return 1
> }
> 
> case $1 in 
> 	suspend|hibernate) smart_kernel_video && disablehook 99video ;;
> 	*) exit 0 ;;
> esac

I'd prefer the 99video hook to be self contained (what happens if a user
renames 99video to 98video?)
Just make the whole hook exit before checking for suspend or resume if there
is nothing to do.
Running a hook that does nothing else then disabling another one immediately
brings back RFC1925 - "you can always add another level of indirection" ;-)

Have fun,

	Stefan
-- 
Stefan Seyfried
R&D Team Mobile Devices            |              "Any ideas, John?"
SUSE LINUX Products GmbH, Nürnberg | "Well, surrounding them's out."

This footer brought to you by insane German lawmakers:
SUSE Linux Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)


More information about the Pm-utils mailing list