Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 97388 - setkeycodes b725 84 doesn't work (KDSETKEYCODE: No such device) changing the magic sysrq key on usb kbd
Summary: setkeycodes b725 84 doesn't work (KDSETKEYCODE: No such device) changing the ...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL: http://marc.theaimsgroup.com/?l=linux...
Whiteboard:
Keywords:
Depends on: 185788
Blocks:
  Show dependency tree
 
Reported: 2005-06-29 06:39 UTC by Federico Ferri (RETIRED)
Modified: 2007-07-19 23:35 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
This is the patch file i was talking about (kbd-sysrq.patch,814 bytes, patch)
2005-06-29 06:42 UTC, Federico Ferri (RETIRED)
Details | Diff
sysrq_scancode.patch (sysrq_scancode2.patch,1.39 KB, patch)
2005-07-09 16:30 UTC, Federico Ferri (RETIRED)
Details | Diff
This is the latest versione of my patch (sysrq_keycode_r5.patch,1.50 KB, patch)
2005-07-15 06:18 UTC, Federico Ferri (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Federico Ferri (RETIRED) gentoo-dev 2005-06-29 06:39:54 UTC
i am running 2.6.11-gentoo-r8.
since i'm using an usb keyboard (Apple Pro) i miss the magic sysrq key; so i
wanted to change it, by following instructions at
/usr/src/linux/Documentation/sysrq.txt

however, when i try to map F13 (or Alt-F13) to sysrq, with:
  setkeycodes 38b7 84
the program says:
  KDSETKEYCODE: No such device
  failed to set scancode 38b7 to keycode 84

here you can find a discussion between Linus Torvalds and Vojtech Pavlik
http://lkml.org/lkml/2005/1/12/174, with Vojtech reporting about the same
problem, and a patch to solve.

i really don't know if this solves... however i wanna hear someone more expert
than me ;) and if this is useful please include soon in the kernel tree

at this url you can grab directly the patch file:
http://marc.theaimsgroup.com/?l=linux-kernel&m=110430679525030&w=2

Reproducible: Always
Steps to Reproduce:
1.setkeycodes b7 84
2.KDSETKEYCODE: No such device
3.failed to set scancode b7 to keycode 84
Comment 1 Federico Ferri (RETIRED) gentoo-dev 2005-06-29 06:42:09 UTC
Created attachment 62231 [details, diff]
This is the patch file i was talking about

This is the patch file i was talking about
Comment 2 Federico Ferri (RETIRED) gentoo-dev 2005-06-29 12:43:23 UTC
that patch is already applied to linux-2.6.11-gentoo-r9.

PLEASE CAN SOMEONE TELL ME WHY I
CANNOT CHANGE SYSRQ SCANCODE ON USB_KEYBOARD?

MANY MANY THANKS
Comment 3 Daniel Drake (RETIRED) gentoo-dev 2005-06-30 03:59:27 UTC
Please add output of "emerge info" to every bug that you file like it says on
the bug submission form.
Comment 4 Federico Ferri (RETIRED) gentoo-dev 2005-06-30 08:56:38 UTC
`emerge info`:

