summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-03-10 10:48:25 +0100
committermathieui <mathieui@mathieui.net>2015-03-13 18:05:09 +0100
commit5a10be7fef3fb0ccc7984272f3c98f5dfaacaa25 (patch)
tree3b97a4c43c78963331dbcd9b5fcbdb9908eefc9e /Source/Core
parentebedc805459152b6a5af3eeafd712ea8a7978c1a (diff)
GC Adapter: fix a crash on exit
s_detected is better for detecting that a thread is actually running. Also make sure the claim_interface is always called when we detect an adapter.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/HW/SI_GCAdapter.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/Source/Core/Core/HW/SI_GCAdapter.cpp b/Source/Core/Core/HW/SI_GCAdapter.cpp
index d2ed8dc96a..a4410881cc 100644
--- a/Source/Core/Core/HW/SI_GCAdapter.cpp
+++ b/Source/Core/Core/HW/SI_GCAdapter.cpp
@@ -150,15 +150,12 @@ void Setup()
{
ERROR_LOG(SERIALINTERFACE, "libusb_detach_kernel_driver failed with error: %d", ret);
}
- else
- {
- AddGCAdapter(device);
- break;
- }
}
- else if ((ret != 0 && ret != LIBUSB_ERROR_NOT_SUPPORTED))
+ // this split is needed so that we don't avoid claiming the interface when
+ // detaching the kernel driver is successful
+ if (ret != 0)
{
- ERROR_LOG(SERIALINTERFACE, "libusb_kernel_driver_active error ret = %d", ret);
+ continue;
}
else if ((ret = libusb_claim_interface(s_handle, 0)))
{
@@ -224,7 +221,7 @@ void Shutdown()
void Reset()
{
- if (!SConfig::GetInstance().m_GameCubeAdapter)
+ if (!s_detected)
return;
if (s_adapter_thread_running.TestAndClear())
@@ -333,7 +330,7 @@ void Output(int chan, u8 rumble_command)
bool IsDetected()
{
- return s_handle != nullptr;
+ return s_detected;
}
bool IsDriverDetected()