From owner-cvs-all Mon May 14 22:13:50 2001 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id EAAAA37B423; Mon, 14 May 2001 22:13:45 -0700 (PDT) (envelope-from nsayer@FreeBSD.org) Received: (from nsayer@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f4F5Djr76928; Mon, 14 May 2001 22:13:45 -0700 (PDT) (envelope-from nsayer) Message-Id: <200105150513.f4F5Djr76928@freefall.freebsd.org> From: Nick Sayer Date: Mon, 14 May 2001 22:13:45 -0700 (PDT) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/usr.sbin/apmd apmd.c apmd.h apmdlex.l apmdparse.y X-FreeBSD-CVS-Branch: HEAD Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG nsayer 2001/05/14 22:13:45 PDT Modified files: usr.sbin/apmd apmd.c apmd.h apmdlex.l apmdparse.y Log: Add battery state monitoring to apmd. The new syntax available in the config file is: apm_battery [0-9]+(%|[Mm) (dis|)charging { ... } The stuff in the braces is the same as the existing case. nn% checks for a certain percentage of life remaining and nnM checks for a cerain number of minutes remaining. Specifying "discharge" means that you're interested in knowing when the battery reaches a certain level while AC power is off, "charging" the opposite. The man page needs to be updated. The code can be fooled. If you SIGHUP the daemon and the battery level matches a rule it will be performed once per SIGHUP. If the battery level matches a rule and you repeatedly apply and take away AC power, the rule will be run once per occurance. This, however, is a feature. :-) The code also only runs when select() times out, so getting APM events more often than the timeout interval will result in the rules not being run. These are things that remain to be overcome. Revision Changes Path 1.5 +166 -9 src/usr.sbin/apmd/apmd.c 1.3 +22 -1 src/usr.sbin/apmd/apmd.h 1.3 +14 -1 src/usr.sbin/apmd/apmdlex.l 1.3 +40 -1 src/usr.sbin/apmd/apmdparse.y To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message