On Sun, Dec 11, 2005 at 11:19:39PM +0100, Almut Behrens wrote: > On Fri, Dec 09, 2005 at 11:22:30PM +0200, Simo Kauppi wrote: > > On Thu, Dec 08, 2005 at 09:34:26PM +0100, Almut Behrens wrote: > > > On Wed, Dec 07, 2005 at 02:16:09PM +0200, Simo Kauppi wrote: > > > > Is there a way to compile keyboard definitions for X and save them > > > > somewhere, where XServer can read them, when it starts? > > > > > > $ xkbcomp -xkm :0 keymap.xkm > > > Then, simply transfer the resulting keymap.xkm to your thinclient, > > > where you can make the X server load it upon startup using the option > > > "-xkbmap keymap.xkm". > > > > If I start X with -xkbdb keymap.xkm, it doesn't complain, but the > > keyboard doesn't behave properly :( > > Not too surprising. That option's value is assigned to some variable > XkbDB (in xc/programs/Xserver/xkb/xkbInit.c) which isn't used anywhere > else beyond this assignment, in the entire X sources. Whatever that's > supposed to do, it isn't implemented yet ;) > > The fact that -xkbmap doesn't work as advertised, isn't too surprising > either, 'cos I was telling rubbish (yeah, next time, Almut reminds > herself to actually verify the stuff she's claiming...)
Well, it did make perfect sense :) I would have expected the -xkbmap to work exactly the way you described. > All in all, I can't help getting the impression, that Simo and me are > to the only two people in this world who have ever tried to make use of > this -xkbmap option :) Maybe others just gave up when it didn't work the way one would expect. > My main observations: > > * you can't keep the X server from wanting to call xkbcomp, even in the > presence of a perfectly valid compiled xkbmap. At least, I dunno how. > > * even though the output of the xkbcomp run isn't really used in this > case (AFAICT), it is good to have it succeed, superficially. In case > of any failures in this step, a couple of other things are being tried > which eventually lead to a complete failure of the whole shebang. > > * you are expected to specify the bare name of the keymap (without the > .xkm extension); the X server looks for the map in certain predefined > directories (which do vary depending on which UID the server is started as) > > * unless you have a dot in the keymap name, the X server deletes the > map before reading it. No kidding. This seems to be because the > path of the temporary output file (created during the useless run of > xkbcomp) is being set to where the real keymap is expected to be found. > And tempfile cleanup happens before the actual "-xkbmap"-related code > gets a chance to read it... Luckily, there's some odd "sanitizing" > being applied to the tempfile name (replacing '.' by '_'). That allows > us to play tricks here: > > So, to summarize, here's what I did: > > * moved away the original /usr/X11R6/lib/X11/xkb directory (a link to > /etc/X11/xkb, normally), preventing X from accessing anything in there. > > * uncommented all 'Option "Xkb*"' entries in XF86Config-4/xorg.conf. > > * created a dummy replacement for xkbcomp. This is just a simple script > which copies the precompiled keymap to the tempfile location where X is > expecting to find it -- hereby simulating a successful compile run: > > #!/usr/bin/perl > > $base = "/usr/X11R6/lib/X11/xkb/"; > $dest = pop @ARGV; # of the 12 args that xkbcomp is called > $src = $base . pop @ARGV; # with, the last two are of interest... > $dest = "$base$dest" if $dest !~ m|^/|; > > system 'cp', $src, $dest; # create expected output > exit 0 # always succeed > > * created a new xkb directory, containing just the following: > > -rwxr-xr-x root/root 313 /usr/X11R6/lib/X11/xkb/xkbcomp > drwxr-xr-x root/root 0 /usr/X11R6/lib/X11/xkb/keymap/ > -rw-r--r-- root/root 7804 /usr/X11R6/lib/X11/xkb/keymap/default.map > drwxr-xr-x root/root 0 /usr/X11R6/lib/X11/xkb/compiled/ > lrwxrwxrwx root/root 0 /usr/X11R6/lib/X11/xkb/compiled/default.map.xkm -> > /usr/X11R6/lib/X11/xkb/keymap/default.map > lrwxrwxrwx root/root 0 /var/tmp/default.map.xkm -> > /usr/X11R6/lib/X11/xkb/keymap/default.map > > (xkbcomp is the above script. default.map is the compiled keymap. > The map in /var/tmp/ is used when X is run as a regular user.) > > I'm not saying this is way to do it -- just that it worked for me :) > Tried with various versions of X from woody's XFree86 to Xorg-6.8.2. > > Let me know whether it works for you, too, Simo. I'm afraid I won't be > able to help, if not, though -- just out of curiosity... Excellent work Almut! It works like a charm :) I can't thank you enough, figuring this out would have taken light years from me :)) > Almut > > (...and I said, I wouldn't bore you with details... Well.) No worries there, having a software background myself, I find this really interesting. Yes, I know there must be something wrong with me :) Little sidenote: while searching for clues, I ran into this https://bugs.freedesktop.org/show_bug.cgi?id=4461, which seems to suggest that the default locations are going to change, maybe even for the final X.org 6.9/7.0 release (RC3 doesn't seem to have that). Big thanks, Simo -- :r ~/.signature
signature.asc
Description: Digital signature