FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 12-21-2008, 10:12 AM
"Johnny Rosenberg"
 
Default Ubuntu 8.10 – evdev

Hi.


I need to understand how the evdev thing works.

Background

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.



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 evdev.lst and evdev.xml instead of the old base.lst and base.xml. The old files are still there, but Ubuntu 8.10 doesn't seem to use them.



How I made my own layout

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 "se-Johnny" with all the info needed, and I put a link to i in /usr/share/X11/xkb/symbols/. Then I needed to add some lines in /usr/share/X11/xkb/rules/base.xml and one line in /usr/share/X11/xkb/rules/base.lst. 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 "Sweden – Johnny Rosenberg". I put it at the end of /usr/share/X11/xkb/symbols/se and I changed /usr/share/X11/xkb/rules/evdev.lst (a few rows) and /usr/share/X11/xkb/rules/evdev.xml.*



Problem

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.



Then I open the layout dialogue (in gnome-keyboard-properties → layouts) 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.



I have looked in /var/logs/ but I am not sure what to look for, and I found nothing so far.

Solution?

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.



I just need to understand better how evdev works, which files the system use and things like that. How to proceed with debugging etc.

I was also thinking of an ugly solution: When I type xprop -root | grep -i xkb, I get the following information:


_XKB_RULES_NAMES_BACKUP(STRING) = "evdev", "pc105", "se", "", ""
_XKB_RULES_NAMES(STRING) = "evdev", "pc105", "se", "johnny", "grp:alts_toggle,lv3:ralt_switch,compose:caps,altw in:left_meta_win"



Is there a way that I can make the*_XKB_RULES_NAMES_BACKUP(STRING) the same as*_XKB_RULES_NAMES(STRING)? Because it seems to me that what happens is that when some kind of fault occurs, the keyboard layout is switched to whatever _XKB_RULES_NAMES_BACKUP(STRING) says. So if I could setboth of them to* "evdev", "pc105", "se", "johnny", "grp:alts_toggle,lv3:ralt_switch,compose:caps,altw in:left_meta_win", I could just ignore what ever happened… Or maybe that's the dangerous way…?




Best regards


Johnny Rosenberg


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 12-22-2008, 11:43 AM
Marius Gedminas
 
Default Ubuntu 8.10 – evdev

On Sun, Dec 21, 2008 at 12:12:49PM +0100, Johnny Rosenberg wrote:
> I need to understand how the evdev thing works.

Previously, X would use the 'kbd' driver by reading from the /dev/ttyN
representing the virtual console and converting scan codes to keysyms
with XKB.

Now X uses the 'evdev' driver to read a different set of keycodes from
/dev/input/eventX devices and converts those to keysyms with XKB using a
slightly different rules file.

One important difference was that while kbd dealt with a single scan
code stream, evdev can see every keyboard (and mouse) as a separate
input device, and thus can set different properties (such as the
keyboard layout) on them.

X relies on HAL for device hotplugging. Whenever the kernel detects a
new device, it sends a notification to userspace, where HAL gets it,
sees that this is a keyboard device, and hands it off to X.org.

I learned all this by reading mailing list and blog posts by X.org
developers. Any inaccuracies are a fault of my memory.

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

It seems that for some reason your keyboard falls out of the world for a
microsecond or so, causing the system to think you've unplugged it and
plugged it back.

Currently there's no mechanism for remembering keyboard settings when it
gets unplugged and plugged back in, so the default settings are applied.
The default settings are assigned by HAL instead of the old xorg.conf,
for various reasons. There's probably a .fdi file somewhere in /etc/hal
on your system saying the default keyboard layout is Swedish.

... Unless there isn't one, in which case I'm totally wrong in my guess.

> Then I open the layout dialogue (in *gnome-keyboard-properties → layouts*)
> 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.
>
> I have looked in /var/logs/ but I am not sure what to look for, and I found
> nothing so far.

/var/log/Xorg.0.log is the place to look. When a keyboard gets
detected, you see something like

