> "Applications should not access sysfs" doesn't mean there should be
>only one version of the intermediate library. There's already
>Systemd-Udev and Eudev versions, at least. For the case of Xorg, it
>just means sysfs access should not be hard-coded in the source of Xorg,
>but there should be some library in between, so that it is not
>necessary to recompile Xorg for every version of the kernel. So any
>replacement for the needed subset of libudev would do it.
Yes, but that's the whole point: the needed information is available
as is in sysfs, and putting a library in-between is 100% bloat. It's
just about testing something in the device path, and the device path
is just that - a path in sysfs. The way libudev proceeds to get
that information is entirely more complex than necessary - it even adds
operations that can fail, such as memory allocation, when it is
entirely useless here; but with the way the libudev architecture is
designed, it is the only way, and there's no escaping the bloat,
added SPOF, added failure points.
There is _no good way_ to implement the interesting parts of
EvdevDeviceIsVirtual() without directly accessing sysfs. It's either
sysfs, or libudev, or a libudev replacement that would, by design,
necessarily be just as bad as libudev.
--
Laurent
Received on Wed Nov 15 2017 - 18:27:43 UTC