Gentoo Base System version 1.6.12
Portage 2.0.51.19 (default-linux/x86/2005.0, gcc-3.3.5-20050130,
glibc-2.3.4.20041102-r1, 2.6.11-gentoo-r9 i686)
=================================================================
System uname: 2.6.11-gentoo-r9 i686 AMD Athlon(tm) XP 2800+
Python:              dev-lang/python-2.3.5 [2.3.5 (#1, May  5 2005, 07:35:49)]
ccache version 2.3 [enabled]
dev-lang/python:     2.3.5
sys-apps/sandbox:    [Not Present]
sys-devel/autoconf:  2.59-r6, 2.13
sys-devel/automake:  1.7.9-r1, 1.8.5-r3, 1.5, 1.4_p6, 1.6.3, 1.9.5
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.16
virtual/os-headers:  2.6.8.1-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -march=athlon-xp -fomit-frame-pointer -mno-sse"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env
/usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config
/var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=athlon-xp -fomit-frame-pointer -mno-sse"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://gentoo.ngi.it"
LANG="it_IT"
LC_ALL="it_IT"
LINGUAS="it"
MAKEOPTS="-j1"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 3dnow X aalib alsa apache2 apm avi bash-completion berkdb bitmap-fonts
bonobo cdr crypt cups curl divx4linux dvd dvdr eds emboss encode escreen esd fam
flac flash foomaticdb fortran ftp gd gdbm gif glitz gpm gtk gtk2 gtkhtml guile
imagemagick imlib innodb ipv6 jack java joystick jpeg junit ladcca ladspa ldap
libg++ libwww mad mikmod mmx mono motif mozdevelop mozilla mozsvg mp3 mpeg mysql
ncurses network nls nvidia ogg oggvorbis opengl oss pam pcre pdflib perl png
python qt quicktime readline real rtc samba sdk sdl slang spell sqlite ssl tcltk
tcpd tiff truetype truetype-fonts type1-fonts unicode usb userlocales vim-with-x
vorbis xine xml xml2 xmms xv xvid zlib zvbi linguas_it userland_GNU kernel_linux
elibc_glibc"
Unset:  ASFLAGS, CBUILD, CTARGET, LDFLAGS
Comment 5 Daniel Drake (RETIRED) gentoo-dev 2005-07-03 12:23:53 UTC
Can you reproduce this on vanilla-sources-2.6.13_rc1?
Comment 6 Federico Ferri (RETIRED) gentoo-dev 2005-07-04 14:00:55 UTC
yes, it happen the same thing
(and doesn't work framebuffer, nvidia video, alsa)

i saved the output of strace running setkeycodes on 2.6.13_rc1. here's some
relevant lines:

open("/dev/tty", O_RDWR)                = 3
ioctl(3, KDGKBTYPE, 0xbffdfcb7)         = 0
ioctl(3, KDSETKEYCODE, 0xbffdfd20)      = -1 ENODEV (No such device)
dup(2)                                  = 4
fcntl64(4, F_GETFL)                     = 0x8001 (flags O_WRONLY|O_LARGEFILE)
close(4)                                = 0
...
write(2, "KDSETKEYCODE: No such device\n", 29KDSETKEYCODE: No such device
) = 29
...
write(2, "failed to set scancode 64b7 to k"..., 42failed to set scancode 64b7 to
keycode 84
) = 42


i repeat: this is an USB keyboard. could this change some behavior? =|
Comment 7 Daniel Drake (RETIRED) gentoo-dev 2005-07-04 15:10:57 UTC
Odd.

Does /sys/class/tty/tty exist?

This command might help:

mknod /dev/tty c 5 0
Comment 8 Daniel Drake (RETIRED) gentoo-dev 2005-07-05 00:04:00 UTC
See upstream response:

"Sorry, you can't use 'setkeycodes' on USB keyboards. They don't use the
PS/2 protocol, and hence it doesn't make sense."
Comment 9 Federico Ferri (RETIRED) gentoo-dev 2005-07-09 16:30:43 UTC
Created attachment 63042 [details, diff]
sysrq_scancode.patch
Comment 10 Federico Ferri (RETIRED) gentoo-dev 2005-07-09 16:31:07 UTC
i released a patch for linux-kernel that allows you to change the default
KEY_SYSRQ scancode
Comment 11 Federico Ferri (RETIRED) gentoo-dev 2005-07-15 06:18:20 UTC
Created attachment 63466 [details, diff]
This is the latest versione of my patch

It is a one-line hack that adds one more question after "Magic Sysrq Key", and
allows you to specify a keycode other than 99 (KEY_SYSRQ).
Comment 12 Daniel Drake (RETIRED) gentoo-dev 2005-07-15 06:43:16 UTC
Please submit this properly (i.e. read Documentation/SubmittingPatches). We'll
include it once it gets accepted upstream.
Comment 13 Daniel Drake (RETIRED) gentoo-dev 2005-07-29 16:49:23 UTC
Please reopen this bug when your patch has been included in the upstream kernel,
and then we'll include it in gentoo-sources. Thanks.
Comment 14 Federico Ferri (RETIRED) gentoo-dev 2007-07-12 22:36:52 UTC
upstream mostly ignored my patch.

would you include that? (come on, it's SO simple)

otherwise: in the middle of which process I can hook it, in order to have it applied each time I emerge gentoo-sources kernel?
Comment 15 Daniel Drake (RETIRED) gentoo-dev 2007-07-12 23:10:27 UTC
No. Get it included upstream first.

I searched my LKML archives and I don't see any patch submissions from you.

Please re-read Documentation/SubmittingPatches.
Comment 16 Federico Ferri (RETIRED) gentoo-dev 2007-07-13 09:35:09 UTC
you didn't search well :)

http://lkml.org/lkml/2005/7/12/241

also I sent that patch privately to Linus.
still it got ignored.

actually I am not subscribed anymore to LKML. (but it'd be worth trying again to submit that patch?)
Comment 17 Daniel Drake (RETIRED) gentoo-dev 2007-07-13 12:26:57 UTC
Please stop reopening the bug until it is accepted into Linus' tree.

My archives do not go back that far. If you only submitted it once, 2 years ago, then it demonstrates that you haven't read SubmittingPatches which points out it's normal for you to have to resend your patch.
Comment 18 Federico Ferri (RETIRED) gentoo-dev 2007-07-18 17:53:04 UTC
this can be solved (for real) using the keyfuzz (bug #185788) on a recent (>=2.6.22_rc1) kernel. I'll wait for gentoo-sources-2.6.22 and report here wether it works
Comment 19 Daniel Drake (RETIRED) gentoo-dev 2007-07-18 18:59:44 UTC
gentoo-sources-2.6.22 is in portage.

I'm guessing, but it may be possible to use the setkeycodes command on this newer kernel. At least, I guess keyfuzz is just a wrapper around the same system call...
Comment 20 Federico Ferri (RETIRED) gentoo-dev 2007-07-18 19:15:03 UTC
KDSETKEYCODE works for PS/2 keyboards, and that's the old way. setkeycodes uses KDSETKEYCODE ioctl.

for changing keycode on USB keyboards, EVIOCSKEYCODE ioctl is needed, and keyfuzz implements it.
Comment 21 Federico Ferri (RETIRED) gentoo-dev 2007-07-19 23:35:16 UTC
OK, I can confirm ketfuzz solved my problem.

I've put commands like:

   echo "0x00070068 99" | keyfuzz -s -d/dev/input/event1

which remap F13 to KEY_SYSRQ.
I should now mark this bug as RESOLVED but... oh... eh %)