Commit graph

12 commits

Author SHA1 Message Date
Kenny Levinsen
0462e9331d wscons: Move to its own device type
This reduces ifdefs and avoids overloading evdev as something it is not.
2022-03-29 10:54:27 +02:00
Kenny Levinsen
df3f307b8e seat: Avoid holding a tty fd
The kernel Secure Attention Key killer, triggered by SysRq+k, kills all
processes that hold an fd referencing the tty.

To avoid its attention, we stop storing the fd for the currently active
VT in seat state. This has the added benefit of simplifying state a bit.
2021-09-02 20:02:55 +02:00
Kenny Levinsen
65d91351ab seatd: Tear down VT when disabled client closes
If a client closed while it was disabled, the VT would not be torn down.
If the user navigated back to the VT it belonged to, they would be
stuck.

When a client is disabled, open the fd for the VT it belonged to and
perform regular teardown on it.
2021-02-27 16:58:44 +01:00
Kenny Levinsen
be45c480ec terminal: Ack both release and acquire
Linux only requires acking release and ignores ack of acquire, but
FreeBSD is more stringent and will patiently wait for both to be acked.

Implement proper acking for both events.
2020-09-22 01:14:24 +02:00
Kenny Levinsen
51c7467516 seat: Rework seat activation/switch logic
The seat activation logic did not correctly handle VT switching and
switching between multiple sessions.

Session switching on VT-bound seats is now performed using a VT switch,
taking advantage of VT signals to perform the actual switch. This
simplifies switching logic and makes it more robust.
2020-09-22 01:01:46 +02:00
Kenny Levinsen
d75b617faf server: Convert seat list to linked_list 2020-08-31 14:09:59 +02:00
Kenny Levinsen
fc7116ffad seat: Convert client list to linked list 2020-08-03 02:48:39 +02:00
Kenny Levinsen
9b7a12d90a seat: Convert device list to linked list 2020-08-03 02:16:21 +02:00
Kenny Levinsen
b2cbe576d1 seat: Deactivate devices before sending disable
Previously, seatd would not deactivate devices until the client had
acked the disable. In once instance, this lead to libinput spending
significant time checking and closing each input device.

As a workaround, mimick logind's behavior of deactivating devices first.
The original behavior can be reintroduced if the client-side problem is
fixed.

Closes: https://todo.sr.ht/~kennylevinsen/seatd/5
2020-08-02 21:46:13 +02:00
Kenny Levinsen
b751481e5c seat: Open/close tty on activation/deactivation
The VT and KD ioctl's are picky about the tty fd used. In order to
satisfy these, and to improve state cleanup, we now only and store the
current tty when opening a client, and use this fd to perform teardown
later. The presence of the fd is also used to signal that teardown is
needed.
2020-08-02 21:46:10 +02:00
Kenny Levinsen
e129536a08 devices: Use path to check device type
FreeBSD device numbers cannot be used to check the type of a device, as
they are merely unique filesystem IDs.

As the paths we use have been sanitized with realpath, we can simply use
the path to check if a requested file is an evdev or drm device. This
also allows us to make the check before the file is opened.
2020-08-01 16:53:44 +02:00
Kenny Levinsen
61716a2c77 Initial implementation of seatd and libseat 2020-07-31 00:22:18 +02:00