From owner-freebsd-mobile Tue Jan 12 18:25:42 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id SAA11563 for freebsd-mobile-outgoing; Tue, 12 Jan 1999 18:25:42 -0800 (PST) (envelope-from owner-freebsd-mobile@FreeBSD.ORG) Received: from clover.kientzle.com (dnai-207-181-237-25.dialup.dnai.com [207.181.237.25]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id SAA11540 for ; Tue, 12 Jan 1999 18:25:39 -0800 (PST) (envelope-from kientzle@acm.org) Received: from acm.org (localhost.kientzle.com [127.0.0.1]) by clover.kientzle.com (8.8.8/8.8.7) with ESMTP id SAA00309 for ; Tue, 12 Jan 1999 18:14:46 -0800 (PST) (envelope-from kientzle@acm.org) Message-ID: <369C0195.2DE70CB3@acm.org> Date: Tue, 12 Jan 1999 18:14:45 -0800 From: Tim Kientzle Reply-To: kientzle@acm.org X-Mailer: Mozilla 4.5 [en] (X11; I; FreeBSD 2.2.8-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: mobile@FreeBSD.ORG Subject: APM power-off code Content-Type: multipart/mixed; boundary="------------8E5A3E2282734846BA47308E" Sender: owner-freebsd-mobile@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org This is a multi-part message in MIME format. --------------8E5A3E2282734846BA47308E Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Nate suggested I forward this to "mobile@freebsd.org". These are some patches I've used with both 2.2.5 and 2.2.8. They modify the shutdown code to actually turn off power on a system shutdown. I personally use it with my desktop machine; I find it quite convenient to type "shutdown" and walk away knowing that the machine will, in fact, turn itself off when it's done cleaning up. - Tim Kientzle P.S. This is probably not the best approach. It might be better to add a "register_poweroff_func()" function to kern_shutdown, and have the APM code register a power off function if an APM BIOS was found. P.P.S. I don't watch these lists, so email is best: kientzle@acm.org ================================================ --------------8E5A3E2282734846BA47308E Content-Type: message/rfc822 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Mozilla-Status2: 00000000 Message-ID: <36990C19.C68084D1@acm.org> Date: Sun, 10 Jan 1999 12:22:49 -0800 From: Tim Kientzle Reply-To: kientzle@acm.org X-Mailer: Mozilla 4.5 [en] (X11; I; FreeBSD 2.2.8-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: hosokawa@jp.freebsd.org, nate@freebsd.org Subject: APM power-off code Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Nate/Tatsumi, Just installed 2.2.8, and had to go back and re-hack in one local customization. I'd written Nate about this earlier, but got no response. Oh, well. The 'feature' is an addition to the APM code so that APM-equipped machines automatically power down on shut-down. Quite convenient for those of us that actually turn our FreeBSD machines off when we're not using them. I use this with my desktop machine. Here are the diffs: /usr/src-2.2.5/sys/i386/apm [12:11pm]# diff apm.c apm.c-original 217,238d216 < /* Turn off power to entire system */ < void < apm_power_off(void) < { < struct apm_softc *sc = &apm_softc; < u_long eax, ebx, ecx; < < if(!sc) < return; < < eax = (APM_BIOS << 8) | APM_SETPWSTATE; < ebx = PMDV_ALLDEV; < ecx = PMST_OFF; < < if (apm_int(&eax, &ebx, &ecx)) { < printf("Entire system power off failure: errcode = %ld\n", < 0xff & (eax >> 8)); < return; < } < return; < } < /usr/src-2.2.5/sys/kern [12:14pm]# diff -c kern_shutdown.c kern_shutdown.c-original *** kern_shutdown.c Thu Mar 12 13:12:16 1998 --- kern_shutdown.c-original Thu Mar 12 12:47:42 1998 *************** *** 249,257 **** } splhigh(); if (howto & RB_HALT) { - #ifdef APM_POWER_OFF - apm_power_off(); - #endif printf("\n"); printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); --- 249,254 ---- And, of course, a new config option: APM_POWER_OFF /* Use APM to turn off power on system shutdown */ I made these against 2.2.5 and am getting ready to test them against 2.2.8. - Tim Kientzle (kientzle@acm.org) --------------8E5A3E2282734846BA47308E-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message