`udev` on Linux provides device properties/tags (e.g. "is a mouse" / "keyboard" / etc) that are used by Wayland compositors.
Our `libudev-devd` currently emulates that by `open()`ing the devices and using `ioctl()` to detect device features. This is highly problematic, because it requires access permissions to `/dev/input/*`. The user account should not have these permissions, because that subverts the Wayland security model, which disallows arbitrary user applications from getting input events globally (i.e. being keyloggers).
To allow `libudev-devd` to fully work without input device access, device properties should be provided by `devd`. I propose:
- this patch: making `devd` remember notify events that correspond to currently attached devices (store them on `type` `ATTACH`/`CREATE`, remove on `DETACH`/`DESTROY`) and allowing clients to query `devd` for remembered events for any given `system`
- upcoming patch: adding the appropriate `devctl_notify` to `evdev`
- corresponding `libudev-devd` PR: https://github.com/FreeBSDDesktop/libudev-devd/pull/8
This looks like: (annotated: `>` is my input, `<` is returned by devd)
```
# nc -U /var/run/devd.pipe
> %EVDEV
[…]
< !system=EVDEV subsystem=DEVICE type=ATTACH cdev=input/event4 unit=4 name="TPPS/2 IBM TrackPoint" shortname=psm0 bustype=0x0011 vendor=0x0002 product=0x000a version=0x0000 inputtype=MOUSE
< !system=EVDEV subsystem=DEVICE type=ATTACH cdev=input/event5 unit=5 name="ELAN Touchscreen, class 0/0, rev 2.00/0.11, addr 3" shortname=wmt0 bustype=0x0003 vendor=0x04f3 product=0x0140 version=0x0000 inputtype=TOUCHSCREEN
< %
```
Remembering the data across `devd` restarts is out of scope for this patch. Realistically, `devd` is never restarted on a desktop system most of the time..