GCAdapter: Close libusb handle if an open error occurs
The handle was previously kept open, which was causing future adapter plug/unplug events to be ignored.
This commit is contained in:
parent
80d8173d29
commit
0165e5e703
|
@ -276,12 +276,18 @@ static bool CheckDeviceAccess(libusb_device* device)
|
|||
// this split is needed so that we don't avoid claiming the interface when
|
||||
// detaching the kernel driver is successful
|
||||
if (ret != 0 && ret != LIBUSB_ERROR_NOT_SUPPORTED)
|
||||
{
|
||||
libusb_close(s_handle);
|
||||
s_handle = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
ret = libusb_claim_interface(s_handle, 0);
|
||||
if (ret)
|
||||
{
|
||||
ERROR_LOG(SERIALINTERFACE, "libusb_claim_interface failed with error: %d", ret);
|
||||
libusb_close(s_handle);
|
||||
s_handle = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue