On Mon, Mar 18, 2024 at 05:55:04PM +0100, Martin Burggraf wrote:
> Hi,
>  
> I have an input device/keyboard, which I reconfigured greatly, wrote my own 
> geometry files, symbols, keycodes and so on.
> To make it work with X11 I wanted to write my own rules file for use with the 
> xf86-input-evdev package. However I had to notice, that it doesn't work, 
> because when using
> 
> Driver "evdev"
> 
> In the Config file, the statement
> Option "XkbRules" "myfile"
> is ignored.
> 
> In  xf86-input-evdev src/evdev.c I found line 1152 and follwing:
>    /* sorry, no rules change allowed for you */
>     xf86ReplaceStrOption(pInfo->options, "xkb_rules", "evdev");
>     rmlvo.rules = xf86SetStrOption(pInfo->options, "xkb_rules", NULL);
> 
> So the code explicitly ignores the option. As a result I have to make
> my rules changes to the file /usr/share/X11/xkb/rules/evdev itself,
> which isn't quite update stable and a hassle for me.
> 
> Is there an explanation, on why exactly the option to specify a
> different rule-file is disabled? I guess there must be a good reason,
> but I can't find any info on it.

history. 20-ish years ago there effectively used to be one ruleset
("base", "xfree86", or "xorg" depending which symlink name you used).
evdev had slightly different requirements (primarily keycodes) so a
different ruleset was used for that.

Using the xfree86 ruleset for evdev devices ended up in some keys doing
the wrong thing because the keycodes were mostly the same but differed
in a few crucial parts. But at that time everyone who ever copied the
XKB configuration from a forum also copied the line 
Option "XkbRules" "xfree86" into their xorg.conf (this was before
xorg.conf.d support).

After spending too much time on telling users to update their config
files, evdev hardcoded ruleset hardcoded to ignore the XkbRules option. 

Now it's 20-ish years later, the keyboard driver is no longer a thing on
most linux distributions and we may be able to remove that harcoded option.
Except - because we never could fix the users configurations there's a 
chance that some of these got copy/pasted through the years and will
break. Probably easier to fix now than back then, doubly so if we keep
the current behaviour by only XkbRules if it's set to "xfree86" and
friends.

All that said: I think custom rules are a little bit pointless, you
should be able to get by with the 'custom' layout in X:
https://who-t.blogspot.com/2021/02/a-pre-supplied-custom-keyboard-layout.html
IIRC that one pulls in types and symbols - I'm not sure why you'd need a
special keycode section given that the default evdev one provides all of
them. Geometry won't work but that one is mostly superfluous either way.

Cheers,
  Peter`

Reply via email to