Repository navigation
new(bus): allow exposing clight API on system bus via use_system_bus - #329
Open
anton-sugl wants to merge 1 commit into
Open
anton-sugl wants to merge 1 commit into
anton-sugl wants to merge 1 commit into
Conversation
Signed-off-by: Anton S-G <257776033+anton-sugl@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow exposing clight API on system bus
Adds an opt-in switch to register
org.clight.clighton the system bus instead of the user bus,for setups without a user session (e.g. embedded devices running clight as a system service).
Default behaviour is unchanged.
Usage
use_system_bus = true;or cmdline:--system-bus-DENABLE_SYSTEM_BUS=ON(default OFF) installs a D-Bus policy (clightgroup may call clight),a system D-Bus activation file, a systemd unit and a sysusers.d entry creating the
clightgroup.Implementation
bus.c: the user bus is connected lazily inget_user_bus(), since config is not yet parsed inmodule_pre_start(). In system-bus mode it returns a new reference to the system bus connection,which is polled only once;
interface.cdrops its reference instead of closing the shared connection.org.freedesktop.ScreenSaverAPI (and its fallback bus monitor) is notexposed, as it only makes sense in a user session. clight's own
Inhibitmethod keeps working.NoAutoCalibandNoSmoothare markedSD_BUS_VTABLE_UNPRIVILEGED, likeIncBl/DecBl/Pausealready are, so that non-root clients (allowed by the D-Bus policy) can toggle them on the system bus.
On the user bus this changes nothing, as sd-bus does no per-member access checks there.
Notes
a system service; documented in the sample config.
Testing
Built with the CI dependencies (Ubuntu, libmodule 5.0.1), no new warnings. Runtime-tested with private
system and session dbus-daemons plus Clightd:
use_system_bus = false: name owned on user bus only (unchanged)use_system_bus = trueand--system-bus: name owned on system bus only, API calls work thereNoSmooth/NoAutoCalib, gets "Access denied" on others-DENABLE_SYSTEM_BUS=ON🤖 Generated with Claude Code