Date: Tue, 19 Aug 2008 10:27:19 +0800 From: Erich Dollansky <oceanare@pacific.net.sg> To: freebsd-acpi@freebsd.org Subject: powerd, please test patch Message-ID: <48AA2F87.8060506@pacific.net.sg>
index | next in thread | raw e-mail
[-- Attachment #1 --]
Hi,
I am using powerd on a notebook. Stopping powerd left the CPU running in
the last mode it was in.
This patch extents powerd's command line by the parameter '-e' to set
the exit mode.
By default, it will set the CPU into maximum mode.
This patch is for FreeBSD 6.3 updated beginning of the month.
Erich
[-- Attachment #2 --]
15,16c15,16
< * THIS SOFTWARE IS PROVIDED BY THE AUTHOR``AS IS'' AND ANY EXPRESS OR
< * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
---
> * THIS SOFTWARE IS PROVIDED BY THE AUTHOR``AS IS'' AND ANY EXPRESS OR
> * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18c18
< * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
---
> * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23,24c23,24
< * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
< * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
---
> * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
> * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28,34d27
< /*
< 17.08.08 Erich Dollansky (ed) (oceanare@pacific.net.sg additional command
< line parameters introduced::
<
< e: mode the CPU is set on exit.
< */
<
105,112d97
< /* 17.08.08 ed: additional function definitions */
<
< static void SwitchToLowest (int acline, int curfreq, int numfreqs, int *freqs, int vflag);
< static void SwitchToHighest (int acline, int curfreq, int *freqs, int vflag);
<
< /* 17.08.08 ed: end of additional function definitions. */
<
<
266,267d250
< /* 17.08.08 ed: text changed */
<
269,270c252
< "usage: powerd [-v] [-a mode] [-b mode] [-i %%] [-n mode] [-p ival] [-r %%] [-e mode] [-P pidfile]\n"
< "mode: minimum | maximum | adaptive\n");
---
> "usage: powerd [-v] [-a mode] [-b mode] [-i %%] [-n mode] [-p ival] [-r %%] [-P pidfile]\n");
274,304d255
< static void SwitchToLowest (int acline, int curfreq, int numfreqs, int *freqs, int vflag)
< {
< if (curfreq != freqs[numfreqs - 1]) {
< if (vflag) {
< printf("now operating on %s power; "
< "changing frequency to %d MHz\n",
< modes[acline], freqs[numfreqs - 1]);
< }
< if (set_freq(freqs[numfreqs - 1]) != 0) {
< warn("error setting CPU freq %d",
< freqs[numfreqs - 1]);
< }
< }
< }
<
< static void SwitchToHighest (int acline, int curfreq, int *freqs, int vflag)
< {
< if (curfreq != freqs[0]) {
< if (vflag) {
< printf("now operating on %s power; "
< "changing frequency to %d MHz\n",
< modes[acline], freqs[0]);
< }
< if (set_freq(freqs[0]) != 0) {
< warn("error setting CPU freq %d",
< freqs[0]);
< }
< }
< }
<
<
313d263
< int mode_exit; /* 17.08.09 ed */
319,320d268
< mode_exit = MODE_MAX; /* 17.08.08 ed */
< acline = SRC_AC; /* 17.08.08 ed */
332,334c280
< /* 17.08.08 ed additional command line parameters added */
<
< while ((ch = getopt(argc, argv, "a:b:e:i:n:p:P:r:v")) != EOF)
---
> while ((ch = getopt(argc, argv, "a:b:i:n:p:P:r:v")) != EOF)
342,344d287
< case 'e': /* 17.08.08 ed */
< parse_mode (optarg, &mode_exit, ch);
< break;
481c424,435
< SwitchToLowest (acline, curfreq, numfreqs, freqs, vflag);
---
> if (curfreq != freqs[numfreqs - 1]) {
> if (vflag) {
> printf("now operating on %s power; "
> "changing frequency to %d MHz\n",
> modes[acline], freqs[numfreqs - 1]);
> }
> if (set_freq(freqs[numfreqs - 1]) != 0) {
> warn("error setting CPU freq %d",
> freqs[numfreqs - 1]);
> continue;
> }
> }
487c441,452
< SwitchToHighest (acline, curfreq, freqs, vflag);
---
> if (curfreq != freqs[0]) {
> if (vflag) {
> printf("now operating on %s power; "
> "changing frequency to %d MHz\n",
> modes[acline], freqs[0]);
> }
> if (set_freq(freqs[0]) != 0) {
> warn("error setting CPU freq %d",
> freqs[0]);
> continue;
> }
> }
532,548d496
<
< /* 17.08.08 ed: we set now the exit mode. Maximum speed is choosen if an
< unknown mode is set */
<
< if (mode_exit != MODE_MIN)
< {
< mode_exit = MODE_MAX;
< }
< if (mode_exit == MODE_MIN) {
< SwitchToLowest (acline, curfreq, numfreqs, freqs, vflag);
< }
< else if (mode_exit == MODE_MAX) {
< SwitchToHighest (acline, curfreq, freqs, vflag);
< }
<
< /* 17.08.08 ed: end of the addition. */
<
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48AA2F87.8060506>
