mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-11-21 08:57:18 +00:00
Merge pull request #14010 from jordan-woyak/wmreal-iolinux-reopen-on-unplug
WiimoteReal/IOLinux: Reopen Bluetooth device if it was unplugged between scans.
This commit is contained in:
commit
02b4b1ece3
@ -64,7 +64,16 @@ WiimoteScannerLinux::WiimoteScannerLinux()
|
|||||||
bool WiimoteScannerLinux::Open()
|
bool WiimoteScannerLinux::Open()
|
||||||
{
|
{
|
||||||
if (IsReady())
|
if (IsReady())
|
||||||
return true;
|
{
|
||||||
|
// Verify that the device socket is still valid (checking for POLLERR).
|
||||||
|
pollfd pfd{.fd = m_device_sock};
|
||||||
|
if (UnixUtil::RetryOnEINTR(poll, &pfd, 1, 0) >= 0 && pfd.revents == 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// This happens if the Bluetooth adapter was unplugged between scans.
|
||||||
|
WARN_LOG_FMT(WIIMOTE, "Existing Bluetooth socket was invalid. Attempting to reopen.");
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
// Get the id of the first Bluetooth device.
|
// Get the id of the first Bluetooth device.
|
||||||
m_device_id = hci_get_route(nullptr);
|
m_device_id = hci_get_route(nullptr);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user