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

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

--Multipart=_Sun__5_Jul_2009_22_49_43_+0200_piAMCw8ddSRVGOO9
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:

	http://www.ioconnections.com/images/products/bos_5250keyboard_black.jpg

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
mechanics.

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 "192.168.1.1,192.168.1.2" 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)
	mod3      
	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.


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

--Multipart=_Sun__5_Jul_2009_22_49_43_+0200_piAMCw8ddSRVGOO9
Content-Type: text/plain;
 name=".xmodmaprc"
Content-Disposition: attachment;
 filename=".xmodmaprc"
Content-Transfer-Encoding: base64

ISBFU0MgLyBEZWZGDQprZXljb2RlIDEzNCA9IEVzY2FwZQ0KDQohIEEtQWJmIC8gQWJydWYNCmtl
eWNvZGUgMjEwID0gRjI1DQoNCiEgUHNBdXMNCmtleWNvZGUgMjE5ID0gRjI2DQoNCiEgTGluaWUg
LyBQb3MxDQprZXljb2RlIDExMSA9IEYyNw0KDQohIFBhdXNlIC8gRS1M9g0Ka2V5Y29kZSAyMjAg
PSBGMjgNCg0KISBiU0RlZiAvIERyRGVmDQprZXljb2RlIDIyMSA9IEYyOQ0KDQohIEVpbmcgTPZz
Y2gNCmtleWNvZGUgMTEwID0gRjMwDQoNCiEgQmVkLWhpbGZlIC8gSGV4DQprZXljb2RlIDIwNSA9
IEYzMQ0KDQohIEF1ZnogTW9kZSAvIFBhdXNlDQprZXljb2RlIDIwNyA9IEYzMg0KDQohIFdpZWRn
YWJlIC8gVGVzdA0Ka2V5Y29kZSAyMDQgPSBGMzMNCg0KISBeYQ0Ka2V5Y29kZSAxNzAgPSBJbnNl
cnQNCg0KISBJPC0gLyBab29tDQprZXljb2RlIDk5ID0gSG9tZQ0KDQohIEJpbGQgXg0Ka2V5Y29k
ZSAxMDUgPSBQcmlvcg0KDQohIGGwIC8gYWFhsA0Ka2V5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g0KISBWZXJzIC8gS29wDQprZXljb2RlIDIwMCA9
IEYyMg0KDQohIEhvbGVuDQprZXljb2RlIDIwMSA9IEYyMw0KDQohIFp1DQprZXljb2RlIDIwMyA9
IEYyNA0KDQoNCg==

--Multipart=_Sun__5_Jul_2009_22_49_43_+0200_piAMCw8ddSRVGOO9--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090705224943.693740a6.freebsd>