From: federico ferri <xaero@inwind.it>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] change SysRq keycode for systems without SysRq key
Date: Wed, 18 Jul 2007 00:28:09 +0200 [thread overview]
Message-ID: <469D4279.1050602@inwind.it> (raw)
In-Reply-To: <20070716235748.33d50a53.akpm@linux-foundation.org>
Andrew Morton ha scritto:
> Seems harmless enough ;)
>
> Could you please send in a suitable update to Documentation/sysrq.txt?
sorry, I should have written a few lines here...
issue solved (sorry for not CCing here, I'm shy ((: ) resulting in no
need for a patch, just the need of a recent kernel and a userspace program.
I report here the full discussion I had with Linus Torvalds, Dmitry
Torokhov (CCed to linux-input list):
>>>>> this patch adds an entry in Kconfig after 'config MAGIC_SYSRQ' which
>>>>> asks for a different keycode (replacing also KEY_SYSRQ with
>>>>> CONFIG_MAGIC_SYSRQ_KEYCODE in char/keyboard.c)
>>>>>
>>>>> Federico
>>>>
>>>> Quite frankly, I think that if we want to make something like this
>>>> configurable, it should be dynamic, not compiled-in. So that the same
>>>> kernel image can be used with different keyboards.
>>>>
>>>> Linus
>>> (I can imagine it could be done via a /proc/sysrq-keycode virtual file,
>>> but that's just one possibility)
>>>
>>> So, this should turn into a feature request...
>>> would you accept feature requests? ( :
>>>
>>> Federico
>>
>> Well, this is totally untested, and I won't guarantee that this
works at
>> all, but this is how to generally do these kinds of things..
>>
>> Linus
>>
>> ---
>> drivers/char/keyboard.c | 6 +++++-
>> 1 files changed, 5 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
>> index 90965b4..e21f52b 100644
>> --- a/drivers/char/keyboard.c
>> +++ b/drivers/char/keyboard.c
>> @@ -157,6 +157,10 @@ static int sysrq_alt_use;
>> #endif
>> static int sysrq_alt;
>>
>> +static int sysrq_key = KEY_SYSRQ;
>> +module_param_named(sysrq_key, sysrq_key, uint, 0644);
>> +MODULE_PARM_DESC(sysrq_key, "The keycode to be used for sysrq");
>> +
>> /*
>> * Translation of scancodes to keycodes. We set them on only the first
>> * keyboard in the list that accepts the scancode and keycode.
>> @@ -1139,7 +1143,7 @@ static void kbd_keycode(unsigned int keycode,
int down, int hw_raw)
>> printk(KERN_WARNING "keyboard.c: can't emulate
rawmode for keycode %d\n", keycode);
>>
>> #ifdef CONFIG_MAGIC_SYSRQ /* Handle the SysRq Hack */
>> - if (keycode == KEY_SYSRQ && (sysrq_down || (down == 1 &&
sysrq_alt))) {
>> + if (keycode == sysrq_key && (sysrq_down || (down == 1 &&
sysrq_alt))) {
>> if (!sysrq_down) {
>> sysrq_down = down;
>> sysrq_alt_use = sysrq_alt;
>>
>
> YAY! it works great.
> tried with:
> # echo 183 > /sys/module/keyboard/parameters/sysrq_key
> but also keyboard.sys_rq=183 on the command line should work; I'll
> discover that on next reboot.
Yes, please do verify.
> thank you, Linus!
You're welcome.
> (now that this has done in the proper way, is this patch going to be
> merged in the tree?)
I'm certainly ok with it, but I guess it's more up to Dmitry. If he ack's
it, I can just commit it.
Dmitry? Any reason not to do this?
Linus
-------------------------------------------------------------------------------
On 7/17/07, federico ferri <xaero@inwind.it> wrote:
> Dmitry Torokhov ha scritto:
> >> Dmitry? Any reason not to do this?
> >>
> >
> > Recent kernels have the ability to remap keymap for USB keyboards via
> > EVIOCSKEYCODE ioctl (we allowed 0adjusting keymaps on PS/2 keyboards
> > for a long time). So instead of having the new parameter redefining
> > SysRq keycode Frederico can remap one of the keys on his keyboard to
> > generate KEY_SYSRQ. This way SysRq should still work if he plugs in
> > another USB keyboard that has SysRq key or a PS/2 keyboard.
>
> would setkeycodes still just work for PS2 keyboards?
> I upgraded to newer kbd-1.13 package (kernel 2.6.21), and while trying
> to change sysrq keycode still I get the old error:
>
> KDSETKEYCODE: No such device
> failed to set scancode 38b7 to keycode 84
>
> which I reported on gentoo a long time ago:
> http://bugs.gentoo.org/show_bug.cgi?id=97388
>
> (it doesn't use EVIOCSKEYCODE)
> maybe I'm not picking up the right program?
>
EVIOCSKEYCODE support for HID (USB) went in in 2.6.22-rc1.
There is keyfuzz utility you can use to play with keymaps for a
particular device:
http://0pointer.de/lennart/projects/keyfuzz/
--
Dmitry
prev parent reply other threads:[~2007-07-17 23:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-13 21:20 [PATCH] change SysRq keycode for systems without SysRq key federico ferri
2007-07-17 6:57 ` Andrew Morton
2007-07-17 22:28 ` federico ferri [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=469D4279.1050602@inwind.it \
--to=xaero@inwind.it \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.