* Re: [PATCH -ac] Panicking in morse code [not found] <20020719011300.548d72d5.arodland@noln.com.suse.lists.linux.kernel> @ 2002-07-19 10:38 ` Andi Kleen 2002-07-20 7:05 ` Ville Herva [not found] ` <20020720173222.3286fcbb.arodland@noln.com.suse.lists.linux.kernel> 1 sibling, 1 reply; 11+ messages in thread From: Andi Kleen @ 2002-07-19 10:38 UTC (permalink / raw) To: Andrew Rodland; +Cc: linux-kernel, alan Andrew Rodland <arodland@noln.com> writes: > I was researching panic_blink() for someone who needed a little help, > when I noticed the comment above the function definition, not being the > kind to step down from a challenge (unless it's just really hard), I > decided to write morse code output code. Great. Congratulations (having written the original comment). I would encode the morse strings as bits in a integer instead of strings though (perhaps with some macros to make it readable), that should shrink it quite a bit. > > The option panicblink= has been hijacked to be a simple bitfield: > bit 1 : blink LEDs > bit 2 : sound the PC speaker. > > the blinking option depends only on pc_keyb.c. the pcspeaker option > depends on kb_mksound() actually doing something. At the moment, both of > these mean i386. The call to panic_blink() in panic() is still guarded > by an i386 #ifdef, anyway, for the moment. The default is to blink only, > because I figured the beeps would be too annoying. Opinions? I would consider beeps annoying, but then I usually just cut the beeper line on any new PC I install so personally I do not care. Still imagine what a machine room that overheated and caused several boxes to panic would sound like... -Andi ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH -ac] Panicking in morse code 2002-07-19 10:38 ` [PATCH -ac] Panicking in morse code Andi Kleen @ 2002-07-20 7:05 ` Ville Herva 2002-07-20 11:49 ` Neale Banks 0 siblings, 1 reply; 11+ messages in thread From: Ville Herva @ 2002-07-20 7:05 UTC (permalink / raw) To: Andi Kleen; +Cc: Andrew Rodland, linux-kernel On Fri, Jul 19, 2002 at 12:38:24PM +0200, you [Andi Kleen] wrote: > Andrew Rodland <arodland@noln.com> writes: > > > I was researching panic_blink() for someone who needed a little help, > > when I noticed the comment above the function definition, not being the > > kind to step down from a challenge (unless it's just really hard), I > > decided to write morse code output code. > > I would consider beeps annoying, but then I usually just cut the beeper > line on any new PC I install so personally I do not care. Still imagine > what a machine room that overheated and caused several boxes to panic > would sound like... I'm just waiting for Andrew to come up with a proper morse code network layer, so that the machines in the room can communicate (provided they have a mic each)... Now combine that with Ingo's network console and... -- v -- v@iki.fi ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH -ac] Panicking in morse code 2002-07-20 7:05 ` Ville Herva @ 2002-07-20 11:49 ` Neale Banks 2002-07-20 11:55 ` Thunder from the hill 0 siblings, 1 reply; 11+ messages in thread From: Neale Banks @ 2002-07-20 11:49 UTC (permalink / raw) To: Ville Herva; +Cc: Andrew Rodland, linux-kernel On Sat, 20 Jul 2002, Ville Herva wrote: [...] > I'm just waiting for Andrew to come up with a proper morse code network > layer, so that the machines in the room can communicate (provided they have > a mic each)... Now combine that with Ingo's network console and... You mean like an implementation of RFC 1926: "An Experimental Encapsulation of IP Datagrams on Top of ATM[1]"? ;-) Neale. [1] ATM: in this case it's "Acoustical Transmission Media" ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH -ac] Panicking in morse code 2002-07-20 11:49 ` Neale Banks @ 2002-07-20 11:55 ` Thunder from the hill 0 siblings, 0 replies; 11+ messages in thread From: Thunder from the hill @ 2002-07-20 11:55 UTC (permalink / raw) To: Neale Banks; +Cc: Ville Herva, Andrew Rodland, linux-kernel Hi, On Sat, 20 Jul 2002, Neale Banks wrote: > You mean like an implementation of RFC 1926: "An Experimental > Encapsulation of IP Datagrams on Top of ATM[1]"? ;-) The author assumes that the users take whatever precautions that are necessary before attempting to use this protocol in any crowded area. Same thing to add here... Regards, Thunder -- (Use http://www.ebb.org/ungeek if you can't decode) ------BEGIN GEEK CODE BLOCK------ Version: 3.12 GCS/E/G/S/AT d- s++:-- a? C++$ ULAVHI++++$ P++$ L++++(+++++)$ E W-$ N--- o? K? w-- O- M V$ PS+ PE- Y- PGP+ t+ 5+ X+ R- !tv b++ DI? !D G e++++ h* r--- y- ------END GEEK CODE BLOCK------ ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <20020720173222.3286fcbb.arodland@noln.com.suse.lists.linux.kernel>]
[parent not found: <200207211849.56076.bhards@bigpond.net.au.suse.lists.linux.kernel>]
[parent not found: <20020721100818.A22176@flint.arm.linux.org.uk.suse.lists.linux.kernel>]
* Re: [PATCH -ac] Panicking in morse code v3 [not found] ` <20020721100818.A22176@flint.arm.linux.org.uk.suse.lists.linux.kernel> @ 2002-07-21 9:29 ` Andi Kleen 0 siblings, 0 replies; 11+ messages in thread From: Andi Kleen @ 2002-07-21 9:29 UTC (permalink / raw) To: Russell King; +Cc: linux-kernel Russell King <rmk@arm.linux.org.uk> writes: > Hmm. I thought the original idea for the "flash LEDs on panic" was > so you knew something had gone wrong early in the boot, at the kind > of places where you don't have a console initialised. If you don't > have the console initialised, you sure as hell don't have the input > layer or keyboard drivers initialised. [having written the original code...] The idea was to distingush panic from lockup when you are in X and cannot see the console and X is dead so you cannot switch to the console. Handling early panic is probably better done by an "early console", like x86-64 supports one. -Andi ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH -ac] Panicking in morse code
@ 2002-07-19 5:13 Andrew Rodland
2002-07-20 21:32 ` [PATCH -ac] Panicking in morse code v3 Andrew Rodland
0 siblings, 1 reply; 11+ messages in thread
From: Andrew Rodland @ 2002-07-19 5:13 UTC (permalink / raw)
To: linux-kernel, alan
No, it's not 1 April.
I was researching panic_blink() for someone who needed a little help,
when I noticed the comment above the function definition, not being the
kind to step down from a challenge (unless it's just really hard), I
decided to write morse code output code.
The option panicblink= has been hijacked to be a simple bitfield:
bit 1 : blink LEDs
bit 2 : sound the PC speaker.
the blinking option depends only on pc_keyb.c. the pcspeaker option
depends on kb_mksound() actually doing something. At the moment, both of
these mean i386. The call to panic_blink() in panic() is still guarded
by an i386 #ifdef, anyway, for the moment. The default is to blink only,
because I figured the beeps would be too annoying. Opinions?
It recognizes letters, and digits, and treats everything else as a
space. The timings are tunable by #defines. It repeats the message
indefinitely. And it should only bloat the kernel by a few hundred
bytes, although if someone wants to wrap this in its own config option,
well, that's good too.
Anyway, here's the patch. It's against linux-2.4.19-rc1-ac1+preempt, but
I suspect it applies against all recent -ac. If 2.5 has this, it will
hopefully apply with some fuzz against that, too. I don't have a tree.
(modem. ecch.)
diff -u -r -d linux.old/drivers/char/pc_keyb.c linux/drivers/char/pc_keyb.c
--- linux.old/drivers/char/pc_keyb.c Fri Jul 19 00:59:04 2002
+++ linux/drivers/char/pc_keyb.c Fri Jul 19 01:00:34 2002
@@ -1244,37 +1244,126 @@
#endif /* CONFIG_PSMOUSE */
-static int blink_frequency = HZ/2;
+static int blink_setting = 1;
/* Tell the user who may be running in X and not see the console that we have
panic'ed. This is to distingush panics from "real" lockups.
Could in theory send the panic message as morse, but that is left as an
- exercise for the reader. */
-void panic_blink(void)
-{
- static unsigned long last_jiffie;
- static char led;
- /* Roughly 1/2s frequency. KDB uses about 1s. Make sure it is
- different. */
- if (!blink_frequency)
- return;
- if (jiffies - last_jiffie > blink_frequency) {
- led ^= 0x01 | 0x04;
+ exercise for the reader.
+ And now it's done! LED and speaker morse code by Andrew Rodland, 18-19 Jul 2002
+*/
+
+static const char * morse[] = {
+ ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", /* A-H */
+ "..", ".---.", "-.-", ".-..", "--", "-.", "---", ".--.", /* I-P */
+ "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", /* Q-X */
+ "-.--", "--..", /* Y-Z */
+ "-----", ".----", "..---", "...--", "....-", /* 0-4 */
+ ".....", "-....", "--...", "---..", "----." /* 5-9 */
+};
+
+#define DITLEN (HZ / 4)
+#define DAHLEN 3 * DITLEN
+#define FREQ 1000
+
+static __inline__ void do_blink (int led) {
+
+ if (! blink_setting & 0x01)
+ return;
+
+ led = led ? (0x01 | 0x04) : 0x00;
+
while (kbd_read_status() & KBD_STAT_IBF) mdelay(1);
kbd_write_output(KBD_CMD_SET_LEDS);
mdelay(1);
while (kbd_read_status() & KBD_STAT_IBF) mdelay(1);
mdelay(1);
kbd_write_output(led);
- last_jiffie = jiffies;
+}
+
+void panic_blink(char * buf)
+{
+ static unsigned long next_jiffie = 0;
+ static char * bufpos = 0;
+ static char * morsepos = 0;
+ static char state;
+
+ if (!blink_setting)
+ return;
+
+ if (!buf)
+ buf="ABC";
+
+
+ if (jiffies > next_jiffie || !bufpos) { //messy. fix.
+
+ if (state) {
+ do_blink(0);
+ state = 0;
+ next_jiffie = jiffies + DITLEN;
+ return;
+ }
+
+ if (!bufpos) {
+ bufpos = (char *)buf;
+ return;
+ }
+
+
+ if (!morsepos || !*morsepos) {
+
+ if (!*bufpos) { /*Repeat the message */
+ bufpos = (char *)buf;
+ morsepos = 0;
+ next_jiffie = jiffies + 3 * DAHLEN;
+ return;
+ }
+ next_jiffie = jiffies + DITLEN;
+
+ if (*bufpos >= 'A' && *bufpos <= 'Z') {
+ morsepos = (char *)morse[*bufpos - 'A'];
+ } else if (*bufpos >= 'a' && *bufpos <= 'z') {
+ morsepos = (char *)morse[*bufpos - 'a'];
+ } else if (*bufpos >= '0' && *bufpos <= '9') {
+ morsepos = (char *)morse[*bufpos - '0' + 26];
+ } else {
+ next_jiffie += 2*DITLEN;
+ }
+ bufpos ++;
+
+ return;
+ }
+
+ if (*morsepos == '.') {
+ if (blink_setting & 0x02)
+ kd_mksound(FREQ, DITLEN);
+ next_jiffie = jiffies + DITLEN;
+ do_blink(1);
+ state = 1;
+ morsepos++;
+ return;
+ } else if (*morsepos == '-') {
+ if (blink_setting & 0x02)
+ kd_mksound(FREQ, DAHLEN);
+ next_jiffie = jiffies + DAHLEN;
+ do_blink(1);
+ state = 1;
+ morsepos++;
+ return;
+ }
+
+ /*impossible*/
+ morsepos = 0;
+
}
+
}
static int __init panicblink_setup(char *str)
{
int par;
if (get_option(&str,&par))
- blink_frequency = par*(1000/HZ);
+ blink_setting = par;
return 1;
}
diff -u -r -d linux.old/kernel/panic.c linux/kernel/panic.c
--- linux.old/kernel/panic.c Fri Jul 19 00:59:04 2002
+++ linux/kernel/panic.c Thu Jul 18 21:45:45 2002
@@ -97,8 +97,8 @@
sti();
for(;;) {
#if defined(__i386__) && defined(CONFIG_VT)
- extern void panic_blink(void);
- panic_blink();
+ extern void panic_blink(char * buf);
+ panic_blink(buf);
#endif
CHECK_EMERGENCY_SYNC
}
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH -ac] Panicking in morse code v3 2002-07-19 5:13 [PATCH -ac] Panicking in morse code Andrew Rodland @ 2002-07-20 21:32 ` Andrew Rodland 2002-07-21 8:49 ` Brad Hards 2002-07-21 15:43 ` Daniel Phillips 0 siblings, 2 replies; 11+ messages in thread From: Andrew Rodland @ 2002-07-20 21:32 UTC (permalink / raw) To: linux-kernel Once more Mr. unnamed sent me some suggestions, and once more I've merged [my own adaptation of] them in. Also, I took an attempt to make it somewhat more platform-independent, and re-organize. The original panic_blink was in pc_keyb.c, and was guarded by an #ifdef __i386__ . v3 moves the generic code out of pc_keyb (and into panic.c). It should be able to blink on anything that uses pc_keyb (i386, some ARM, and some MIPS, apparently), and should be able to beep on anything that defines kd_mksound to do something (currently only i386). Also the code has been reorganized so as to be easier to read and follow, and there are a few more punctuation characters. Yes, I actually _am_ trying to turn this into something useful. Now, I don't have a 2.5 tree, and probably wouldn't understand it if I did, but I get a feeling that this won't be so incredibly easy to port, thanks to having everything use the input layer. Or am I wrong? --hobbs Patch follows diff -u -r linux.old/drivers/char/pc_keyb.c linux.new/drivers/char/pc_keyb.c --- linux.old/drivers/char/pc_keyb.c Fri Jul 19 18:56:36 2002 +++ linux.new/drivers/char/pc_keyb.c Sat Jul 20 13:18:40 2002 @@ -1244,41 +1244,13 @@ #endif /* CONFIG_PSMOUSE */ -static int blink_frequency = HZ/2; +void pckbd_blink (char led) { + led = led ? (0x01 | 0x04) : 0x00; -/* Tell the user who may be running in X and not see the console that we have - panic'ed. This is to distingush panics from "real" lockups. - Could in theory send the panic message as morse, but that is left as an - exercise for the reader. */ -void panic_blink(void) -{ - static unsigned long last_jiffie; - static char led; - /* Roughly 1/2s frequency. KDB uses about 1s. Make sure it is - different. */ - if (!blink_frequency) - return; - if (jiffies - last_jiffie > blink_frequency) { - led ^= 0x01 | 0x04; while (kbd_read_status() & KBD_STAT_IBF) mdelay(1); kbd_write_output(KBD_CMD_SET_LEDS); mdelay(1); while (kbd_read_status() & KBD_STAT_IBF) mdelay(1); mdelay(1); kbd_write_output(led); - last_jiffie = jiffies; - } -} - -static int __init panicblink_setup(char *str) -{ - int par; - if (get_option(&str,&par)) - blink_frequency = par*(1000/HZ); - return 1; } - -/* panicblink=0 disables the blinking as it caused problems with some console - switches. otherwise argument is ms of a blink period. */ -__setup("panicblink=", panicblink_setup); - diff -u -r linux.old/kernel/panic.c linux.new/kernel/panic.c --- linux.old/kernel/panic.c Fri Jul 19 18:56:36 2002 +++ linux.new/kernel/panic.c Sat Jul 20 17:28:41 2002 @@ -16,6 +16,8 @@ #include <linux/init.h> #include <linux/sysrq.h> #include <linux/interrupt.h> +#include <linux/vt_kern.h> +#include <linux/pc_keyb.h> asmlinkage void sys_sync(void); /* it's really int */ @@ -28,9 +30,132 @@ panic_timeout = simple_strtoul(str, NULL, 0); return 1; } - __setup("panic=", panic_setup); +static int blink_setting = 1; + +/* Tell the user who may be running in X and not see the console that we have + panic'ed. This is to distingush panics from "real" lockups. + Could in theory send the panic message as morse, but that is left as an + exercise for the reader. + And now it's done! LED and speaker morse code by Andrew Rodland + <arodland@noln.com>, with improvements based on suggestions from + linux@horizon.com. +*/ + +static const unsigned char morsetable[] = { + /* ! " # $ % & ' */ + 0, 0122, 0, 0310, 0, 0, 0163, + /* ( ) * + , - . / */ + 055, 0155, 0, 0, 0163, 0141, 0152, 0051, + /* 0-9 */ + 077, 076, 074, 070, 060, 040, 041, 043, 047, 057, + /* : ; < = > ? @ */ + 0107, 0125, 0, 0061, 0, 0114, 0, + /* A-I */ + 006, 021, 025, 011, 002, 024, 013, 020, 004, + /* J-R */ + 036, 015, 022, 007, 005, 017, 026, 033, 012, + /* S-Z */ + 010, 003, 014, 030, 016, 031, 035, 023, + /* [ \ ] ^ */ + 0, 0, 0, 0, + /* _ */ + 0154 + +}; + +#define DITLEN (HZ / 5) +#define DAHLEN 3 * DITLEN +#define SPACELEN 7 * DITLEN + +#define FREQ 844 + + +#if (defined(__i386__) && defined(CONFIG_VT)) || defined(CONFIG_PC_KEYB) +#define do_blink(x) pckbd_blink(x) +#else +#define do_blink(x) 0 +#endif + +void panic_blink(char * buf) +{ + static unsigned long next_jiffie = 0; + static char * bufpos = 0; + static unsigned char morse = 0; + static char state = 1; + + if (!blink_setting) + return; + + if (!buf) + buf="Panic lost?"; + + + if (bufpos && time_after (next_jiffie, jiffies)) { + return; /* Waiting for something. */ + } + + if (state) { /* Coming off of a blink. */ + if (blink_setting & 0x01) + do_blink(0); + + state = 0; + + if(morse > 1) { /* Not done yet, just a one-dit pause. */ + next_jiffie = jiffies + DITLEN; + } else { /* Get a new char, and figure out how much space. */ + + if(!bufpos) + bufpos = (char *)buf; /* First time through */ + + if(!*bufpos) { + bufpos = (char *)buf; /* Repeating */ + next_jiffie = jiffies + SPACELEN; + } else { + next_jiffie = jiffies + DAHLEN; /* Inter-letter space */ + } + + if (*bufpos >= '!' && *bufpos <= '_') { + morse = morsetable[*bufpos - '!']; + } else if (*bufpos >= 'a' && *bufpos <= 'z') { + morse = morsetable[*bufpos - 'a' + 'A' - '!']; + } else { + next_jiffie = jiffies + SPACELEN; /*Space -- For a total of 7*/ + state = 1; /* And bring us back here when we're done */ + } + bufpos ++; + } + } else { /* Starting a new blink. We have valid code in morse. */ + int len; + + len = (morse & 001) ? DAHLEN : DITLEN; + + if (blink_setting & 0x02) + kd_mksound(FREQ, len); + + next_jiffie = jiffies + len; + + if (blink_setting & 0x01) + do_blink(1); + state = 1; + morse >>= 1; + } +} + +static int __init panicblink_setup(char *str) +{ + int par; + if (get_option(&str,&par)) + blink_setting = par; + return 1; +} + +/* panicblink=0 disables the blinking as it caused problems with some console + switches. otherwise argument is ms of a blink period. */ +__setup("panicblink=", panicblink_setup); + + /** * panic - halt the system * @fmt: The text string to print @@ -96,10 +221,7 @@ #endif sti(); for(;;) { -#if defined(__i386__) && defined(CONFIG_VT) - extern void panic_blink(void); - panic_blink(); -#endif + panic_blink(buf); CHECK_EMERGENCY_SYNC } } ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH -ac] Panicking in morse code v3 2002-07-20 21:32 ` [PATCH -ac] Panicking in morse code v3 Andrew Rodland @ 2002-07-21 8:49 ` Brad Hards 2002-07-21 9:08 ` Russell King 2002-07-21 15:43 ` Daniel Phillips 1 sibling, 1 reply; 11+ messages in thread From: Brad Hards @ 2002-07-21 8:49 UTC (permalink / raw) To: Andrew Rodland, linux-kernel On Sun, 21 Jul 2002 07:32, Andrew Rodland wrote: > Yes, I actually _am_ trying to turn this into something useful. > Now, I don't have a 2.5 tree, and probably wouldn't understand it if I > did, but I get a feeling that this won't be so incredibly easy to port, > thanks to having everything use the input layer. Or am I wrong? While it will be non-trivial, it won't be hard either. The advantage of the input layer is that it no longer matters what type of keyboard is attached - you can just call input_event() and turn on and off the LED. The input layer abstracts out the magic values needed for any particular keyboard. Brad -- http://conf.linux.org.au. 22-25Jan2003. Perth, Australia. Birds in Black. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH -ac] Panicking in morse code v3 2002-07-21 8:49 ` Brad Hards @ 2002-07-21 9:08 ` Russell King 2002-07-21 10:50 ` Zwane Mwaikambo 0 siblings, 1 reply; 11+ messages in thread From: Russell King @ 2002-07-21 9:08 UTC (permalink / raw) To: Brad Hards; +Cc: Andrew Rodland, linux-kernel On Sun, Jul 21, 2002 at 06:49:55PM +1000, Brad Hards wrote: > While it will be non-trivial, it won't be hard either. > The advantage of the input layer is that it no longer matters what > type of keyboard is attached - you can just call input_event() and > turn on and off the LED. The input layer abstracts out the magic > values needed for any particular keyboard. Hmm. I thought the original idea for the "flash LEDs on panic" was so you knew something had gone wrong early in the boot, at the kind of places where you don't have a console initialised. If you don't have the console initialised, you sure as hell don't have the input layer or keyboard drivers initialised. Otherwise it becomes a "toy" feature that doesn't have much value. What would be more useful would be to disable the console blank timer on a panic() so it doesn't blank half-way through someone reading the oops, leaving them with no way to read the rest of it! -- Russell King (rmk@arm.linux.org.uk) The developer of ARM Linux http://www.arm.linux.org.uk/personal/aboutme.html ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH -ac] Panicking in morse code v3 2002-07-21 9:08 ` Russell King @ 2002-07-21 10:50 ` Zwane Mwaikambo 0 siblings, 0 replies; 11+ messages in thread From: Zwane Mwaikambo @ 2002-07-21 10:50 UTC (permalink / raw) To: Russell King; +Cc: Brad Hards, Andrew Rodland, Linux Kernel On Sun, 21 Jul 2002, Russell King wrote: > Otherwise it becomes a "toy" feature that doesn't have much value. > What would be more useful would be to disable the console blank > timer on a panic() so it doesn't blank half-way through someone > reading the oops, leaving them with no way to read the rest of it! I actually thought of that last night when it happened whilst examining an oops. --- linux-2.5.25/kernel/panic.c.orig Sun Jul 21 12:45:56 2002 +++ linux-2.5.25/kernel/panic.c Sun Jul 21 12:09:42 2002 @@ -49,6 +49,9 @@ unsigned long caller = (unsigned long) __builtin_return_address(0); #endif +#ifdef CONFIG_VT + disable_console_blank(); +#endif bust_spinlocks(1); va_start(args, fmt); vsprintf(buf, fmt, args); --- linux-2.5.25/drivers/char/console.c.orig Sun Jul 21 12:46:18 2002 +++ linux-2.5.25/drivers/char/console.c Sun Jul 21 12:24:31 2002 @@ -2758,6 +2758,12 @@ timer_do_blank_screen(0, 1); } +void disable_console_blank(void) +{ + del_timer_sync(&console_timer); + blankinterval = 0; +} + void poke_blanked_console(void) { del_timer(&console_timer); --- linux-2.5.25/include/linux/console.h.orig Sun Jul 21 12:47:01 2002 +++ linux-2.5.25/include/linux/console.h Sun Jul 21 12:25:42 2002 @@ -112,6 +112,7 @@ extern void release_console_sem(void); extern void console_conditional_schedule(void); extern void console_unblank(void); +extern void disable_console_blank(void); /* VESA Blanking Levels */ #define VESA_NO_BLANKING 0 -- function.linuxpower.ca ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH -ac] Panicking in morse code v3 2002-07-20 21:32 ` [PATCH -ac] Panicking in morse code v3 Andrew Rodland 2002-07-21 8:49 ` Brad Hards @ 2002-07-21 15:43 ` Daniel Phillips 2002-07-22 17:18 ` Andrew Rodland 1 sibling, 1 reply; 11+ messages in thread From: Daniel Phillips @ 2002-07-21 15:43 UTC (permalink / raw) To: Andrew Rodland, linux-kernel Here's my contribution to the ongoing beautification: static const unsigned char morsetable[] = { 0122, 0, 0310, 0, 0, 0163, /* "#$%&' */ 055, 0155, 0, 0, 0163, 0141, 0152, 0051, /* ()*+,-./ */ 077, 076, 074, 070, 060, 040, 041, 043, 047, 057, /* 0-9 */ 0107, 0125, 0, 0061, 0, 0114, 0, /* :;<=>?@ */ 006, 021, 025, 011, 002, 024, 013, 020, 004, /* A-I */ 036, 015, 022, 007, 005, 017, 026, 033, 012, /* J-R */ 010, 003, 014, 030, 016, 031, 035, 023, /* S-Z */ 0, 0, 0, 0, 0154 /* [\]^_ */ }; unsigned char tomorse(char c) { return c >= '"' && c <= '_'? morsetable[c - '"']: 0; } used as: + if (!(morse = tomorse(toupper(*bufpos)))) { + next_jiffie = jiffies + SPACELEN; /*Space -- For a total of 7*/ + state = 1; /* And bring us back here when we're done */ + } -- Daniel ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH -ac] Panicking in morse code v3 2002-07-21 15:43 ` Daniel Phillips @ 2002-07-22 17:18 ` Andrew Rodland 0 siblings, 0 replies; 11+ messages in thread From: Andrew Rodland @ 2002-07-22 17:18 UTC (permalink / raw) To: Daniel Phillips; +Cc: linux-kernel On Sun, 21 Jul 2002 17:43:42 +0200 Daniel Phillips <phillips@arcor.de> wrote: > Here's my contribution to the ongoing beautification: > > [snip patch] Nice. Thanks. Merged in spirit, if not letter. :) I suppose I should start putting this up on a webpage instead of bothering the list every time there's an improvement. ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2002-07-21 17:17 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20020719011300.548d72d5.arodland@noln.com.suse.lists.linux.kernel>
2002-07-19 10:38 ` [PATCH -ac] Panicking in morse code Andi Kleen
2002-07-20 7:05 ` Ville Herva
2002-07-20 11:49 ` Neale Banks
2002-07-20 11:55 ` Thunder from the hill
[not found] ` <20020720173222.3286fcbb.arodland@noln.com.suse.lists.linux.kernel>
[not found] ` <200207211849.56076.bhards@bigpond.net.au.suse.lists.linux.kernel>
[not found] ` <20020721100818.A22176@flint.arm.linux.org.uk.suse.lists.linux.kernel>
2002-07-21 9:29 ` [PATCH -ac] Panicking in morse code v3 Andi Kleen
2002-07-19 5:13 [PATCH -ac] Panicking in morse code Andrew Rodland
2002-07-20 21:32 ` [PATCH -ac] Panicking in morse code v3 Andrew Rodland
2002-07-21 8:49 ` Brad Hards
2002-07-21 9:08 ` Russell King
2002-07-21 10:50 ` Zwane Mwaikambo
2002-07-21 15:43 ` Daniel Phillips
2002-07-22 17:18 ` Andrew Rodland
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®