| 256 | } |
| 257 | |
| 258 | int rmdevpath(usbdevice* kb){ |
| 259 | euid_guard_start; |
| 260 | int index = INDEX_OF(kb, keyboard); |
| 261 | if(kb->infifo != 0){ |
| 262 | #ifdef OS_LINUX |
| 263 | write(kb->infifo - 1, "\n", 1); // hack to prevent the FIFO thread from perma-blocking |
| 264 | #endif |
| 265 | close(kb->infifo - 1); |
| 266 | kb->infifo = 0; |
| 267 | } |
| 268 | for(int i = 0; i < OUTFIFO_MAX; i++) |
| 269 | _rmnotifynode(kb, i); |
| 270 | char path[strlen(devpath) + 2]; |
| 271 | snprintf(path, sizeof(path), "%s%d", devpath, index); |
| 272 | if(rm_recursive(path) != 0 && errno != ENOENT){ |
| 273 | ckb_warn("Unable to delete %s: %s\n", path, strerror(errno)); |
| 274 | euid_guard_stop; |
| 275 | return -1; |
| 276 | } |
| 277 | ckb_info("Removed device path %s\n", path); |
| 278 | euid_guard_stop; |
| 279 | return 0; |
| 280 | } |
| 281 | |
| 282 | int mkfwnode(usbdevice* kb){ |
| 283 | int index = INDEX_OF(kb, keyboard); |
no test coverage detected