<p>Hi.<br></p><p>I need to understand how the evdev thing works.</p><p><b><font size="4">Background</font></b></p><p>A while ago, I think I had Ubuntu 7.10 or 8.04, I made my own keyboard layout. The point with it is that I easily can reach all my favourite character directly from the keyboard by using the AltGr key (I guess that's the same as the right Alt key on those keyboards with no AltGr key…). So now every key (almost) has four different characters, and I even can type with the Enter key and the arrow keys, and they still work as the Enter and arrow keys respectively, for example AltGr+Enter=↵, AltGr+Shift+Right arrow=⇨ and so on. Another point is that I don't have the same characters on more than one key (well, I have, but when I find yet another character I need, it will end up on one of those doublets), so I have no longer 0-9 above the qwerty row; they are all on the numerical key pad only.</p>

<p>This all worked perfectly before upgrading to 8.10 and one of the differences compared to 8.04 is that 8.10 seems to use evdev, whatever that is. The difference that I can see, is that I now need to manipulate files that are called <font face="courier new,monospace"><strong>evdev.lst</strong></font> and <font face="courier new,monospace"><strong>evdev.xml</strong></font> instead of the old <strong><font face="courier new,monospace">base.lst</font></strong> and <font face="courier new,monospace"><strong>base.xml</strong></font>. The old files are still there, but Ubuntu 8.10 doesn't seem to use them.</p>

<p><b><font size="4">How I made my own layout</font></b></p><p>First I considered my own layout as another language, which I thought would make things easier when adding new characters, so I made a file called "<strong><font face="courier new,monospace">se-Johnny</font></strong>" with all the info needed, and I put a link to i in <strong><font face="courier new,monospace">/usr/share/X11/xkb/symbols/</font></strong>. Then I needed to add some lines in <strong><font face="courier new,monospace">/usr/share/X11/xkb/rules/base.xml</font></strong> and one line in <strong><font face="courier new,monospace">/usr/share/X11/xkb/rules/base.lst</font></strong>. That was it and it worked perfectly. After upgrade to 8.10 it didn't work anymore, and I studied all the files and finally found how to change them to make it work, among other thins I needed to use the evdev files rather than the base files, but it still had some disadvantages, so I changed the concept. Now I include my own layout as a variant of the Swedish layout, simply called "<font face="courier new,monospace"><strong>Sweden – Johnny Rosenberg</strong></font>". I put it at the end of <strong><font face="courier new,monospace">/usr/share/X11/xkb/symbols/se</font></strong> and I changed <strong><font face="courier new,monospace">/usr/share/X11/xkb/rules/evdev.lst</font></strong> (a few rows) and <strong><font face="courier new,monospace">/usr/share/X11/xkb/rules/evdev.xml</font></strong>. </p>

<p><font size="4"><b>Problem</b></font></p><p><font size="2">I can now select my layout and it works perfectly. All the characters are available where I expect them. The problem is that every now and then, sometimes after several hours and sometimes after a few seconds, the system switch back to the standard Swedish layout. I can see when this happens, because right before it happens (often when I type something), the system doesn't seem to react to one of the key strokes. I then hit the same key again and it seems to work, but when I try to use my own characters, they are not there anymore.</font></p>

<p><font size="2">Then I open the layout dialogue (in <font face="courier new,monospace"><strong>gnome-keyboard-properties → layouts</strong></font>) and add a new layout, doesn't matter which, then I select my own (Sweden Johnny Rosenberg) in the list. Then I remove the layout I just added, whichever that was. Now it works again, until the same thing happens again after a while. Can be a couple of hours or maybe only a couple of seconds.</font></p>

<p><font size="2">I have looked in /var/logs/ but I am not sure what to look for, and I found nothing so far.</font></p><p><font size="4"><b>Solution?</b></font></p><p><font size="2">What I need now, I think, is to understand how evdev works. It seems like some error happens and that the system switch back to something "safe", just in case. I don't know if my layout is the problem or if the problem is located somewhere else. Sometimes when strange things happens the problem is Compiz-Fusion. Maybe in my case too, I don't know. I use it when I switch desktop and applications, but hardly ever for anything else.</font></p>

<p><font size="2">I just need to understand better how evdev works, which files the system use and things like that. How to proceed with debugging etc.</font></p><p><font size="2">I was also thinking of an ugly solution: When I type <font face="courier new,monospace"><strong>xprop -root | grep -i xkb</strong></font>, I get the following information:</font></p>
<p><font face="courier new,monospace"><strong><font size="2">_XKB_RULES_NAMES_BACKUP(STRING) = "evdev", "pc105", "se", "", ""<br>_XKB_RULES_NAMES(STRING) = "evdev", "pc105", "se", "johnny", "grp:alts_toggle,lv3:ralt_switch,compose:caps,altwin:left_meta_win"</font></strong></font><font size="2"><br>
</font></p><p><font size="2">Is there a way that I can make the </font><font size="2"><strong><font face="courier new,monospace">_XKB_RULES_NAMES_BACKUP(STRING)</font></strong> the same as </font><font size="2"><strong><font face="courier new,monospace">_XKB_RULES_NAMES(STRING)</font></strong>? Because it seems to me that what happens is that when some kind of fault occurs, the keyboard layout is switched to whatever </font><font size="2"><strong><font face="courier new,monospace">_XKB_RULES_NAMES_BACKUP(STRING)</font></strong> says. So if I could setboth of them to </font><font size="2"> <font face="courier new,monospace"><strong>"evdev", "pc105", "se", "johnny", "grp:alts_toggle,lv3:ralt_switch,compose:caps,altwin:left_meta_win"</strong></font>, I could just ignore what ever happened… Or maybe that's the dangerous way…?</font></p>
<p><font size="2"></font></p><p><font size="2">Best regards<br></font></p><p><font size="2">Johnny Rosenberg</font></p>