MCPcopy Create free account
hub / github.com/Alexays/Waybar / Rfkill

Method Rfkill

src/util/rfkill.cpp:29–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27#include <cerrno>
28
29waybar::util::Rfkill::Rfkill(const enum rfkill_type rfkill_type) : rfkill_type_(rfkill_type) {
30 fd_ = open("/dev/rfkill", O_RDONLY);
31 if (fd_ < 0) {
32 spdlog::error("Can't open RFKILL control device");
33 return;
34 }
35 int rc = fcntl(fd_, F_SETFL, O_NONBLOCK);
36 if (rc < 0) {
37 spdlog::error("Can't set RFKILL control device to non-blocking: {}", errno);
38 close(fd_);
39 fd_ = -1;
40 return;
41 }
42 Glib::signal_io().connect(sigc::mem_fun(*this, &Rfkill::on_event), fd_,
43 Glib::IO_IN | Glib::IO_ERR | Glib::IO_HUP);
44}
45
46waybar::util::Rfkill::~Rfkill() {
47 if (fd_ >= 0) {

Callers

nothing calls this directly

Calls 3

openFunction · 0.85
closeFunction · 0.85
connectMethod · 0.80

Tested by

no test coverage detected