[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ibook and sleep



On Fri, 2003-05-30 at 05:00, Nirmal Govind wrote: 
> Hi.. I have the ibook2 and benh kernel 2.4.20-ben10 .. when I put the ibook to 
> sleep by closing the lid, the display and the backlight go off, then come on 
> again and then go off.. is this the same behavior in the latest kernel too? 

Probably. Attached are some of the files I've been using to solve this
and other problems, I guess it would be nice if some of this was
integrated properly into pmud. Comments appreciated.


-- 
Earthling Michel Dänzer   \  Debian (powerpc), XFree86 and DRI developer
Software libre enthusiast  \     http://svcs.affero.net/rm.php?r=daenzer
#!/bin/bash

logger=/usr/bin/logger
localfun=/etc/power/pwrctl-local


function pwrctl_Core99() 
{
	case "$1" in
	minimum)
	;;
	medium)
    	;;
	maximum)
    	;;
	warning)
	;;
	sleep)
		# Save fblevel
		invoke-rc.d pmud-utils stop || true

		# Turn off panel
		fblevel 0

		# Don't want the broken function in pwrctl to be run
		exit 1
    	;;
	wakeup)
		# Restore fblevel and trackpad settings
		invoke-rc.d pmud-utils start || true

		# Adjust time
		invoke-rc.d ntpdate restart || true

		# Start cronjobs if necessary
		invoke-rc.d anacron start < /dev/null || true
	;;
	*)
		$logger -p daemon.error -t pwrctl-local "$0: invalid arg $1"
	;;
	esac

        case "$2" in
        ac)
                $logger -p daemon.info -t pwrctl-local "ac in, remounting with atime" 
                mount -o remount,atime /

		[ -f /proc/cpufreq ] && echo 667000:1000000:performance > /proc/cpufreq
        ;;
        *)
                $logger -p daemon.info -t pwrctl-local "on battery, remounting with noatime"  
                mount -o remount,noatime /

		[ -f /proc/cpufreq ] && echo 667000:1000000:powersave > /proc/cpufreq
        ;;
        esac
}


# -----------------------------------------------------------------------------
# main
# -----------------------------------------------------------------------------

case "$PMUVERSION" in
12)	pwrctl_Core99 $1 $2 ;;
*) 
	$logger -p daemon.error -t pwrctl-local "no function for PMU $PMUVERSION"
;;
esac >>/var/log/pwrctls 2>&1

exit 0
#! /bin/sh
#
# pmud-utils	Power Manager daemon for Apple powerbooks utilities
#
# chkconfig: 2345 39 61
# description: miscellaneous pmud related utilities
# config: /etc/default/pmud-utils /etc/default/fblevel

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=pmud-utils
DESC="PowerBook Miscellaneous Utilities"

# Read fblevel settings from /etc/default if available
FBLEVELFILE=/etc/default/fblevel
[ -f $FBLEVELFILE ] && FBLEVEL=`cat $FBLEVELFILE 2>/dev/null`

# Source options
[ -f /etc/default/pmud-utils ] && . /etc/default/pmud-utils

(test -f /sbin/fblevel || test -f /sbin/trackpad) || exit 0

# See how we were called.
case "$1" in
  start|reload)
	echo -n "Setting up $NAME: fblevel"
	[ "$FBLEVEL" = "" ] || /sbin/fblevel $FBLEVEL
	echo -n " trackpad"
	[ "$TRACKPAD" = "" ] || /sbin/trackpad $TRACKPAD
	echo "."
	;;
  stop)
	echo -n "Saving $NAME settings: fblevel"
	rm -f $FBLEVELFILE
	tempfile -n $FBLEVELFILE >/dev/null || {
		echo "cannot create $FBLEVELFILE"
		exit 1
        }
	/sbin/fblevel > $FBLEVELFILE
	echo "."
	;;
  status)
	FBLVL=`/sbin/fblevel`
        echo "Panel backlight level: $FBLVL."
	;;
  *)
	echo "Usage: pmud {start|reload|stop|status}"
	exit 1
esac

exit 0
# Arguments to /sbin/fblevel. This is saved in /etc/default/fblevel, but you can
# override that here.
#FBLEVEL=11

# Arguments to be passed to /sbin/trackpad
TRACKPAD=notap

Reply to: