linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* PMU daemon
@ 1999-10-09  8:22 Paul Mackerras
  1999-10-11 10:13 ` Michael Schmitz
  1999-10-31 13:38 ` Troy Benjegerdes
  0 siblings, 2 replies; 10+ messages in thread
From: Paul Mackerras @ 1999-10-09  8:22 UTC (permalink / raw)
  To: linuxppc-dev


I have extended my pmu daemon and Batmon to work on my new 1999 G3
powerbook.  You can get it at ftp://ftp.linuxcare.com.au/pmud-0.2.tar.gz.
It works on my old 3400 and I believe it should work on wallstreet
powerbooks also.

Paul.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: PMU daemon
  1999-10-09  8:22 PMU daemon Paul Mackerras
@ 1999-10-11 10:13 ` Michael Schmitz
  1999-10-31 13:38 ` Troy Benjegerdes
  1 sibling, 0 replies; 10+ messages in thread
From: Michael Schmitz @ 1999-10-11 10:13 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev


> 
> I have extended my pmu daemon and Batmon to work on my new 1999 G3
> powerbook.  You can get it at ftp://ftp.linuxcare.com.au/pmud-0.2.tar.gz.

I was going to ask you about the necessary magic :-) Thanks a lot!

	Michael

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: PMU daemon
       [not found] <199910100459.XAA26749@lists.linuxppc.org>
@ 1999-10-14 15:46 ` Derek Homeier
  0 siblings, 0 replies; 10+ messages in thread
From: Derek Homeier @ 1999-10-14 15:46 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: paulus


On Sat, 9 Oct 1999 18:22:34 +1000, Paul Mackerras <paulus@linuxcare.com> wrote:
>
> I have extended my pmu daemon and Batmon to work on my new 1999 G3
> powerbook.  You can get it at ftp://ftp.linuxcare.com.au/pmud-0.2.tar.gz.
> It works on my old 3400 and I believe it should work on wallstreet
> powerbooks also.
> 
Thanks a lot, this works fine on my lombard. Is there any possibility to
let other battery monitors, such as wmapm/wmbattery benefit from this?

Another, perhaps a bit off-topic question: I managed to get my hd to spin down
again for some time with the current kernel (your 2.2.13), but Batmon indicates
only a minimal decrease in power consumption when it's spun down 
(the current goes down by something like 20-50 mA). Is this normal?

Cheers,
							Derek

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: PMU daemon
  1999-10-09  8:22 PMU daemon Paul Mackerras
  1999-10-11 10:13 ` Michael Schmitz
@ 1999-10-31 13:38 ` Troy Benjegerdes
  1999-10-31 23:15   ` Paul Mackerras
  1999-11-01 14:13   ` Brad Boyer
  1 sibling, 2 replies; 10+ messages in thread
From: Troy Benjegerdes @ 1999-10-31 13:38 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev


Paul Mackerras wrote:
> 
> I have extended my pmu daemon and Batmon to work on my new 1999 G3
> powerbook.  You can get it at ftp://ftp.linuxcare.com.au/pmud-0.2.tar.gz.
> It works on my old 3400 and I believe it should work on wallstreet
> powerbooks also.
> 

Arg..

ncftpget ftp://ftp.linuxcare.com.au/pmud-0.2.tar.gz
Remote host has closed the connection.
ncftpget: cannot open ftp.linuxcare.com.au: remote host closed control
connection. 

Anyone got a mirror of this?

-- 
--------------------------------------------------------------------------
| Troy Benjegerdes    |  troy@blacklablinux.com    |    hozer@drgw.net   |
|    Unix is user friendly... You just have to be friendly to it first.  |
| This message composed with 100% free software.    http://www.gnu.org   |
--------------------------------------------------------------------------

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: PMU daemon
  1999-10-31 13:38 ` Troy Benjegerdes
@ 1999-10-31 23:15   ` Paul Mackerras
  1999-10-31 23:33     ` Troy Benjegerdes
  1999-11-01 14:13   ` Brad Boyer
  1 sibling, 1 reply; 10+ messages in thread
From: Paul Mackerras @ 1999-10-31 23:15 UTC (permalink / raw)
  To: Troy Benjegerdes; +Cc: linuxppc-dev


On Mon, 01 Nov 1999, Troy Benjegerdes wrote:

> ncftpget ftp://ftp.linuxcare.com.au/pmud-0.2.tar.gz
> Remote host has closed the connection.
> ncftpget: cannot open ftp.linuxcare.com.au: remote host closed control
> connection. 

Not again...

Fixed now.

Paul.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: PMU daemon
  1999-11-01 14:13   ` Brad Boyer
@ 1999-10-31 23:22     ` Shaw Terwilliger
  0 siblings, 0 replies; 10+ messages in thread
From: Shaw Terwilliger @ 1999-10-31 23:22 UTC (permalink / raw)
  To: Brad Boyer; +Cc: Troy Benjegerdes, paulus, linuxppc-dev


Brad Boyer wrote:
> Troy Benjegerdes wrote:
> > ncftpget ftp://ftp.linuxcare.com.au/pmud-0.2.tar.gz
> > Remote host has closed the connection.
> > ncftpget: cannot open ftp.linuxcare.com.au: remote host closed control
> > connection. 
> 
> I found that the linuxcare site refuses all connections made with ncftp.
> Other ftp clients seem to work fine.

I'm using ncftp 3.0 BETA (18-21) and can connect and grab files just fine.
In fact I just grabbed pmud.  Maybe it's because the only copy of
pmud I found was in /pub/ppclinux, not in the root directory. 

However, ncftpget is throwing "ncftpget: file retrieval error: PORT failed."

-- 
Shaw Terwilliger (sterwill@io.nu)

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: PMU daemon
  1999-10-31 23:15   ` Paul Mackerras
@ 1999-10-31 23:33     ` Troy Benjegerdes
  1999-11-01 15:08       ` (simple /proc/apm support for pmud) " dsmk
  0 siblings, 1 reply; 10+ messages in thread
From: Troy Benjegerdes @ 1999-10-31 23:33 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev


Paul Mackerras wrote:
> 
> On Mon, 01 Nov 1999, Troy Benjegerdes wrote:
> 
> > ncftpget ftp://ftp.linuxcare.com.au/pmud-0.2.tar.gz
> > Remote host has closed the connection.
> > ncftpget: cannot open ftp.linuxcare.com.au: remote host closed control
> > connection.
> 
> Not again...
> 
> Fixed now.

Thanks, I wound up getting a copy from someone else.

Now that I've had a chance to try it, I've got a couple of comments.

You have a typo at the end of 'pwrctl'.. pwrctl_3400 $i instead of
pwrctl_3400 $1

I have a 3400 set up to use DHCP, and the pump client gets quite unhappy
when the pwrctl scrips do the ifconfig up and ifconfig down. I changed the
scripts to do 'ifup eth0' and 'ifdown eth0' so that the Red-hat style
scripts are called instead, which take care of starting a stopping pump.
This is also handy if you move to multiple places, and each has a DH CP
server. Just close the lid, and when you open it back up, you'll
automagically get a new working IP. Of course this plays havoc with any
open connections, or using the machine as a server, but I would suspect
very few (if any) powerbook users leave open connections or use the machine
as a server.

Is there a way to read the battery voltage from the console using pmud?

Finally, does anyone know how feasable it would be to make pmud have the
same API as the intel-ish APMD, since there are a bunch of nice X
apps/applets for various window managers that talk to APMD?

-- 
--------------------------------------------------------------------------
| Troy Benjegerdes    |  troy@blacklablinux.com    |    hozer@drgw.net   |
|    Unix is user friendly... You just have to be friendly to it first.  |
| This message composed with 100% free software.    http://www.gnu.org   |
--------------------------------------------------------------------------

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: PMU daemon
  1999-10-31 13:38 ` Troy Benjegerdes
  1999-10-31 23:15   ` Paul Mackerras
@ 1999-11-01 14:13   ` Brad Boyer
  1999-10-31 23:22     ` Shaw Terwilliger
  1 sibling, 1 reply; 10+ messages in thread
From: Brad Boyer @ 1999-11-01 14:13 UTC (permalink / raw)
  To: Troy Benjegerdes; +Cc: paulus, linuxppc-dev


Troy Benjegerdes wrote:
> ncftpget ftp://ftp.linuxcare.com.au/pmud-0.2.tar.gz
> Remote host has closed the connection.
> ncftpget: cannot open ftp.linuxcare.com.au: remote host closed control
> connection. 

I found that the linuxcare site refuses all connections made with ncftp.
Other ftp clients seem to work fine.

	Brad Boyer
	flar@pants.nu


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* (simple /proc/apm support for pmud) Re: PMU daemon
  1999-10-31 23:33     ` Troy Benjegerdes
@ 1999-11-01 15:08       ` dsmk
  1999-11-02  9:51         ` Michael Schmitz
  0 siblings, 1 reply; 10+ messages in thread
From: dsmk @ 1999-11-01 15:08 UTC (permalink / raw)
  To: Troy Benjegerdes; +Cc: Paul Mackerras, linuxppc-dev, dsmk




On Sun, 31 Oct 1999, Troy Benjegerdes wrote:
> [...]
> 
> Finally, does anyone know how feasable it would be to make pmud have the
> same API as the intel-ish APMD, since there are a bunch of nice X
> apps/applets for various window managers that talk to APMD?

Well, I threw together a quick patch to pmud that does this.  Here is the
message that I sent to Paul Mackerras the other day.

From: David King <dsmk@bu.edu>
To: paulus@linuxcare.com
Subject: /proc/apm compatability using pmud (patch)

Hi,

pmud-0.2 has been working great on my Lombard 333.  The only feature that 
I have missed is the ability to use the apm battery monitoring utilities
(Batmon is nice but I'd like something in my windowmaker dock).

This patch extends pmud to update a apm formated file with every polling 
pass.  I have managed to compile and use both wmbattery and wmapm by just 
changing the /proc/apm path to /var/spool/pmud/apm.  

This isn't exactly clean - the thresholds are hard-coded, it does not
correctly handle multiple batteries with the exception of time
remaining, does not handle the 3400 style battery lookup, and it does
not handle updating the remaining time when recharging - but it does
work.

My original plan was to add this functionality to pmud and then move it into
the kernel as /proc/apm but this works well enough for me that I'm not going
to worry about it for now.  

My next plan is to write a apm command which talks with pmud's telnet
port.  This should enable the sleep functionality of wmapm and some
other tools (they generally just do a system call to apm to force a sleep).

Thanks for the wonderful work,
-David

*** pmud.c.19991021	Sun Sep 26 05:31:57 1999
--- pmud.c	Fri Oct 22 13:51:22 1999
***************
*** 29,34 ****
--- 29,40 ----
  
  #define PMUD_VERSION		"0.2"
  
+ #define APMFILE 		"/var/spool/pmud/apm"
+ #define APMFAKEFLAGS		0x02
+ #define APMCRITICAL		10
+ #define APMLOW			30
+ #define APMSEC2MINTHRESHOLD	600
+ 
  #define POWERLEVEL_SCRIPT	"/sbin/pwrctl"
  #define POWER_FILE		"/etc/powerlevels"
  #define PORT			879
***************
*** 310,315 ****
--- 316,342 ----
  	struct timeval now;
  	int timeleft = -1;
  
+ #ifdef  APMFILE
+ 	static FILE *fapm = NULL;
+ 	struct pmu_apm_compat {
+ 	  int ac_avail;
+ 	  int battery_status;
+ 	  int battery_flags;
+ 	  int remain_percent;
+ 	  int remain_time;
+ 	  char* time_unit;
+ 	} pac;
+ 
+ 	/* init structure */
+ 	pac.ac_avail = 0;
+ 	pac.battery_status = 0;
+ 	pac.battery_flags = 0;
+ 	pac.remain_percent = 0;
+ 	pac.remain_time = 0;
+ 	pac.time_unit = "sec";
+ 
+ #endif
+ 
  	if (pmu_op(PMU_GET_INPUT, 0, 0, &switches, 1, "switch req") < 0)
  		return;
  
***************
*** 358,363 ****
--- 385,418 ----
  					sprintf(p, " %d", batt[j]);
  					p += strlen(p);
  				}
+ 
+ #ifdef APMFILE
+ 				/* prepare the apm structure */
+ 				if (batt[0] & 0x04) {
+ 				  pac.ac_avail = batt[0] & 0x01;
+ 
+ 				  /* determine a percent remaining 
+ 				     and a charge level */
+ 				  pac.remain_percent = 
+ 				    (batt[1] * 100) / batt[2];
+ 				  if (pac.remain_percent <= APMCRITICAL) {
+ 				    pac.battery_status = 0x02;
+ 				    pac.battery_flags = 0x04;
+ 				  } else if (pac.remain_percent <= APMLOW) {
+ 				    pac.battery_status = 0x01;
+ 				    pac.battery_flags = 0x02;
+ 				  } else {
+ 				    pac.battery_status = 0x00;
+ 				    pac.battery_flags = 0x01;
+ 				  }
+ 
+ 				  /* now we determine if we are charging */
+ 				  if (batt[0] & 0x02) {
+ 				    pac.battery_status = 0x03;
+ 				    pac.battery_flags |= 0x08;
+ 				  }
+ 				}
+ #endif				  
  			}
  			*p++ = '}';
  		}
***************
*** 365,371 ****
--- 420,460 ----
  		*p = 0;
  		if (current < 0)
  			timeleft = charge * 3552 / -current;
+ 
+ #ifdef APMFILE
+ 		if (timeleft > APMSEC2MINTHRESHOLD) {
+ 		  pac.remain_time = timeleft / 60;
+ 		  pac.time_unit = "min";
+ 		} else {
+ 		  pac.remain_time = timeleft;
+ 		}
+ #endif
  	}
+ 
+ #ifdef  APMFILE
+ 	/* now we output the data */
+ 
+ 	/* open or reset the file */
+ 	if (fapm == NULL) {
+ 	  /* open the new one for writing */
+ 	  fapm = fopen(APMFILE, "w");
+ 	} else {
+ 	  rewind(fapm);
+ 	}
+ 
+ 	/* rewrite the file */
+ 	if (fapm != NULL) {
+ 	  fprintf(fapm, "%s %d.0 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n%s",
+ 		  PMUD_VERSION,
+ 		  pmu_version,
+ 		  APMFAKEFLAGS,
+ 		  pac.ac_avail, pac.battery_status, pac.battery_flags,
+ 		  pac.remain_percent, pac.remain_time, pac.time_unit,
+ 		  "                                               ");
+ 	  fflush(fapm);
+ 	}
+ 
+ #endif 
  
  	n = strlen(status);
  	for (ss = all_sockets; ss != 0; ss = ssnext) {


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (simple /proc/apm support for pmud) Re: PMU daemon
  1999-11-01 15:08       ` (simple /proc/apm support for pmud) " dsmk
@ 1999-11-02  9:51         ` Michael Schmitz
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Schmitz @ 1999-11-02  9:51 UTC (permalink / raw)
  To: dsmk; +Cc: Troy Benjegerdes, Paul Mackerras, linuxppc-dev


> > Finally, does anyone know how feasable it would be to make pmud have the
> > same API as the intel-ish APMD, since there are a bunch of nice X
> > apps/applets for various window managers that talk to APMD?
> 
> Well, I threw together a quick patch to pmud that does this.  Here is the
> message that I sent to Paul Mackerras the other day.

Just what I need to use the Gnome applet :-) Thanks for implementing this. 
Please take care with the 'pmud sleeps machine at low power'
feature, the write to stderr should be omitted or replaced by a
syslog write there. At least on my machine, writing to stderr kills pmud
in the least 'convenient' moment. 

	Michael


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~1999-11-02  9:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-10-09  8:22 PMU daemon Paul Mackerras
1999-10-11 10:13 ` Michael Schmitz
1999-10-31 13:38 ` Troy Benjegerdes
1999-10-31 23:15   ` Paul Mackerras
1999-10-31 23:33     ` Troy Benjegerdes
1999-11-01 15:08       ` (simple /proc/apm support for pmud) " dsmk
1999-11-02  9:51         ` Michael Schmitz
1999-11-01 14:13   ` Brad Boyer
1999-10-31 23:22     ` Shaw Terwilliger
     [not found] <199910100459.XAA26749@lists.linuxppc.org>
1999-10-14 15:46 ` Derek Homeier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).