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:
parent
15defd5381
commit
212b445628
@ -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*
|
||||
|
Loading…
Reference in New Issue
Block a user