You are not logged in.

#1 2012-01-11 00:47:08

lyoshab
Member
Registered: 2012-01-11
Posts: 6

Layout for an unusual keyboard [ThinkPad E125; SOLVED]

I have a Lenovo ThinkPad E125 laptop and it has an unusual keyboard: its "Fn" key has keycode 29 and works as "Ctrl" in the default layout, while "Ctrl" has keycode 143.

I tried to edit /usr/share/kbd/keymaps/i386/qwerty/us.map.gz and add the following lines:

keycode  29 =
keycode 133 = Compose
keycode 143 = Control

However, it doesn't work for me. (N.B. I've never worked with layouts before.)

What is the right way to change the situation?

Update: it has nothing to do with the operating system. Ctrl and Fn can be switched via BIOS setup.

Last edited by lyoshab (2012-01-19 09:20:55)

Offline

#2 2012-01-11 06:40:16

JackH79
Member
From: Australia
Registered: 2009-06-18
Posts: 663
Website

Re: Layout for an unusual keyboard [ThinkPad E125; SOLVED]

Have a look at xmodmap. With this you can remap keys.

Offline

#3 2012-01-11 12:50:09

lyoshab
Member
Registered: 2012-01-11
Posts: 6

Re: Layout for an unusual keyboard [ThinkPad E125; SOLVED]

JackH79 wrote:

Have a look at xmodmap. With this you can remap keys.

xmodmap is for X. I need a solution that doesn't involve X, or an explanation why it is not possible.

Also, xev gives keycode 151 for the left "Ctrl" key. Putting

keycode  151 = Control_L NoSymbol Control_L

doesn't work for me. Here's what xev says after that change:

KeyRelease event, serial 34, synthetic NO, window 0x1800001,
    root 0x14e, subw 0x0, time 4861486, (129,103), root:(723,422),
    state 0x4, keycode 151 (keysym 0xffe3, Control_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

But Left Ctrl + C gives

KeyPress event, serial 34, synthetic NO, window 0x1800001,
    root 0x14e, subw 0x0, time 2976950, (138,134), root:(372,451),
    state 0x0, keycode 78 (keysym 0xff14, Scroll_Lock), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

Left Ctrl + X doesn't work in Emacs, etc.

So I don't think I know how to fix this via xmodmap either.

Last edited by lyoshab (2012-01-11 13:42:46)

Offline

#4 2012-01-11 15:10:33

lyoshab
Member
Registered: 2012-01-11
Posts: 6

Re: Layout for an unusual keyboard [ThinkPad E125; SOLVED]

lyoshab wrote:

I have a Lenovo ThinkPad E125 laptop and it has an unusual keyboard: its "Fn" key has keycode 29 and works as "Ctrl" in the default layout, while "Ctrl" has keycode 143.

I tried to edit /usr/share/kbd/keymaps/i386/qwerty/us.map.gz and add the following lines:

keycode  29 =
keycode 133 = Compose
keycode 143 = Control

However, it doesn't work for me. (N.B. I've never worked with layouts before.)

What is the right way to change the situation?

Whoops. I guess I don't understand how things work. Putting something like "keycode 143 = one" in us.map has the expected effect (the "Ctrl" key generates "1"). Putting something like "keycode 58 = Control" also works (assigning Control for "CapsLock" key). But "keycode 143 = Control" fails.

Last edited by lyoshab (2012-01-11 15:11:00)

Offline

#5 2012-01-12 06:30:13

JackH79
Member
From: Australia
Registered: 2009-06-18
Posts: 663
Website

Re: Layout for an unusual keyboard [ThinkPad E125; SOLVED]

Ah, sorry for the confusion. Have you looked at loadkeys? Also have a look at this forum thread maybe.

EDIT: wrong url

Last edited by JackH79 (2012-01-12 06:31:44)

Offline

#6 2012-01-13 04:36:58

lyoshab
Member
Registered: 2012-01-11
Posts: 6

Re: Layout for an unusual keyboard [ThinkPad E125; SOLVED]

JackH79 wrote:

Ah, sorry for the confusion. Have you looked at loadkeys? Also have a look at this forum thread maybe.

Well, the initial post actually refers to loadkeys. I am trying to make my keymap based on the default version of /usr/share/kbd/keymaps/i386/qwerty/us.map

But here is the problem: the key that marked as "Ctrl" on my laptop generates a weird keycode 143. For some reason, I can assign characters to it, but not Control. I tried to assign Control to other keycodes like 58 or 44 and it works. So my guess is that "large" codes as 143 are treated in some specific way.

Last edited by lyoshab (2012-01-13 04:39:44)

Offline

#7 2012-01-13 05:35:00

JackH79
Member
From: Australia
Registered: 2009-06-18
Posts: 663
Website

Re: Layout for an unusual keyboard [ThinkPad E125; SOLVED]

Sorry, should've read more carefully. Probably a stupid question, but have you run

# locale-gen

after your changes?

Offline

#8 2012-01-13 15:49:49

lyoshab
Member
Registered: 2012-01-11
Posts: 6

Re: Layout for an unusual keyboard [ThinkPad E125; SOLVED]

JackH79 wrote:

Sorry, should've read more carefully. Probably a stupid question, but have you run

# locale-gen

after your changes?

Doesn't help. (Has it something to do with /usr/share/kbd/keymaps?) My locale is just en_US.UTF-8.

Last edited by lyoshab (2012-01-13 15:51:11)

Offline

#9 2012-01-16 19:52:01

MihaiB
Member
Registered: 2012-01-16
Posts: 1

Re: Layout for an unusual keyboard [ThinkPad E125; SOLVED]

Did you check your BIOS settings, there is an option for switching Fn and Ctrl, it might be activated and confusing linux.

Offline

#10 2012-01-19 09:18:56

lyoshab
Member
Registered: 2012-01-11
Posts: 6

Re: Layout for an unusual keyboard [ThinkPad E125; SOLVED]

MihaiB wrote:

Did you check your BIOS settings, there is an option for switching Fn and Ctrl, it might be activated and confusing linux.

\o/ Thank you very much! So it has nothing to do with the operating system.

Offline

Board footer

Powered by FluxBB