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

Victor Lowther victor.lowther at gmail.com
Sat May 17 17:09:24 PDT 2008


On Sun, 2008-05-18 at 00:22 +0200, Stefan Seyfried wrote:
> 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.

You are correct.  

> > 	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" ;-)

Noted.  The current version of this idea uses --quirk-none and modifies
the hook-running infrastructure to allow hooks to manipulate the global
parameter list directly.  It does this to handle the uswsusp case.

To do this and to implement the defaults idea while still letting
uswsusp do the right thing it has to be a separate hook -- either that
or maintain two parallel copies of the  same code and try to keep them
in sync.  I prefer the seperate hook.

> Have fun,
> 
> 	Stefan
-- 
Victor Lowther
Ubuntu Certified Professional



More information about the Pm-utils mailing list