I'm not happy though for a number of reasons (not the least being this is
the first time I've tried to follow this part of the kernel since 0.95 days!)
1) Is this the right place? I think it is, since that's where the APM stuff
powers down the machine, but it means the do_exit(0) isn't ever called.
Judicious use of printk seems to show that "halt"ing the current kernel
doesn't do any tight loops anymore - the schedule() still runs. My
hack puts an infinite loop in there... Alan Cox had suggested I look
at arch/i386/kernel/*.c but, due to lack of familiarity, I couldn't
find any good place to put the code.
2) Intel specific - I couldn't find a general way of creating a beep! I
found this code in drivers/char/vt.c and "stole" it. Shame printk()
doesn't understand \a for beeping :-)
3) Replication of code from vt.c! Yuck.
4) Is udelay() really "good" up to 1000000L ???
Anyway, your comments on this small-n-simple hack much appreciated.
Stephen Harris
sweh@spuddy.mew.co.uk http://www.spuddy.org/
The truth is the truth, and opinion just opinion. But what is what?
My employer pays to ignore my opinions; you get to do it for free.
* Meeeeow ! Call Spud the Cat on > 01268 515441 < for free Usenet access *
=-=-=-=-=-=-=-=-=-
diff -rc kernel-35/arch/i386/config.in test-kernel/arch/i386/config.in
*** kernel-35/arch/i386/config.in Mon May 13 05:17:23 1996
--- test-kernel/arch/i386/config.in Thu Dec 10 23:58:01 1998
***************
*** 43,48 ****
--- 43,51 ----
486 CONFIG_M486 \
Pentium CONFIG_M586 \
PPro CONFIG_M686" Pentium
+
+ bool 'System beep on halt' CONFIG_BEEP_ON_HALT
+
endmenu
source drivers/block/Config.in
diff -rc kernel-35/kernel/sys.c test-kernel/kernel/sys.c
*** kernel-35/kernel/sys.c Tue Jun 30 10:27:16 1998
--- test-kernel/kernel/sys.c Thu Dec 10 23:55:06 1998
***************
*** 24,29 ****
--- 24,32 ----
#if defined(CONFIG_APM) && defined(CONFIG_APM_POWER_OFF)
#include <linux/apm_bios.h>
#endif
+ #if defined(CONFIG_BEEP_ON_HALT)
+ #include <linux/delay.h>
+ #endif
#include <asm/segment.h>
#include <asm/io.h>
***************
*** 201,206 ****
--- 204,222 ----
sys_kill(-1, SIGKILL);
#if defined(CONFIG_APM) && defined(CONFIG_APM_POWER_OFF)
apm_set_power_state(APM_STATE_OFF);
+ #endif
+ #if defined(CONFIG_BEEP_ON_HALT)
+ while (1) {
+ /* This is stolen from drivers/char/vt.c */
+ /* beep is 750Hz */
+ outb_p(inb_p(0x61)|3,0x61);
+ outb_p(0xB6,0x43);
+ outb_p(54,0x42);
+ outb_p(6,0x42);
+ udelay(1000000L);
+ outb_p(inb_p(0x61)&0xFC,0x61);
+ udelay(1000000L);
+ }
#endif
do_exit(0);
} else
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/