powerd intro

Paul Fox pgf at laptop.org
Tue Mar 16 16:27:24 EDT 2010


wad just reminded me of another user-visible change:  people need
to know how to inhibit automatic suspend.

to inhibit suspend...

  ... for the duration of a command you're running interactively:

	$ olpc-nosleep <commandname> <args>...

  ... for the duration of a command, from within the command:

	in shell:
	    touch /var/run/powerd-inhibit-suspend/$$
	in C:
	    /* add error checking to suit */
	    snprintf(path, sizeof(path),
		"/var/run/powerd-inhibit-suspend/%d", getpid());
	    close(open(path, O_RDWR));

	or however one does this from your language of choice.

      (powerd will remove the file after your script dies, though
       it's marginally more efficient if you can arrange to do so
       yourself.)

  ... until the next reboot:

	  touch /var/run/powerd-inhibit-suspend/1

      (powerd won't clean this up until the init process dies,
       which isn't likely)

  ... during a "non-local" interactive shell (network, or serial)
	using bash:

	  export PROMPT_COMMAND="powerd-config -a"

	(this will only work as long as your shell issues a
	command prompt more often than the system wants to
	suspend.  with a 15 second suspend interval, that's a
	little tight.  it works better with suspend timeouts of
	several minutes.)

  ... permanently (this is what the control-panel checkbox does):

	touch /etc/powerd/flags/inhibit-suspend


paul



i wrote:
 > reuben just reminded me that it might be worth mentioning the
 > user-visible changes that come about as a result of the switch to
 > powerd from ohmd.  there aren't many, at least as powerd is
 > currently configured:
 > 
 >     - new shutdown "menu" screen when the power button is pushed: 
 > 	i take full responsibility for the graphics [1], and any
 > 	suggestions for improvement will be seriously considered. 
 > 
 > 	there are three possible actions:  a) do nothing, and the
 > 	system will sleep in 7 seconds, or b) hit the keyboard or
 > 	touchpad to cancel and keep working, or c) push the power
 > 	button again to shut the laptop down (cleanly).  the goal
 > 	is to break the "hold the button for 4 seconds" habit.
 > 
 >     - the idle timers are set so the laptop will idle-suspend after
 > 	15 seconds, the screen will dim after 60, and the laptop
 > 	will sleep after 4 minutes (all counting from last
 > 	keyboard activity).  are these appropriate for a classroom
 > 	and student setting?
 > 
 >     - if on battery, the laptop will auto-shutdown after its been
 > 	asleep for 1 hour.  if plugged in, it will sleep forever.
 > 
 > 
 > paul
 > [1] http://dev.laptop.org/~pgf/pleaseconfirm.png  (it looks a lot
 >     better centered on the XO screen)
 > 
 > =---------------------
 >  paul fox, pgf at laptop.org
 > _______________________________________________
 > Devel mailing list
 > Devel at lists.laptop.org
 > http://lists.laptop.org/listinfo/devel

=---------------------
 paul fox, pgf at laptop.org



More information about the Devel mailing list