Messages in this thread Patch in this message | | | Date | Fri, 15 Oct 1999 09:15:30 -0400 (EDT) | From | Kelly STriker Price <> | Subject | PATCH: SysRq corrections on Intel Laptops [2.2.12] |
| |
Wheee, first patch for 2.2.12! :)
Anyway, this patch for kernel 2.2.12 corrects a problem on some laptops which require a Fn key along with Alt to reach the SysRq key, which also activates the overlay keypad and changes all the keys around.
This patch is baised off of a Compaq LTE Lite 4/25's laptop keyboard layout, so it might be off for slightly different configurations. The keymap is:
+--+--+--+--+ |7 |8 |9 |0 | <- Origonal key | 7| 8| 9| *| <- Fn+key mapping. Patch corrects this. ++-++-++-++-++ |U |I |O |P | | 4| 5| 6| -| ++-++-++-++-++ |J |K |L |; | | 1| 2| 3| +| +-++-++-++-++-++ |N |M |, |. |/ | | | 0| | | | +--+--+--+--+--+
It's complicates things a bit. I bet if we just pass through the keycode through and totally ignore the keypad (doing the remapping back there in drives/char/sysrq.c), it would make for a simpler solution.
p |\ _,,,---,,_ Kelly "STrRedWolf" Price u /,`.-'`' -. ;-;;,_ http://www.FurNation.com/STriker r |,4- ) )-,_..;\ ( `'-' WolfSkunks for a better Linux Kernel r '---''(_/--' `-'_) fL
---PATCH--- diff -r -u linux-2.2.12/Documentation/Configure.help linux-2.2.12kp1/Documentation/Configure.help --- linux-2.2.12/Documentation/Configure.help Fri Aug 27 00:06:52 1999 +++ linux-2.2.12kp1/Documentation/Configure.help Sat Sep 18 13:54:43 1999 @@ -9896,6 +9896,15 @@ keys are documented in Documentation/sysrq.txt. Don't say Y unless you really know what this hack does. +Corrective Screwy Laptop Keyboard support +CONFIG_SYSRQ_SCREWY + If you change loglevels when you try to magically unmount your system + (most likely a laptop), say "Y" here. This will recognize that you + need to hit a Fn key (unlike F1-F12) just to activate SysRq -- which + in turn changes half the keyboard to a keypad (which is bad). The + mapping used in this one is from a Compaq LTE Lite 4/25's keyboard. + You should check Documentation/sysrq.txt for more information. + ISDN subsystem CONFIG_ISDN CAUTION: the ISDN driver shipped with this kernel distribution diff -r -u linux-2.2.12/Documentation/sysrq.txt linux-2.2.12kp1/Documentation/sysrq.txt --- linux-2.2.12/Documentation/sysrq.txt Fri Aug 27 00:06:52 1999 +++ linux-2.2.12kp1/Documentation/sysrq.txt Sat Sep 18 14:09:11 1999 @@ -19,6 +19,11 @@ (older?) may not have a key labeled 'SysRQ'. The 'SysRQ' key is also known as the 'Print Screen' key. + Some keyboars, expecally laptops, require you also use a "Fn" key + to activate the SysRQ key. This also has a side effect of + remapping half the keyboard for a keypad, which is bad. See + below for some information about how to correct this. + On SPARC - You press 'ALT-STOP-<command key>', I believe. On PowerPC - You press 'ALT-Print Screen-<command key>'. @@ -106,6 +111,31 @@ '#define SYSRQ_KEY 0x54' in [/usr/src/linux/]include/asm/keyboard.h to the keycode of the key you wish to use, then recompile. Oh, and by the way, you exit 'showkey' by not typing anything for ten seconds. + +* I try to unmount, but I get a log level change instead on my laptop. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +[Kelly Price <tygris@glue.umd.edu> writes] Same here, expecially on my +Compaq LTE Lite 4/25 laptop. So I wrote up a patch about it. Say "Y" to +CONFIG_SYSRQ_SCREWY, which activates the hack ontop of a hack, and +accomidates for this behavor. + +/* + * Somehow, especially with laptops, the entire right hand side where the + * numeric keypad is overlaid onto is made into the keypad when you hit + * SysRq (On mine it's Fn-Alt-SysRq). Try to remount your HD and you + * change levels instead. GGGGRRRRR!!!! + * + * Origionally I wanted to remap all over the place, but that makes things + * messy. Lets try to see if it's remapping to the numeric keypad, which has + * a different keycode. If it is, we can thrap it back to what's expected + * and don't have to mess with the case statements at all. *JOY!* Oh, BTW, + * it doesn't affect the normal 0-9 keys. + * --Kelly + */ + +[Kelly] A more elegant hack would be to pass the keycode to handle_sysrq +instead of the translated key and then, depending on the laptop's layout, do +the key translation there. * I have more questions, who can I ask? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff -r -u linux-2.2.12/arch/i386/config.in linux-2.2.12kp1/arch/i386/config.in --- linux-2.2.12/arch/i386/config.in Fri Aug 27 00:05:42 1999 +++ linux-2.2.12kp1/arch/i386/config.in Sat Sep 18 13:56:23 1999 @@ -203,5 +203,8 @@ #bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ +if [ "$CONFIG_MAGIC_SYSRQ" != "n" ]; then + bool ' Corrective screwy laptop keyboard support' CONFIG_SYSRQ_SCREWY +fi endmenu diff -r -u linux-2.2.12/drivers/char/keyboard.c linux-2.2.12kp1/drivers/char/keyboard.c --- linux-2.2.12/drivers/char/keyboard.c Fri Aug 27 00:05:51 1999 +++ linux-2.2.12kp1/drivers/char/keyboard.c Fri Sep 17 00:53:15 1999 @@ -21,6 +21,7 @@ * * 27-05-97: Added support for the Magic SysRq Key (Martin Mares) * 30-07-98: Dead keys redone, aeb@cwi.nl. + * 14-09-99: Quick hack to fix bug w/Magic SysRq Key on laptops (Kelly Price) */ #include <linux/config.h> @@ -249,7 +250,11 @@ return; } else if (sysrq_pressed) { if (!up_flag && sysrq_enabled) +#ifdef CONFIG_SYSRQ_SCREWY /* Do additional hacking */ + handle_sysrq( (kbd_sysrq_xlate[keycode] | ((keycode & 0x7f) << 16)), kbd_pt_regs, kbd, tty); +#else handle_sysrq(kbd_sysrq_xlate[keycode], kbd_pt_regs, kbd, tty); +#endif return; } #endif diff -r -u linux-2.2.12/drivers/char/sysrq.c linux-2.2.12kp1/drivers/char/sysrq.c --- linux-2.2.12/drivers/char/sysrq.c Fri Aug 27 00:05:52 1999 +++ linux-2.2.12kp1/drivers/char/sysrq.c Sat Sep 18 14:01:06 1999 @@ -6,6 +6,8 @@ * * (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz> * based on ideas by Pavel Machek <pavel@atrey.karlin.mff.cuni.cz> + * Screwball Laptop Mapping (c) 1999 Kelly "STrRedWolf" Price + * <tygris@erols.com> */ #include <linux/config.h> @@ -57,16 +59,72 @@ * and any other keycode arrives. */ +/* + * Somehow, especially with laptops, the entire right hand side where the + * numeric keypad is overlaid onto is made into the keypad when you hit + * SysRq (On mine it's Fn-Alt-SysRq). Try to remount your HD and you + * change levels instead. GGGGRRRRR!!!! + * + * Origionally I wanted to remap all over the place, but that makes things + * messy. Lets try to see if it's remapping to the numeric keypad, which has + * a different keycode. If it is, we can thrap it back to what's expected + * and don't have to mess with the case statements at all. *JOY!* Oh, BTW, + * it doesn't affect the normal 0-9 keys. + * --Kelly + */ + + void handle_sysrq(int key, struct pt_regs *pt_regs, struct kbd_struct *kbd, struct tty_struct *tty) { int orig_log_level = console_loglevel; +#ifdef CONFIG_SYSRQ_SCREWY + int keycode; + + /* I folded the keycode in on the higher 16 bits of key, so we'll + * have to unmunge it here. */ + keycode=(key & 0x7f0000) >> 16; + + /* Place this here so we won't forget it. */ + key=key & 0xffff; + + /* Now this is as good as a place for any to check that keycode and + * fix that bug. */ + switch(keycode) + { + case 55: + key='0'; break; + case 74: + key='p'; break; + case 75: + key='u'; break; + case 76: + key='i'; break; + case 77: + key='o'; break; + case 78: + key=';'; break; + case 79: + key='j'; break; + case 80: + key='k'; break; + case 81: + key='l'; break; + case 82: + key='m'; break; + case 83: + key='.'; break; + } + + /* And we are done! */ +#endif if (!key) return; console_loglevel = 7; printk(KERN_INFO "SysRq: "); + switch (key) { case 'r': /* R -- Reset raw mode */ if (kbd) {
- 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/
| |