diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-06-14 15:18:54 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-06-14 15:18:54 +0000 |
commit | 15ca9651efc74c158bdbd509b206196cde48c2e3 (patch) | |
tree | aa3ae5773bc581762f7ad59dd743351de848a398 | |
parent | d759dd43787b64cbde8a50ff2e337062a889278d (diff) |
remove speaker handling code. if you really want this, use the /etc/apm/*
scripts to do it. as it is, for most people this is terribly annoying and
unneccessary; toby ok
-rw-r--r-- | usr.sbin/apmd/apmd.8 | 18 | ||||
-rw-r--r-- | usr.sbin/apmd/apmd.c | 53 | ||||
-rw-r--r-- | usr.sbin/apmd/pathnames.h | 3 |
3 files changed, 5 insertions, 69 deletions
diff --git a/usr.sbin/apmd/apmd.8 b/usr.sbin/apmd/apmd.8 index fe2f0a66eae..22a35b2afef 100644 --- a/usr.sbin/apmd/apmd.8 +++ b/usr.sbin/apmd/apmd.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: apmd.8,v 1.27 2005/06/09 15:14:23 xsa Exp $ +.\" $OpenBSD: apmd.8,v 1.28 2005/06/14 15:18:53 deraadt Exp $ .\" .\" Copyright (c) 1995 John T. Kohl .\" All rights reserved. @@ -34,7 +34,7 @@ .Nd Advanced Power Management monitor daemon .Sh SYNOPSIS .Nm apmd -.Op Fl adempqs +.Op Fl ademps .Op Fl f Ar devname .Op Fl S Ar sockname .Op Fl t Ar seconds @@ -60,13 +60,6 @@ with logging facility .Dv LOG_DAEMON . .Pp .Nm -announces the transition to standby mode with a single high tone on the -speaker (using the -.Pa /dev/speaker -device). -Suspends are announced with two high tones. -.Pp -.Nm periodically polls the APM driver for the current power state. If the battery charge level changes substantially or the external power status changes, the new status is logged. @@ -98,12 +91,6 @@ enters debug mode, logging to facility and staying in the foreground on the controlling terminal. .Pp If the -.Fl q -flag is specified, -.Nm -does not announce suspend and standby requests on the speaker. -.Pp -If the .Fl m flag is specified, .Nm @@ -211,7 +198,6 @@ flag may be used to specify an alternate device file name. .Xr execve 2 , .Xr syslog 3 , .Xr apm 4 , -.Xr speaker 4 , .Xr apm 8 , .Xr sysctl 8 , .Xr syslogd 8 diff --git a/usr.sbin/apmd/apmd.c b/usr.sbin/apmd/apmd.c index b03638021c0..75148e1509c 100644 --- a/usr.sbin/apmd/apmd.c +++ b/usr.sbin/apmd/apmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apmd.c,v 1.33 2005/05/09 04:53:51 miod Exp $ */ +/* $OpenBSD: apmd.c,v 1.34 2005/06/14 15:18:53 deraadt Exp $ */ /* * Copyright (c) 1995, 1996 John T. Kohl @@ -67,7 +67,6 @@ enum apm_state handle_client(int sock_fd, int ctl_fd); void suspend(int ctl_fd); void stand_by(int ctl_fd); void sigexit(int signo); -void make_noise(int howmany); void do_etc_file(const char *file); void sockunlink(void); @@ -259,55 +258,11 @@ handle_client(int sock_fd, int ctl_fd) return reply.newstate; } -int speaker_ok = TRUE; - -void -make_noise(int howmany) -{ - int spkrfd = -1; - int trycnt; - - if (!speaker_ok) /* don't bother after sticky errors */ - return; - - for (trycnt = 0; trycnt < 3; trycnt++) { - spkrfd = open(_PATH_DEV_SPEAKER, O_WRONLY); - if (spkrfd == -1) { - switch (errno) { - case EBUSY: - usleep(500000); - errno = EBUSY; - continue; - case ENOENT: - case ENODEV: - case ENXIO: - case EPERM: - case EACCES: - syslog(LOG_WARNING, "speaker device " - _PATH_DEV_SPEAKER " unavailable: %m"); - speaker_ok = FALSE; - return; - } - } else - break; - } - - if (spkrfd == -1) { - syslog(LOG_WARNING, "cannot open " _PATH_DEV_SPEAKER ": %m"); - return; - } - - syslog(LOG_DEBUG, "sending %d tones to speaker", howmany); - write(spkrfd, "o4cc", 2 + howmany); - close(spkrfd); -} - void suspend(int ctl_fd) { do_etc_file(_PATH_APM_ETC_SUSPEND); sync(); - make_noise(2); sync(); sync(); sleep(1); @@ -319,7 +274,6 @@ stand_by(int ctl_fd) { do_etc_file(_PATH_APM_ETC_STANDBY); sync(); - make_noise(1); sync(); sync(); sleep(1); @@ -344,11 +298,8 @@ main(int argc, char *argv[]) int kq; struct kevent ev[2]; - while ((ch = getopt(argc, argv, "qadsepmf:t:S:")) != -1) + while ((ch = getopt(argc, argv, "adsepmf:t:S:")) != -1) switch(ch) { - case 'q': - speaker_ok = FALSE; - break; case 'a': noacsleep = 1; break; diff --git a/usr.sbin/apmd/pathnames.h b/usr.sbin/apmd/pathnames.h index d31e7dd5746..9f53af6b255 100644 --- a/usr.sbin/apmd/pathnames.h +++ b/usr.sbin/apmd/pathnames.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pathnames.h,v 1.4 2001/03/23 01:00:41 mickey Exp $ */ +/* $OpenBSD: pathnames.h,v 1.5 2005/06/14 15:18:53 deraadt Exp $ */ /* * Copyright (c) 1996 John T. Kohl @@ -38,4 +38,3 @@ #define _PATH_APM_ETC_POWERUP _PATH_APM_ETC_DIR"/powerup" #define _PATH_APM_ETC_POWERDOWN _PATH_APM_ETC_DIR"/powerdown" #define _PATH_APM_NORMAL "/dev/apm" -#define _PATH_DEV_SPEAKER "/dev/speaker" |