Lines Matching refs:rfkill
57 struct rfkill_data *rfkill = eloop_ctx; in rfkill_receive() local
62 len = read(rfkill->fd, &event, sizeof(event)); in rfkill_receive()
74 if (event.op != RFKILL_OP_CHANGE || event.idx != rfkill->idx) in rfkill_receive()
93 if (new_blocked != rfkill->blocked) { in rfkill_receive()
94 rfkill->blocked = new_blocked; in rfkill_receive()
96 rfkill->cfg->blocked_cb(rfkill->cfg->ctx); in rfkill_receive()
98 rfkill->cfg->unblocked_cb(rfkill->cfg->ctx); in rfkill_receive()
105 struct rfkill_data *rfkill; in rfkill_init() local
113 rfkill = os_zalloc(sizeof(*rfkill)); in rfkill_init()
114 if (rfkill == NULL) in rfkill_init()
125 rfkill->cfg = cfg; in rfkill_init()
126 rfkill->fd = open("/dev/rfkill", O_RDONLY); in rfkill_init()
127 if (rfkill->fd < 0) { in rfkill_init()
133 if (fcntl(rfkill->fd, F_SETFL, O_NONBLOCK) < 0) { in rfkill_init()
140 len = read(rfkill->fd, &event, sizeof(event)); in rfkill_init()
174 rfkill->idx = event.idx; in rfkill_init()
177 rfkill->blocked = 1; in rfkill_init()
180 rfkill->blocked = 1; in rfkill_init()
189 eloop_register_read_sock(rfkill->fd, rfkill_receive, rfkill, NULL); in rfkill_init()
191 return rfkill; in rfkill_init()
194 close(rfkill->fd); in rfkill_init()
196 os_free(rfkill); in rfkill_init()
203 void rfkill_deinit(struct rfkill_data *rfkill) in rfkill_deinit() argument
205 if (rfkill == NULL) in rfkill_deinit()
208 if (rfkill->fd >= 0) { in rfkill_deinit()
209 eloop_unregister_read_sock(rfkill->fd); in rfkill_deinit()
210 close(rfkill->fd); in rfkill_deinit()
213 os_free(rfkill->cfg); in rfkill_deinit()
214 os_free(rfkill); in rfkill_deinit()
218 int rfkill_is_blocked(struct rfkill_data *rfkill) in rfkill_is_blocked() argument
220 if (rfkill == NULL) in rfkill_is_blocked()
223 return rfkill->blocked; in rfkill_is_blocked()