Revert "Make battery module update on plugging/unplugging again (refs #2519)"

This commit is contained in:
Alexis Rouillard
2025-01-25 09:24:48 +01:00
committed by GitHub
parent dc64b3542b
commit bb2c67ebad
4 changed files with 35 additions and 51 deletions

View File

@ -1,5 +1,4 @@
#include "util/backlight_backend.hpp"
#include "util/udev_deleter.hpp"
#include <fmt/core.h>
#include <spdlog/spdlog.h>
@ -30,6 +29,22 @@ class FileDescriptor {
int fd_;
};
struct UdevDeleter {
void operator()(udev *ptr) { udev_unref(ptr); }
};
struct UdevDeviceDeleter {
void operator()(udev_device *ptr) { udev_device_unref(ptr); }
};
struct UdevEnumerateDeleter {
void operator()(udev_enumerate *ptr) { udev_enumerate_unref(ptr); }
};
struct UdevMonitorDeleter {
void operator()(udev_monitor *ptr) { udev_monitor_unref(ptr); }
};
void check_eq(int rc, int expected, const char *message = "eq, rc was: ") {
if (rc != expected) {
throw std::runtime_error(fmt::format(fmt::runtime(message), rc));