Fix busy looping forever after an evdev device goes away

This commit is contained in:
Cameron Gutman 2023-09-01 18:07:25 -05:00
parent 74714e6fb1
commit 19442743a6

View File

@ -170,6 +170,10 @@ static void evdev_remove(int devindex) {
pthread_join(devices[devindex].meThread, NULL); pthread_join(devices[devindex].meThread, NULL);
} }
libevdev_free(devices[devindex].dev);
loop_remove_fd(devices[devindex].fd);
close(devices[devindex].fd);
if (devindex != numDevices && numDevices > 0) if (devindex != numDevices && numDevices > 0)
memcpy(&devices[devindex], &devices[numDevices], sizeof(struct input_device)); memcpy(&devices[devindex], &devices[numDevices], sizeof(struct input_device));
} }