(II) config/hal: Adding input device AT Translated Set 2 keyboard
(**) AT Translated Set 2 keyboard: always reports core events
(**) AT Translated Set 2 keyboard: Device: "/dev/input/event1"
(II) AT Translated Set 2 keyboard: Found keys
(II) AT Translated Set 2 keyboard: Configuring as keyboard
(II) XINPUT: Adding extended input device "AT Translated Set 2 keyboard" (type: KEYBOARD)
(**) Option "xkb_rules" "evdev"
(**) AT Translated Set 2 keyboard: xkb_rules: "evdev"
(**) Option "xkb_model" "pc105"
(**) AT Translated Set 2 keyboard: xkb_model: "pc105"
(**) Option "xkb_layout" "us"
(**) AT Translated Set 2 keyboard: xkb_layout: "us"

If you see the same thing again every time the keyboard layout resets to
default, that would mean I was right in my guess.

> *Solution?*
>
> 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.
>
> I just need to understand better how evdev works, which files the system use
> and things like that. How to proceed with debugging etc.
>
> I was also thinking of an ugly solution: When I type *xprop -root | grep -i
> xkb*, I get the following information:
>
> *_XKB_RULES_NAMES_BACKUP(STRING) = "evdev", "pc105", "se", "", ""
> _XKB_RULES_NAMES(STRING) = "evdev", "pc105", "se", "johnny",
> "grp:alts_toggle,lv3:ralt_switch,compose:caps,altw in:left_meta_win"*
>
> Is there a way that I can make the *_XKB_RULES_NAMES_BACKUP(STRING)* the
> same as *_XKB_RULES_NAMES(STRING)*? Because it seems to me that what happens
> is that when some kind of fault occurs, the keyboard layout is switched to
> whatever *_XKB_RULES_NAMES_BACKUP(STRING)* says.

I've no idea were _XKB_RULES_NAMES_BACKUP comes from, or what uses it.

setxkbmap is the one that both sets and uses _XKB_RULES_NAMES to
remember the current setting. AFAIU GNOME uses setxkbmap behind the
scenes to manipulate the keyboard layout.

> So if I could setboth of
> them to *"evdev", "pc105", "se", "johnny",
> "grp:alts_toggle,lv3:ralt_switch,compose:caps,altw in:left_meta_win"*, I
> could just ignore what ever happened…

Maybe

> Or maybe that's the dangerous way…?

I don't see how.

The worst thing that can happen if you play with XKB too much is you'll
end up with a broken layout that doesn't let you type anything or do any
stuff like switch to a text terminal with Ctrl+Alt+F1. You can always
recover by copying and pasting 'setxkbmap us' letter-by-letter into a
terminal, or ssh'ing in and killing the X server to restart it.

Marius Gedminas
--
Si hoc legere scis nimium eruditionis habes.
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 12-22-2008, 01:44 PM
"Johnny Rosenberg"
 
Default Ubuntu 8.10 – evdev

Thank you for your reply. Yes, you are probably right. I use a wireless keyboard and mouse and now, when I read your reply, I unplugged it and plugged it right back, and this made it go back to the standard Swedish layout, exactly as you said.


That indicates that maybe there isn't a serious fault happening, just my keyboard losing its connection.


The question is now: What's causing this? Ubuntu, my keyboard or other hardware? Hard to tell right now, though.


However, it I can make my own layout to be the standard layout in ANY situation, my problem is probably solved. I'll cehck out the /etc/hal and other possible clues and I'll see where to go from there.




Thanks!

Johnny Rosenberg

2008/12/22 Marius Gedminas <marius@pov.lt>

On Sun, Dec 21, 2008 at 12:12:49PM +0100, Johnny Rosenberg wrote:

> I need to understand how the evdev thing works.



Previously, X would use the 'kbd' driver by reading from the /dev/ttyN

representing the virtual console and converting scan codes to keysyms

with XKB.



Now X uses the 'evdev' driver to read a different set of keycodes from

/dev/input/eventX devices and converts those to keysyms with XKB using a

slightly different rules file.



One important difference was that while kbd dealt with a single scan

code stream, evdev can see every keyboard (and mouse) as a separate

input device, and thus can set different properties (such as the

keyboard layout) on them.



X relies on HAL for device hotplugging. *Whenever the kernel detects a

new device, it sends a notification to userspace, where HAL gets it,

sees that this is a keyboard device, and hands it off to X.org.



I learned all this by reading mailing list and blog posts by X.org

developers. *Any inaccuracies are a fault of my memory.



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



It seems that for some reason your keyboard falls out of the world for a

microsecond or so, causing the system to think you've unplugged it and

plugged it back.



Currently there's no mechanism for remembering keyboard settings when it

gets unplugged and plugged back in, so the default settings are applied.

The default settings are assigned by HAL instead of the old xorg.conf,

for various reasons. *There's probably a .fdi file somewhere in /etc/hal

on your system saying the default keyboard layout is Swedish.*Well, my own layout is also Swedish (with a lot of enhancements if you ask me…), but I understand what you mean.




... Unless there isn't one, in which case I'm totally wrong in my guess.



> Then I open the layout dialogue (in *gnome-keyboard-properties → layouts*)Ooops, seems like something between our email servers doesn't support UTF-8… I didn't type any *-characters, I typed quotes. Real ones, not the inch characters… Well, doesn't matter. Sooner or later I guess UTF-8 will be supported everywhere.
*

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

>

> I have looked in /var/logs/ but I am not sure what to look for, and I found

> nothing so far.



/var/log/Xorg.0.log is the place to look. *When a keyboard gets

detected, you see something like



* *(II) config/hal: Adding input device AT Translated Set 2 keyboard

* *(**) AT Translated Set 2 keyboard: always reports core events

* *(**) AT Translated Set 2 keyboard: Device: "/dev/input/event1"

* *(II) AT Translated Set 2 keyboard: Found keys

* *(II) AT Translated Set 2 keyboard: Configuring as keyboard

* *(II) XINPUT: Adding extended input device "AT Translated Set 2 keyboard" (type: KEYBOARD)

* *(**) Option "xkb_rules" "evdev"

* *(**) AT Translated Set 2 keyboard: xkb_rules: "evdev"

* *(**) Option "xkb_model" "pc105"

* *(**) AT Translated Set 2 keyboard: xkb_model: "pc105"

* *(**) Option "xkb_layout" "us"

* *(**) AT Translated Set 2 keyboard: xkb_layout: "us"



If you see the same thing again every time the keyboard layout resets to

default, that would mean I was right in my guess.



> *Solution?*

>

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

>

> I just need to understand better how evdev works, which files the system use

> and things like that. How to proceed with debugging etc.

>

> I was also thinking of an ugly solution: When I type *xprop -root | grep -i

> xkb*, I get the following information:

>

> *_XKB_RULES_NAMES_BACKUP(STRING) = "evdev", "pc105", "se", "", ""

> _XKB_RULES_NAMES(STRING) = "evdev", "pc105", "se", "johnny",

> "grp:alts_toggle,lv3:ralt_switch,compose:caps,altw in:left_meta_win"*

>

> Is there a way that I can make the *_XKB_RULES_NAMES_BACKUP(STRING)* the

> same as *_XKB_RULES_NAMES(STRING)*? Because it seems to me that what happens

> is that when some kind of fault occurs, the keyboard layout is switched to

> whatever *_XKB_RULES_NAMES_BACKUP(STRING)* says.



I've no idea were _XKB_RULES_NAMES_BACKUP comes from, or what uses it.



setxkbmap is the one that both sets and uses _XKB_RULES_NAMES to

remember the current setting. *AFAIU GNOME uses setxkbmap behind the

scenes to manipulate the keyboard layout.



> So if I could setboth of

> them to **"evdev", "pc105", "se", "johnny",

> "grp:alts_toggle,lv3:ralt_switch,compose:caps,altw in:left_meta_win"*, I

> could just ignore what ever happened…



Maybe



> Or maybe that's the dangerous way…?



I don't see how.



The worst thing that can happen if you play with XKB too much is you'll

end up with a broken layout that doesn't let you type anything or do any

stuff like switch to a text terminal with Ctrl+Alt+F1. *You can always

recover by copying and pasting 'setxkbmap us' letter-by-letter into a

terminal, or ssh'ing in and killing the X server to restart it.



Marius Gedminas

--

Si hoc legere scis nimium eruditionis habes.


-----BEGIN PGP SIGNATURE-----

Version: GnuPG v1.4.6 (GNU/Linux)



iD8DBQFJT4tVkVdEXeem148RAi3DAKCD1MoJkGvSkA3IqkaRU5 FcijQruACePS/i

hL9LsMQE5mKsZbCEyiyVgJE=

=60lu

-----END PGP SIGNATURE-----


--

ubuntu-users mailing list

ubuntu-users@lists.ubuntu.com

Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users




--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 11:23 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org