mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-18 18:26:27 +01:00
commit
2442a34c3d
@ -72,14 +72,15 @@ static void HotplugThreadFunc()
|
|||||||
FD_SET(monitor_fd, &fds);
|
FD_SET(monitor_fd, &fds);
|
||||||
FD_SET(s_wakeup_eventfd, &fds);
|
FD_SET(s_wakeup_eventfd, &fds);
|
||||||
|
|
||||||
int ret = select(monitor_fd + 1, &fds, nullptr, nullptr, nullptr);
|
int ret = select(std::max(monitor_fd, s_wakeup_eventfd) + 1, &fds, nullptr, nullptr, nullptr);
|
||||||
if (ret < 1 || !FD_ISSET(monitor_fd, &fds))
|
if (ret < 1 || !FD_ISSET(monitor_fd, &fds))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
udev_device* dev = udev_monitor_receive_device(monitor);
|
std::unique_ptr<udev_device, decltype(&udev_device_unref)> dev{
|
||||||
|
udev_monitor_receive_device(monitor), udev_device_unref};
|
||||||
|
|
||||||
const char* action = udev_device_get_action(dev);
|
const char* action = udev_device_get_action(dev.get());
|
||||||
const char* devnode = udev_device_get_devnode(dev);
|
const char* devnode = udev_device_get_devnode(dev.get());
|
||||||
if (!devnode)
|
if (!devnode)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -107,7 +108,6 @@ static void HotplugThreadFunc()
|
|||||||
s_devnode_name_map.insert(std::pair<std::string, std::string>(devnode, name));
|
s_devnode_name_map.insert(std::pair<std::string, std::string>(devnode, name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
udev_device_unref(dev);
|
|
||||||
}
|
}
|
||||||
NOTICE_LOG(SERIALINTERFACE, "evdev hotplug thread stopped");
|
NOTICE_LOG(SERIALINTERFACE, "evdev hotplug thread stopped");
|
||||||
}
|
}
|
||||||
@ -136,6 +136,7 @@ static void StopHotplugThread()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
s_hotplug_thread.join();
|
s_hotplug_thread.join();
|
||||||
|
close(s_wakeup_eventfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init()
|
void Init()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user