Bug 9745 - Nokia N800, think outside stoaway sierra bluetooth keyboard and xkb configuration
Summary: Nokia N800, think outside stoaway sierra bluetooth keyboard and xkb configura...
Status: RESOLVED NOTABUG
Alias: None
Product: xkeyboard-config
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: xkb
QA Contact:
URL:
Whiteboard:
Keywords: NEEDINFO
Depends on:
Blocks:
 
Reported: 2007-01-23 12:49 UTC by Laurent GUERBY
Modified: 2008-12-18 10:36 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Type definition from Fabian (5.15 KB, text/plain)
2007-01-26 13:23 UTC, Laurent GUERBY
Details
xkb1.tar.gz: full tarball of my mod so far (165.43 KB, application/octet-stream)
2007-01-26 14:45 UTC, Laurent GUERBY
Details

Description Laurent GUERBY 2007-01-23 12:49:52 UTC
(Per Sergey Udaltsov request)

The Nokia N800 is a small Linux handlheld with an X server using xkb. I'm trying
to get the Fn key of my "Think Outside Stowaway Sierra Full Size Bluetooth
Keyboard" recognized as a modifier to do simple things like Fn+e outputing some
symbol of my choice.

I've looked at example and docs but I haven't found any way to do something as
simple as defining what the "e" key does with available modifiers:

Fn+e => send the x symbol
AltGr+e => send the y symbol
Cmd+e => send the z symbol

I have the key codes for Fn, AltGr and Cmd using xev.

Is that totally impossible with xkb?

Out of despair I hacked something to get AltGr+somekey to work. Sergey seems to
dislike it but none of the doc and tutorial I read explain how to do the simple
thing described above. Any URL?

Thanks in advance,

Laurent

$ diff -u compat/level5 compat/level5_save
--- compat/level5       2007-01-20 21:34:43.000000000 +0100
+++ compat/level5_save  2007-01-20 21:34:43.000000000 +0100
@@ -15,13 +15,13 @@
     latchMods.latchToLock= True;
 
     //ISO_Level5_Shift
