Commit graph

28 commits

Author SHA1 Message Date
Kenny Levinsen
8f8c9558e6 drm: Make dev_is_drm local to logind backend
This function is only used for logind, which is Linux-specific, but the
presence in common/drm.c suggested that it had to be portable.

Move it to the logind backend for now.
2022-03-29 10:54:27 +02:00
Kenny Levinsen
f128359332 logind: Always send ping if data is queued
sd_bus_call_method may have read and queued our ping response, so we
cannot assume that a previous ping will make the socket readable.

Instead, always send a ping if read or write queues are not empty, even
if a ping has already been sent.
2022-02-15 13:51:49 +01:00
Simon Ser
d92fa01f88 build: use list for logind dep
This reduces the boilerplate a bit. Use logind.name() instead of
having a separate source of truth. Requires adapting the checks a
bit because the dep name has a "lib" prefix.
2021-11-28 15:40:56 +01:00
Kenny Levinsen
e35c9cd02e logind: Set userdata for ping_handler 2021-10-05 10:05:25 +02:00
Kenny Levinsen
8e5c00e7c8 logind: Improve error handling in open_seat
errno was not being set by open_seat in most cases, leading to
simpletest possibly failing with "libseat_open_seat() failed: Success".
2021-09-22 23:04:40 +02:00
Simon Ser
262ccef84e logind: check if session is active on startup
Up until now we assumed the session was always active on startup.
This might not be the case. Instead, read the current value of the
Active property.
2021-09-22 21:55:49 +02:00
Kenny Levinsen
db08fb921f logind: Send ping to wake us up later
sd_bus_call drains received messages into the receive queue, and peeks
for its own return value. It does not dispatch the receive queue.

As the socket is drained, the caller will not wake from a poll and have
no reason to dispatch libseat. This has gone unnoticed largely due to
logind sending an event for every device, making it unlikely that no
unread message will be left on the socket.

Like we have done for seatd, we fix this by sending a "ping" request to
logind if anything is left in our receive queue as reported by
sd_bus_get_events. The response to this will wake us up and ensure that
dispatch is called.
2021-09-21 11:18:18 +02:00
Kenny Levinsen
6e7a1db32d logind: Remove redundant null check 2021-08-15 13:34:26 +02:00
Simon Ser
166feaea33 Make libseat_seat_listener const
libseat will never write to that struct. Let's allow callers to
make it read-only.
2021-08-15 13:33:30 +02:00
Kenny Levinsen
6444da6093 libseat: Rename dispatch_background in backends
This name never made much sense. dispatch_and_execute is more
meaningful, especially when compared to the non-executing dispatch
function.
2021-07-09 00:16:10 +02:00
Kenny Levinsen
6cf751af2b logind: Fix return values from close_device/get_fd 2021-02-27 19:35:01 +01:00
Kenny Levinsen
61b086511f logind: Send ReleaseControl when closing seat
This is not strictly speaking necessary as detaching from the bus should
trigger this automatically, but elogind apparently has issues with this.

Doing this explicitly does no harm, so let's just do that.
2020-12-23 00:34:02 +01:00
Simon Ser
e3a357bade libseat/backend/logind: stop waiting for CanGraphical
Upstream says compositors should wait for DRM nodes using udev instead.
2020-12-04 23:39:39 +01:00
Kenny Levinsen
1dbf100205 logind: switch_session should return 0 on success
It currently returned -1 on failure and 1 on success. The API is
intended to return -1 on failure and 0 on success, so fix that.
2020-11-24 13:12:31 +01:00
Kenny Levinsen
7d785ea993 logind: clang-format 2020-10-11 01:41:34 +02:00
Kenny Levinsen
daffed0955 logind: Use seat_path for SwitchTo 2020-10-10 19:39:28 +02:00
Kenny Levinsen
7bf91a5f9f logind: close_device should not close fd 2020-09-28 18:53:38 +02:00
Kenny Levinsen
6e6903829e logind: Merge PropertiesChanged handlers 2020-08-28 22:55:25 +02:00
Kenny Levinsen
74eee486fa libseat: Expand logging in all backends 2020-08-28 22:55:10 +02:00
Kenny Levinsen
ab4b961492 libseat: Remove useless logind fallbacks
The logind code is based on the wlroots implementation, which in turn
contained copy-paste code from Mutter that serves no purpose here.
2020-08-24 02:55:14 +02:00
Kenny Levinsen
26aff21058 logind: Set session type from env 2020-08-23 20:13:05 +02:00
Kenny Levinsen
8ab3fc03aa logind: Remove session type check 2020-08-23 20:12:51 +02:00
Kenny Levinsen
24c66d8c08 logind: Remove useless check 2020-08-23 20:12:29 +02:00
Kenny Levinsen
7d2668e360 logind: Allow SwitchTo for all seats 2020-08-06 02:25:24 +02:00
Kenny Levinsen
0fd525e85e logind: close_device always returned error
Error handling was broken in close_device, always returning -1.

Use the return value, and add a few errno assignments while we're at it.
2020-08-06 02:25:24 +02:00
Kenny Levinsen
3586530d81 libseat: Rename libseat_impl to seat_impl 2020-08-05 23:41:55 +02:00
Kenny Levinsen
e25688fed6 libseat: Convert clients to linked_list 2020-08-03 02:49:04 +02:00
Kenny Levinsen
61716a2c77 Initial implementation of seatd and libseat 2020-07-31 00:22:18 +02:00