Skip site navigation (1)Skip section navigation (2)
Date:      27 Feb 1998 17:11:15 +0100
From:      Sebastian Strollo <seb@erix.ericsson.se>
To:        freebsd-hackers@FreeBSD.ORG
Cc:        stefan@promo.de (Stefan Bethke)
Subject:   Re: Graceful shutdown by single keypress?
Message-ID:  <qy7m6hownw.fsf@scotch.du.etx.ericsson.se>
In-Reply-To: stefan@promo.de's message of 19 Feb 98 11:56:25 GMT
References:  <561614.3096881785@stefan.promo.de>

next in thread | previous in thread | raw e-mail | index | archive | help
stefan@promo.de (Stefan Bethke) writes:
> [He wants to have a system, for a trade show, that can switch itself off]
>                                                          I'm looking
> into an ATX system with APM support that can switch itself off.
> 
> Instead, I'd like to tell the operators to press the suspend key on the
> system, and wait for it to switch itself off. As I currently have no APM
> system to test this on (I will get the system the next few days), I'm
> interested in experiences with APM on desktop machines, and the feasibility
> of my idea. Also, if someone has any recommendations on a specific pentium
> mainboard, I'd be happy to hear them.

Yes, I think this is the way to go. (I don't have any recommendations
for specific mainboards, but I have the power off functionality
working on my desktop DELL.)

> [alternative solution involving serial port removed]
> 
> It would be acceptable for me to hack the kernel to add any necessary APM
> power-off command, if needed.

If you are running -current I think you could just hack a bit in
sys/i386/apm/apm.c, in the function apm_processevent() just change from:

		    OPMEV_DEBUGMESSAGE(PMEV_USERSUSPENDREQ);
			apm_suspend();
			break;
to:
		    OPMEV_DEBUGMESSAGE(PMEV_USERSUSPENDREQ);
			shutdown_nice();
			break;

Disclaimer: I haven't tested it :-) (If someone think it is a bad idea
please speak up.) Hmm, maybe there is even an interrupt/APM interface
for the power off key?

In -current this should then also power down your system. If you are
running -stable the system won't power off, just halt.But I have added
the powerdown things from -current in my system and could send you the
patches if you want them. (BTW, is this something we could put into
-stable? I think it is pretty neat that the machine powers down when I
halt it, and as I said I have the diffs for -current if anyone is
interested.)

Which makes me think about another thing, in sys/kern/kern_shutdown.c
in -current, shouldn't the call to cpu_power_down() be preceded by a
"if (howto & RB_POWEROFF)"? (Especially since the reboot utility have
command line option that actually adds that flag.)

-- Sebastian

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?qy7m6hownw.fsf>