Page MenuHomeFreeBSD

devd: remember notify events for currently attached devices and allow clients to request them
AbandonedPublic

Authored by val_packett.cool on Dec 30 2018, 9:34 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 23, 8:15 PM
Unknown Object (File)
Jan 16 2024, 5:21 PM
Unknown Object (File)
Nov 10 2023, 10:01 AM
Unknown Object (File)
Nov 9 2023, 5:01 AM
Unknown Object (File)
Oct 30 2023, 8:08 PM
Unknown Object (File)
Oct 29 2023, 7:57 AM
Unknown Object (File)
Oct 9 2023, 8:53 AM
Unknown Object (File)
Oct 8 2023, 3:56 AM

Details

Reviewers
imp
Summary

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
  • D18694: 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..

Test Plan

Tested with my fork of Weston and multiple USB input devices.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

imp requested changes to this revision.Dec 30 2018, 11:13 PM

We don't remember any old events.
You need to find a different way to get this information through the system.
I'd suggest a sysctl that publishes this information that can be read.

This revision now requires changes to proceed.Dec 30 2018, 11:13 PM