Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Jul 2009 22:49:43 +0200
From:      Polytropon <>
To:        FreeBSD Questions <>
Subject:   Num Lock key in X, PF keys, involves xmodmap, xev
Message-ID:  <>

Next in thread | Raw E-Mail | Index | Archive | Help
This is a multi-part message in MIME format.

Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Dear list,

since I moved to a new keyboard, I have some trouble. Everything except
the Num Lock functionality works fine. Let me explain:

The keyboard is a BOSCOM PS/2 keyboard (with 122 keys, intended for
5250 operations on a PC) that contains a keyboard controller, so the
keyboard can simply be attached to the PC.

THis is how the keyboard looks like:

It's a very nice one, so I want to use it instead of my Sun USB keyboard
because it has more and better keys. Think about the IBM model M. Same

The keyboard can operate in two different modes, which are selected by a
jumper inside the keyboard (where the LEDs are located).

In "jumper mode", keys operate like their caption (the key cap) indicates
it. For example, the keys on the left generate SysRq, Print, Escape and
so on. Some of them generate composed characters, this means when I press
a key, the keyboard sends a key combination, such as Alt+F3 for the
key or Shift+F1 for F13. Quite useless.

In "no jumper mode", each key sends a unique keycode. Some keys do not
do what their key cap says, but that's no problem because the caps can
be re-arranged. And I've got enough space keycaps with very nice
captions from other keyboards, so it's no problem to make my own
layout be represented correctly by the key caps.

This is the mode I need.

Using the xev program, I could easily find out which keys generate which
keycode, so I made a .xmodmaprc and assigned names to the different keys
according to what I intended them to use. For example, F13 .. F24 now are
described as F13 .. F24, so they can be assigned several actions by the
means of the window manager, i. e. WindowMaker - easy game, e. g. starting
programs or issuing a window arrangement command (front, background, roll
up, hide, lock screen and so on). On the numerical keypad, I have a comma
as well as a dot - in Germany, the comma is the decimal delimiter, so it's
not possible to type IPs on the numeric keypad only. But now, I can do
things like "," all within the numerical keypad.

Now my problem: I can't get the Num Lock to work. First of all, I checked
which keycode would be generated when I press the key I want to have as
Num Lock - it's the one placed where it should be on the standard 102
keys model, numerical keypad, upper left.

This is the xev output when the key is pressed:

	KeyPress event, serial 27, synthetic NO, window 0x1800001,
	    root 0x73, subw 0x0, time 1285024705, (76,91), root:(355,651),
	    state 0x0, keycode 9 (keysym 0xff7f, Num_Lock), same_screen YES,
	    XLookupString gives 0 bytes: 
	    XmbLookupString gives 0 bytes: 
	    XFilterEvent returns: False	

The keycode 9 (former Escape, I think) has been assigned to the
key symbol Num_Lock by this entry in .xmodmaprc (file attached,
I hope):

	! Num
	keycode 9 = Num_Loc

The comment, preceeded by "!", states what is on the key cap, to make
finding them easier.

The problem is: Pressing this key doesn't change the Num state. So I
checked "man xmodmap" and found out that there are modes that can be
changed by certain keys.

	% xmodmap
	xmodmap:  up to 3 keys per modifier, (keycodes in parentheses):
	shift       Shift_L (0x32),  Shift_R (0x3e)
	lock        Caps_Lock (0x42)
	control     Control_L (0x25),  Control_R (0x6d)
	mod1        Alt_L (0x40),  Meta_L (0x9c)
	mod2        Num_Lock (0x4d)
	mod4        Super_L (0x7f),  Hyper_L (0x80)
	mod5        Mode_switch (0x5d),  ISO_Level3_Shift (0x71),  ISO_Level3_Shift (0x7c)

This output states that Num_Lock toggles "mod2" - is this the Num mode?
I checked it through this command:

	% xmodmap -e "add mod2 = Num_Lock"

Ha! Pressing this key toggles Num now. Fine. No, not fine. Problem: The
keys on the left as well as the 2nd row of function keys does not work
anymore. If I switch off Num, they work again. Huh? I didn't have that
on the Sun keyboard, there using the keys on the left (which I assigned
F13 .. F27) always worked, no matter if Num was on or off.

However, xev tells me that the correct symbols are emitted when I press
the key, but the actions that have been assigned don't work anymore. So,
for example, F13 doesn't launch Opera anymore.

	KeyPress event, serial 27, synthetic NO, window 0x1800001,
	    root 0x73, subw 0x0, time 1285459063, (175,3), root:(362,537),
	    state 0x10, keycode 181 (keysym 0xffca, F13), same_screen YES,
	    XLookupString gives 0 bytes: 
	    XmbLookupString gives 0 bytes: 
	    XFilterEvent returns: False

But when I turn Num off and press F13, it works again. And as I said, I
didn't have such kind of behaviour with the Sun model. Basically, I'm
doing the same.

What am I doing wrong here? What am I missing? Ideas, anyone? =^_^=

PS. Follow-up question: What xmodmap is for X, that is WHAT for the
    console (text mode)? Would be nice to make the keyboard work
    properly at VTs, too.

>From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...Fr

Content-Type: text/plain;
Content-Disposition: attachment;
Content-Transfer-Encoding: base64



Want to link to this message? Use this URL: <>