Keycode Assignments for use by xmodmap

Keycode Assignments for use by xmodmap

Post by Markus Vo » Sat, 23 Jan 1993 10:46:56

|> Hello,
|> I have problems in setting up the Sun Type5 keyboard attached to a
|> SPARCstation 10 correctly.
|> On the console screen (right after the login process) I can use
|> the grey cursor keys, but when I start XWindows, XWindows seems
|> to change the keycode assignments.  These keycodes differ from the
|> codes I found in the 'Sun Type5 Keyboard Product Notes', which
|> came along with the SPARCstation 10 package.
|> I won't be able to use the grey cursor keys unless I modify the keymap
|> using 'xmodmap'.  The file I feed to xmodmap contains the following lines:
|>   keycode 27 = Up
|>   keycode 31 = Left
|>   keycode 34 = Down
|>   keycode 35 = Right
|> Is there a way to have a global keycode assignment instead of having
|> each user include the xmodmap command with his '.xinitrc' file?
|> Or could I prevent XWindows from changing keycode assignments?
|> I would appreciate any help,
|> Markus

Hello everybody,

I received several hints how to solve the above problem
and I just want to post summary:

First of all:
The Xsun (Xwindow server) won't recognize that you're using a type5
keyboard unless you apply a certain patch to the server and rebuild it.
The name of the patch package is 'sunkbd.921216.tar.Z'.  It's
available from under /contrib, e.g.

If you don't want to rebuild your Xserver, you could use 'xmodmap' to
modify the current keyboard assignments.  

What I did:
Since we're gonna upgrade to X11R5 within the next few weeks anyway, I
didn't want to get the X11R4 resources again to rebuild the X11R4 xserver.

So I edited my global resource file for the Xwindow initialization
process (in my case the file '/vol/local/etc/startup/xinitrc') and
inserted the following lines:

   if [ `arch -k` = "sun4m" ]; then
      xmodmap /vol/local/etc/startup/SS10xmodmap

This would change the keyboard assignments only if you're currently
using a sun4m kernel architecture, that is SPARCstation 10.  
I included this check, because we have also machines with different
kernel architecures which do *not* use a type5 keyboard and
therefore do *not* need this modification.

The file 'SS10xmodmap' contains my changes in xmodmap syntax as
described in the xmodmap manual or by 'xmodmap -grammar'.

Finally I had to make sure that each user had the following line
in his $HOME/.xinitrc file:

   . /vol/local/etc/startup/xinitrc

This guarantees, that all users get my changes.  At least
for a while... ;)

The Xserver does *not* use the same keycodes as shown in the
'Sun Type5 Keyboard Product Notes', but adds an offset of 7 to
each keycode!
The <space-bar>, for instance, usually has code 121, but the
Xserver uses code 128.
So, don't forget to add the offset! :-)

That's it -

Thanks again everyone who posted a followup or replied directly,


------------- Markus Vogt ---------------- University of Bielefeld ------
         System Administration             Room No.    C6-141