From: Michael Tremer Date: Sun, 12 Jul 2026 11:08:55 +0000 (+0000) Subject: sources: Add function to re-enable all sources X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8ea8a9b6abaf026de4a9edf5d13c5ae6b8c9be18;p=telemetry.git sources: Add function to re-enable all sources Signed-off-by: Michael Tremer --- diff --git a/src/daemon/source.c b/src/daemon/source.c index 0342df2..8d7041f 100644 --- a/src/daemon/source.c +++ b/src/daemon/source.c @@ -574,6 +574,10 @@ int td_source_is_disabled(td_source* self) { return 0; } +int td_source_enable(td_source* self) { + return td_source_change_state(self, STATE_HEALTHY); +} + // Called to disable the source (e.g. if there is no support for it) int td_source_disable(td_source* self) { return td_source_change_state(self, STATE_DISABLED); diff --git a/src/daemon/source.h b/src/daemon/source.h index fcc180c..269d62d 100644 --- a/src/daemon/source.h +++ b/src/daemon/source.h @@ -87,6 +87,7 @@ td_source* td_source_unref(td_source* self); const char* td_source_name(td_source* self); int td_source_is_disabled(td_source* self); +int td_source_enable(td_source* self); int td_source_disable(td_source* self); struct udev* td_source_get_udev(td_source* self); diff --git a/src/daemon/sources.c b/src/daemon/sources.c index 6334877..99b2f0f 100644 --- a/src/daemon/sources.c +++ b/src/daemon/sources.c @@ -333,3 +333,16 @@ td_source* td_sources_get_by_name(td_sources* self, const char* name) { return NULL; } + +int td_sources_enable_all(td_sources* self) { + int r; + + // Enable all sources + for (unsigned int i = 0; i < self->num_sources; i++) { + r = td_source_enable(self->sources[i]); + if (r < 0) + return r; + } + + return 0; +} diff --git a/src/daemon/sources.h b/src/daemon/sources.h index 34cd910..28aeb1e 100644 --- a/src/daemon/sources.h +++ b/src/daemon/sources.h @@ -35,4 +35,6 @@ td_sources* td_sources_unref(td_sources* self); td_source* td_sources_get_by_name(td_sources* self, const char* name); +int td_sources_enable_all(td_sources* self); + #endif /* TELEMETRY_SOURCES_H */