morse code panics for 2.5.65
Subsystems (2)
PATCH 1/1 morse code panics for 2.5.65
Arch-independent morse code panics.
Rediffed against 2.5.65.
drivers/char/keyboard.c +21 -0
@@ -260,6 +260,27 @@ }/* +* Turn all possible leds on or off. +*/ +void kd_set_led_all (int state) +{ +struct list_head *node; + state = state ?1 :0 ; + +list_for_each (node, &kbd_handler.h_list) { +struct input_handle *handle =to_handle_h (node); +if (test_bit (EV_LED , handle->dev->evbit)) { +int led; +for (led =0 ; led <=LED_MAX ; led++) { +if (test_bit (led, handle->dev->ledbit)) +input_event (handle->dev,EV_LED , led, + state); + } + } + } +} + +/* * Setting the keyboard rate. */ static inline unsigned int ms_to_jiffies (unsigned int ms) {
include/linux/morseops.h +23 -0
@@ -0,0 +1,23 @@ +/* Yes, it's morse code ops indeed. */ + +#ifndef _LINUX_MORSEOPS_H +#define _LINUX_MORSEOPS_H + +#include <linux/config.h> + +#ifdef CONFIG_MORSE_PANICS + +extern const unsigned char morsetable[];/* in kernel/morse.c */ +void panic_morseblink (char *buf);/* in kernel/morse.c */ + +static inline unsigned char tomorse (char c) { +if (c >='a' && c <='z' ) + c -='a' -'A' ; +return (c >='"' && c <='_' ) ? morsetable[c -'"' ] :0 ; +} + +#else /* CONFIG_MORSE_PANICS */ +# define panic_morseblink (buf) do { } while (0) +#endif /* CONFIG_MORSE_PANICS */ + +#endif /* _LINUX_MORSEOPS_H */
include/linux/vt_kern.h +3 -0
@@ -33,7 +33,10 @@wait_queue_head_t paste_wait; } *vt_cons[MAX_NR_CONSOLES ]; +/* keyboard.c */ +extern void kd_mksound (unsigned int hz,unsigned int ticks); +extern void kd_set_led_all (int state);extern int kbd_rate (struct kbd_repeat *rep);/* console.c */
init/Kconfig +15 -0
@@ -108,6 +108,21 @@ 13 => 8 KB 12 => 4 KB +config MORSE_PANICS + bool "Morse code panics" + depends on VT + help + When enabled, this code will make a panicking kernel cry for + help in morse code, signalling on the leds of a possibly attached + keyboard and/or a bleeper. You can enable/disable your morse + output devices of choice using the "panicmorse" kernel boot + parameter. Currently, "panicmorse=0" will disable the signalling + completely, "panicmorse=1" (the default) will only blink the leds, + "panicmorse=2" will only beep, and "panicmorse=3" will do both. + + If unsure, say Y. This feature is very helpful to those who + spend most of their time in X. + endmenu
kernel/Makefile +1 -0
@@ -18,6 +18,7 @@ obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o obj-$(CONFIG_SOFTWARE_SUSPEND) += suspend.o obj-$(CONFIG_COMPAT) += compat.o +obj-$(CONFIG_MORSE_PANICS) += morse.o ifneq ($(CONFIG_IA64),y) # According to Alan Modra <[email protected]>, the -fno-omit-frame-pointer is
kernel/morse.c +229 -0
229 lines not on this page · raw message
kernel/panic.c +3 -1
@@ -16,6 +16,7 @@#include <linux/init.h> #include <linux/sysrq.h> #include <linux/interrupt.h> +#include <linux/morseops.h> asmlinkage void sys_sync(void); /* it's really int */
@@ -95,7 +96,8 @@disabled_wait (caller);#endif local_irq_enable (); -for (;;) { +for (;;) { +panic_morseblink (buf); CHECK_EMERGENCY_SYNC } }