13
0

Shuttle Surface: handle libusb_init() failure

USB stack may not be available on some systems, e.g. unit-test VM.
When libusb_init(0) fails to create default context, further calls
into the libusb API will cause segfaults.
This commit is contained in:
Robin Gareus 2019-09-06 01:37:00 +02:00
parent 15defd5381
commit 212b445628
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -89,7 +89,11 @@ ContourDesignControlProtocol::~ContourDesignControlProtocol ()
bool
ContourDesignControlProtocol::probe ()
{
return true;
bool rv = LIBUSB_SUCCESS == libusb_init (0);
if (rv) {
libusb_exit (0);
}
return rv;
}
void*