lkml.org 
[lkml]   [2003]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] morse code panics for 2.5.62
On Tue, 2003-02-18 14:50:38 +0100, Tomas Szepe <szepe@pinerecords.com>
wrote in message <20030218135038.GA1048@louise.pinerecords.com>:

This is the first time I really look at the code, so please forgive if I
talk about things where already a consens was given...

> diff -urN a/include/linux/morseops.h b/include/linux/morseops.h
> --- a/include/linux/morseops.h 1970-01-01 01:00:00.000000000 +0100
> +++ b/include/linux/morseops.h 2003-02-15 10:21:35.000000000 +0100
> @@ -0,0 +1,26 @@
> +/* Yes, it's morse code ops indeed. */
> +
> +#ifndef _LINUX_MORSEOPS_H
> +#define _LINUX_MORSEOPS_H
> +
> +#include <linux/config.h>
> +
> +#if defined(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 = c - 'a' + 'A';
> + if (c >= '"' && c <= '_') {
> + return morsetable[c - '"'];
> + } else
> + return 0;
> +}
> +
> +#else /* CONFIG_MORSE_PANICS */
> + #define panic_morseblink(buf)

I think this has to read:

+# define panic_morseblink(buf)

IIRC there's no leading whitespace allowed for the '#', but there may
follow some...


> +#endif /* CONFIG_MORSE_PANICS */
> +
> +#endif /* _LINUX_MORSEOPS_H */
> diff -urN a/include/linux/vt_kern.h b/include/linux/vt_kern.h
> --- a/include/linux/vt_kern.h 2002-12-16 07:01:55.000000000 +0100
> +++ b/include/linux/vt_kern.h 2003-02-15 10:21:35.000000000 +0100
> @@ -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_turn_all_leds(int on_or_off);

Please, s/on_or_off/enlightened/ or something like that. That would keep
the semantics clear:-)

> extern int kbd_rate(struct kbd_repeat *rep);
>
> /* console.c */
> +#include <linux/jiffies.h>
> +#include <linux/vt_kern.h>
> +
> +#define DITLEN (HZ / 5)
> +#define DAHLEN (3 * DITLEN)
> +#define SPACELEN (7 * DITLEN)
> +#define FREQ 844
> +
> +static int morse_setting = 1;
> +
> +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 /* [\]^_ */
> +};

You're using a set bit for long and an unset bit for a short beep, don't
you? Storing these values in octal/as chars is quite low on memory
consumption, but I'd like to learn so I suggest:

#define NO 0 /* neither long nor short */
#define LB 1 /* long beep */
#define SB 0 /* short beep */
#define MORSE(letter, beep1, beep2, beep3, beep4, beep5, beep6, beep7) \
(beep1 << 6 | beep2 << 5 | beep3 << 4 | beep4 << 3 \
| beep5 << 2 | beep6 << 1 | beep7 << 0)

Then, do somethink like
const unsigned char morsetable[] = {
MORSE('A', NO, NO, NO, NO, LB, LB, SB),
...
};

(My values aren't right for sure, but this way, we all can easily learn
morse code:-)

MfG, JBG

--
Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur
fuer einen Freien Staat voll Freier Bürger" | im Internet!
Shell Script APT-Proxy: http://lug-owl.de/~jbglaw/software/ap2/
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 13:33    [W:0.040 / U:5.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site