-    interpret Hyper_L+Any {
+    interpret 0xfe11+Any {
        useModMapMods= level1;
        virtualModifier= LevelFive;
        action= SetMods(modifiers=LevelFive);
     };
 
-    interpret Hyper_L {
+    interpret 0xfe11 {
        action= SetMods(modifiers=LevelFive);
     };
 
guerby@pc1:~/tmp/n$ diff -u compat/level5_save compat/level5
--- compat/level5_save  2007-01-20 21:34:43.000000000 +0100
+++ compat/level5       2007-01-20 21:34:43.000000000 +0100
@@ -15,13 +15,13 @@
     latchMods.latchToLock= True;
 
     //ISO_Level5_Shift
-    interpret 0xfe11+Any {
+    interpret Hyper_L+Any {
        useModMapMods= level1;
        virtualModifier= LevelFive;
        action= SetMods(modifiers=LevelFive);
     };
 
-    interpret 0xfe11 {
+    interpret Hyper_L {
        action= SetMods(modifiers=LevelFive);
     };
 
$ diff -u symbols/level5_save symbols/level5
--- symbols/level5_save 2007-01-20 21:34:34.000000000 +0100
+++ symbols/level5      2007-01-20 21:34:34.000000000 +0100
@@ -12,7 +12,7 @@
 xkb_symbols "rctrl_switch" {
   key <RCTL> {
     type[Group1]="ONE_LEVEL",
-    symbols[Group1] = [ 0xfe11 ]
+    symbols[Group1] = [ Hyper_L ]
     };
-  modifier_map Mod3   { 0xfe11 };
+  modifier_map Mod3   { Hyper_L };
 };
$ diff -u symbols/gb_save symbols/gb
--- symbols/gb_save     2007-01-20 21:34:34.000000000 +0100
+++ symbols/gb  2007-01-20 21:34:33.000000000 +0100
@@ -16,17 +16,26 @@
 
     name[Group1]="United Kingdom";
 
-    key <AE02> { [         2,   quotedbl,  twosuperior,    oneeighth ] };
-    key <AE03> { [         3,   sterling, threesuperior,    sterling ] };
-    key <AE04> { [         4,     dollar,     EuroSign,   onequarter ] };
+    // key <AE02>      { [         2,   quotedbl,  twosuperior,    oneeighth ] };
+    // key <AE03>      { [         3,   sterling, threesuperior,    sterling ] };
+    // key <AE04>      { [         4,     dollar,     EuroSign,   onequarter ] };
+
+    // key <AC11>      { [apostrophe,         at, dead_circumflex, dead_caron] };
+    // key <TLDE>      { [     grave,    notsign,          bar,          bar ] };
+
+    // key <BKSL>      { [numbersign, asciitilde,   dead_grave,   dead_breve ] };
+    // key <LSGT>      { [ backslash,        bar,          bar,    brokenbar ] };
+
+    key <AD10> { [         p,          P,        sterling,        THORN ]      };
+    key <AD06> { [         y,          Y,    yen,          leftarrow ] };
+    key <AD03> { [         e,          E,     EuroSign,         cent, EuroSign
]       };
+    key  <TAB> {       [ Tab,  ISO_Left_Tab, Escape, Escape    ]       };
 
-    key <AC11> { [apostrophe,         at, dead_circumflex, dead_caron] };
-    key <TLDE> { [     grave,    notsign,          bar,          bar ] };
-
-    key <BKSL> { [numbersign, asciitilde,   dead_grave,   dead_breve ] };
-    key <LSGT> { [ backslash,        bar,          bar,    brokenbar ] };
+    key <MENU> {        [ Hyper_L                  ]       };
 
     include "level3(ralt_switch_multikey)"
+
+
 };
 
 partial alphanumeric_keys
$
Comment 1 Sergey V. Udaltsov 2007-01-24 02:08:29 UTC
> I've looked at example and docs but I haven't found any way to do something as
> simple as defining what the "e" key does with available modifiers:
> 
> Fn+e => send the x symbol
> AltGr+e => send the y symbol
> Cmd+e => send the z symbol
Well, usually it is done by using shift levels. AltGr+e is usually made by putting 'y' into the 3rd shift level - AltGr is a standard key for switching to the 3rd level. Regarding Fn and Cmd - I'm afraid you'll have to create special key type which would have different modifiers for different shift levels and assign Fn and Cmd to these modifiers.

> Is that totally impossible with xkb?
Possible, but a bit of trikery:)

> thing described above. Any URL?
There are some links on xkeyboard-config page:
http://www.freedesktop.org/wiki/Software_2fXKeyboardConfig

And, my objections are still there - please do not hardcode Hyper_L and please create separate gb variant instead of changhing the existing one.
Comment 2 Fabian Hombsch 2007-01-24 05:53:28 UTC
Try the following:
open your keyboard definition (mine is "/usr/share/X11/xkb/symbols/de" (german), "us" at the end should be english etc.)
add to the variant you are using the line:

include "level3(Fn_switch)"

You have put this line in before the closing brace of the block, e.g.

default xkb_symbols "basic" {
   [some indented text...]
include "level3(Fn_switch)"
};

Then you have to define what you just included.
open "/usr/share/X11/xkb/symbols/level3" and add the following block of code to the end of it:

partial modifier_keys
xkb_symbols "Fn_switch" {
  key <FN> {
    type[Group1]="ONE_LEVEL",
    symbols[Group1] = [ ISO_Level3_Shift ]
    };
  modifier_map Mod5   { ISO_Level3_Shift };
};

Then there are files in the folder /usr/share/X11/xkb/keycodes that describe which scancode obtained by some xev command you already have run is called how.
Ask someone else what file is used for your keyboard and write "<FN> =" , followed by your xev result. Maybe you can even write this in your  "/usr/share/X11/xkb/symbols/[yourkeyboard]" file in order to avoid having to find out which file to pick. Someone else should know more about this. Greetings, Fabian.
Comment 3 Laurent GUERBY 2007-01-25 12:26:34 UTC
Fabian, thanks for this snippet!

Ok for level3 and keycodes (and reverting my mess :), but I'm missing the last part, assuming I have defined <FN>, how (and where to follow the guidelines) do I define the "e" key to do

AltGr + e => x
Fn + e => y

Also, how do I add a <CMD> so that I can also define CMD + e => z ?

Thanks again!

Laurent
Comment 4 Fabian Hombsch 2007-01-26 07:45:13 UTC
Sorry Laurent,
I didn`t realize you wanted to have
AltGr, Fn and Cmd at the same time.
The snippet I explained actually makes Fn behave like AltGr.
Since this is not what you want, you will have to work with level5.
I suppose your <FN> key is the <MENU> key.
Put the following into your "symbols/uk" file:

    modifier_map Control{ Control_L };
    include "level3(ralt_switch)" 
    include "level5(rctrl_switch)"

(The ralt_switch_multikey variant works as well.)
The first line frees the right Control key from the Control function.
The last line should activate its level5 function as an additional modifier.
The symbols/level5 file should be like this:

partial modifier_keys
xkb_symbols "rctrl_switch" {
  key <RCTL> {
    type[Group1]="ONE_LEVEL",
    symbols[Group1] = [ 0xfe11 ]
    };
  modifier_map Mod3   { 0xfe11 };
};

You cannot put Hyper_L in here since this is on the <MENU> key and the menu key will become another modifier again.
The same applies to the compat/level5 file.
You don`t have to do anything with Hyper_L since this is already defined and mapped to Mod4 in the symbols/pc file.
It is sufficient to put it on the <MENU> key.
In order to use all these modifiers, you need a new type definition. I can attach mine, it should work since your modifiers would be similar to my ones. Put this file in the types/ directory and call it e.g. AltGr_Cmd_Menu.
Then open types/complete and add the following line:
    include "AltGr_rCtrl_Win"
(It activates the new type definition)
open /usr/share/X11/xkb/types.dir and add the following line:
-------- -------- AltGr_Cmd_Menu(default)

I don`t know what the hyphens are good for but it works like this.
with my types file included you have some type definition that can be used on a key.
write the following in your symbols/gb file:
    key.type[Group1]="L16_ALPHABETIC"; 
//the following keys can react on rCtrl, AltGr and Menu
//Modifiers:None,Shift,AltGr,Shift+AltGr,rCtrl,Shift+rCtrl,Menu, Shift+Menu
key<AD03>{[e,E,ediaeresis,Ediaeresis, EuroSign,U2203      ,U2208,U220B ]};
    key....
    key.type[Group1]="FOUR_LEVEL_ALPHABETIC"; 
//you may need this to switch back to ordinary 4 entry-types.
// I don`t need it in my keyboard.

The list in brackets starting with e,E has up to sixteen elements now. You can omit the last ones.
The comment sais which modifiers you will have to press in order to produce the symbol you wrote in the bracketed list.
You can also try the "L16" variant and the "L16_SEMIALPHABETIC" one. They only differ if you are using CapsLock.
The "L16_ALPHABETIC" variant assumes that E and Ediaeresis are captial forms of e and ediaeresis.
"L16_ALPHABETIC" assumes only E is captial form of e and "L16" doesn`t listen to the CapsLock modifier and never capitalizes anything. Write back if your <FN> key is not the <MENU> key.
Greetings, Fabian.
Comment 5 Fabian Hombsch 2007-01-26 08:34:25 UTC
I failed to submit the types definition at freedesktop.org and sent an email.
I hope it arrived.
Comment 6 Laurent GUERBY 2007-01-26 13:23:46 UTC
Created attachment 8509 [details]
Type definition from Fabian

Fabian thanks!

Here is what I got in email (AltGr_rCtrl_Win.txt)
Comment 7 Sergey V. Udaltsov 2007-01-26 14:33:23 UTC
Laurent, so - do these type work for you?
Comment 8 Laurent GUERBY 2007-01-26 14:42:58 UTC
I reverted all my changes and tried to follow Fabian instructions.

For reference purpose, I have with xev:

AltGr key: keycode 113 (keysym 0xfe03, ISO_Level3_Shift)
CMD key: keycode 115 (keysym 0xffeb, Super_L) 
FN key:  keycode 117 (keysym 0xff67, Menu)

Output of "setxkbmap -v 10":

Setting verbose level to 10
locale is C
Applied rules from base:
model:      pc105
layout:     gb
Trying to build keymap using the following components:
keycodes:   xfree86+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+gb
geometry:   pc(pc105)

To symbols/gb I added:

    key.type[Group1]="L16_ALPHABETIC"; 
    key<AD03>{[e,E,a,A, b,B ,c,C,d,D ]};
    key.type[Group1]="FOUR_LEVEL_ALPHABETIC"; 

I had to comment a line out symbols/pc (otherwise <MENU> raises a menu on the N800)
//    key <MENU> {      [ Menu                  ]       };

With "AltGr+e" I get "a" as expected, but "Fn+e" and "CMD+e" both get "e"n so no luck.

I'm attaching the full tarball of the xkb/ files I have so far, may be someone will see something I did not spot.

Life is really complicated... :)
Comment 9 Laurent GUERBY 2007-01-26 14:45:54 UTC
Created attachment 8511 [details]
xkb1.tar.gz: full tarball of my mod so far

Original files from Nokia (cleared as MIT copyright on maemo-developers list) have an _save suffix so diff xxx_save xxx will show my changes.
Comment 10 Fabian Hombsch 2007-01-26 15:51:03 UTC
1. You should get A with Shift+AltGr+e or,
when CapsLock is active, with AltGr+e
2. I got your modifier keys wrong. 
I thought you wanted to make the right Control key a modifier instead of the menu key.
Sergey Udaltsov will thank you for not altering the pc layout.
Changes can be done in the other files which will overwrite internally the keys that are already defined in pc.
You seem to have deactivated the <MENU> key completely.
put the following block of code at the end of symbols/level5:

partial modifier_keys
xkb_symbols "menu_switch" {
  key <MENU> {
    type[Group1]="ONE_LEVEL",
    symbols[Group1] = [ 0xfe11 ]
    };
  modifier_map Mod3   { 0xfe11 };
};

delete the following two lines out of symbols/gb:

    modifier_map Control{ Control_L };
    include "level3(ralt_switch_multikey)" 

(the first deactivates the right Control key and the second one is doubled)
Alter the following line:
-    include "level5(rctrl_switch)"
+    include "level5(menu_switch)"

Then I seem to have confused you with the name of my file.
You did not rename it but wrote some renamed file in usr/share/X11/xkb/types.dir.
The name in the last line has to be the filename, i.e. AltGr_rCtrl_Win.
Greetings, Fabian.
Comment 11 Sergey V. Udaltsov 2008-12-18 08:53:45 UTC
Laurent, did you follow Fabian's instructions? Would you have a final patch for me?
Comment 12 Laurent GUERBY 2008-12-18 09:41:12 UTC
I finally decided xbd was way too hard to configure even for the simplest things, may be Nokia has done some things since this report but I really don't know, sorry about that.

Feel free to close this report.
Comment 13 Sergey V. Udaltsov 2008-12-18 10:36:26 UTC
ok


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.