Lines Matching refs:event
68 const struct rfkill_event *event, in find_device() argument
75 assert(event); in find_device()
78 if (asprintf(&sysname, "rfkill%i", event->idx) < 0) in find_device()
97 const struct rfkill_event *event, in determine_state_file() argument
105 assert(event); in determine_state_file()
108 r = find_device(event, &d); in determine_state_file()
116 assert_se(type = rfkill_type_to_string(event->type)); in determine_state_file()
136 static int load_state(Context *c, const struct rfkill_event *event) { in load_state() argument
142 assert(event); in load_state()
147 r = determine_state_file(event, &state_file); in load_state()
155 …r = write_string_file(state_file, one_zero(event->soft), WRITE_STRING_FILE_CREATE|WRITE_STRING_FIL… in load_state()
159 log_debug("Saved state '%s' to %s.", one_zero(event->soft), state_file); in load_state()
170 .idx = event->idx, in load_state()
179 … return log_error_errno(errno, "Failed to restore rfkill state for %i: %m", event->idx); in load_state()
201 static int save_state_queue(Context *c, const struct rfkill_event *event) { in save_state_queue() argument
208 assert(event); in save_state_queue()
210 r = determine_state_file(event, &state_file); in save_state_queue()
214 save_state_queue_remove(c, event->idx, state_file); in save_state_queue()
221 item->rfkill_idx = event->idx; in save_state_queue()
222 item->state = event->soft; in save_state_queue()
229 static int save_state_cancel(Context *c, const struct rfkill_event *event) { in save_state_cancel() argument
235 assert(event); in save_state_cancel()
237 r = determine_state_file(event, &state_file); in save_state_cancel()
238 save_state_queue_remove(c, event->idx, state_file); in save_state_cancel()
307 struct rfkill_event event = {}; in run() local
309 ssize_t l = read(c.rfkill_fd, &event, sizeof event); in run()
348 const char *type = rfkill_type_to_string(event.type); in run()
350 … log_debug("An rfkill device of unknown type %i discovered, ignoring.", event.type); in run()
354 switch (event.op) { in run()
357 … log_debug("A new rfkill device has been added with index %i and type %s.", event.idx, type); in run()
358 (void) load_state(&c, &event); in run()
362 … log_debug("An rfkill device has been removed with index %i and type %s", event.idx, type); in run()
363 (void) save_state_cancel(&c, &event); in run()
367 … log_debug("An rfkill device has changed state with index %i and type %s", event.idx, type); in run()
368 (void) save_state_queue(&c, &event); in run()
372 …Unknown event %i from /dev/rfkill for index %i and type %s, ignoring.", event.op, event.idx, type); in run()