[rant] keeping policy in HAL

Alexander E. Patrakov patrakov at gmail.com
Mon Dec 1 07:47:02 PST 2008


2008/12/1 Corbin Simpson <mostawesomedude at gmail.com>:
> Would a udev analogy be appropriate?

I think, yes.

> udev is a userspace program that
> manages a very low-level policy for the kernel. It's responsible for setting
> sensible defaults, but can be fully customized in order to fit the needs of
> anybody who wants custom layouts.

No, the default without any rules is root:root, 0660 for every device.

> Why userspace? Because policy shouldn't live in the kernel.

Agreed. However, why are the major and minor number in sysfs, instead
of some equivalent of devfs? Because they are insufficient to create
the device correctly from the first try without the policy. I.e., udev
creates a device immediately with the correct permissions, instead of
chmoding a kernel-created device (leading to -EPERM race). So the
analogy goes this way:

Kernel creates a directory in /sys, but no usable device node => Xorg
registers an input device, but doesn't make it immediately available
(e.g., it starts disabled, if there is such notion in Xorg).

Udev takes device major & minor numbers from sysfs and permissions
from rules, and then creates the device node => daemon gets the device
characteristics (e.g., the fact that it has keys) from Xorg, applies
some configuration stored in its database, modifies the device
settings and then enables the device, so that in no moment it is
enabled, but configured incorrectly.

> Why usable defaults? Because customization shouldn't be mandatory.

Here we disagree. Debian specifically has acknowledged the need for
mandatory customization in some cases. Please see debconf(7) about
configuration question priorities:

     low    Very trivial questions that have defaults that will work in
               the vast majority of cases.

     medium Normal questions that have reasonable defaults.

     high   Questions that don't have a reasonable default.
	
     critical Questions that you really, really need to see (or else).

In their installer, the question about the keyboard layout has the
medium priority, but only because the question about the installation
language (which is of the critical priority) provides the sensible
default.

> Why use dbus to talk to the rest of userspace? Because, like it or not, dbus
> is probably the best way to do so.

Agreed.

> Now, the big difference between HAL and udev is that udev sets its defaults
> based on LSB. I don't know whether or not LSB has anything to say about
> keyboard layouts, or what the default keyboard layout should be.

Apriori, there is no sensible default keyboard layout.

-- 
Alexander E. Patrakov



More information about the xorg mailing list