mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Added check to only detach kernel driver in LighpackDevice when it is active in the first place
Former-commit-id: 99e68e88571510bfb07a82942ee3f975f3f86a7f
This commit is contained in:
parent
aa318d5822
commit
f5f1019f72
@ -1 +1 @@
|
|||||||
b4ecb001b419687ffbef1bebb7c274bb31ea55f1
|
d59ae219a9dad5cd6138c23122df5e3313e473cb
|
@ -302,12 +302,16 @@ libusb_device_handle * LedDeviceLightpack::openDevice(libusb_device *device)
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = libusb_detach_kernel_driver(handle, LIGHTPACK_INTERFACE);
|
// detach kernel driver if it is active
|
||||||
if (error != LIBUSB_SUCCESS)
|
if (libusb_kernel_driver_active(handle, LIGHTPACK_INTERFACE) == 1)
|
||||||
{
|
{
|
||||||
std::cerr << "unable to detach kernel driver(" << error << "): " << libusb_error_name(error) << std::endl;
|
error = libusb_detach_kernel_driver(handle, LIGHTPACK_INTERFACE);
|
||||||
libusb_close(handle);
|
if (error != LIBUSB_SUCCESS)
|
||||||
throw error;
|
{
|
||||||
|
std::cerr << "unable to detach kernel driver(" << error << "): " << libusb_error_name(error) << std::endl;
|
||||||
|
libusb_close(handle);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
error = libusb_claim_interface(handle, LIGHTPACK_INTERFACE);
|
error = libusb_claim_interface(handle, LIGHTPACK_INTERFACE);
|
||||||
|
Loading…
Reference in New Issue
Block a user