From owner-freebsd-questions Wed Aug 30 17:44:11 2000 Delivered-To: freebsd-questions@freebsd.org Received: from hand.dotat.at (sfo-gw.covalent.net [207.44.198.62]) by hub.freebsd.org (Postfix) with ESMTP id CF66937B42C for ; Wed, 30 Aug 2000 17:44:02 -0700 (PDT) Received: from fanf by hand.dotat.at with local (Exim 3.15 #3) id 13UIS5-000737-00; Thu, 31 Aug 2000 00:43:33 +0000 Date: Thu, 31 Aug 2000 00:43:31 +0000 From: Tony Finch To: Jonathan Smith Cc: freebsd-questions@freebsd.org Subject: Re: apm and X Message-ID: <20000831004331.B25064@hand.dotat.at> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: Organization: Covalent Technologies, Inc Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Jonathan Smith wrote: >I'm running X 4 on 4.1-RELEASE and apm -z blanks the screen and puts the >machine to sleep happily, but when done from within X, the X descktop >stays on screen and the monitor doesn't blank out. Can you recover from this situation? My laptop hangs *hard* when I try to suspend from within X, so I wrote a small wrapper to switch to a text console before running `apm -z` which I keep in /usr/local/bin. You should also change /etc/apmd.conf to invoke this zzz rather than the standard one. Tony. -- en oeccget g mtcaa f.a.n.finch v spdlkishrhtewe y dot@dotat.at eatp o v eiti i d. fanf@covalent.net /* * zzz.c: a wrapper around apm(8) that works on my dodgy laptop * * (C) 2000 Tony Finch */ static const char *const cvsid = "$Header: /cvs/fanf/zzz/zzz.c,v 1.1.1.1 2000/06/22 08:43:37 fanf Exp $"; #include #include #include #include #include #include #include int main() { int fd, vt, status; fd = open("/dev/vga", O_RDONLY); if(fd < 0) err(1, "open /dev/vga"); if(ioctl(fd, VT_GETACTIVE, &vt) < 0) err(1, "ioctl VT_GETACTIVE"); if(ioctl(fd, VT_ACTIVATE, 1) < 0) err(1, "ioctl VT_ACTIVATE"); switch(fork()) { case -1: err(1, "fork"); case 0: execl("/usr/sbin/apm", "apm", "-z", NULL); err(1, "exec apm -z"); default: wait(&status); if(!WIFEXITED(status) || WEXITSTATUS(status)) errx(1, "apm -z failed"); } sleep(3); if(ioctl(fd, VT_ACTIVATE, vt) < 0) err(1, "ioctl VT_ACTIVATE"); exit(0); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message