mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-30 08:24:11 +01:00
Android HID: Check the interface is valid before trying to open it.
This commit is contained in:
parent
94c5b30e68
commit
9255785c31
@ -257,6 +257,12 @@ public class HidUAVTalk extends TelemetryTask {
|
||||
UsbEndpoint ep1 = null;
|
||||
UsbEndpoint ep2 = null;
|
||||
|
||||
if (connectDevice.getInterfaceCount() < 2) {
|
||||
if (ERROR) Log.e(TAG, "Interface count for USB device incorrect");
|
||||
telemService.toastMessage("Failed to connect");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Using the same interface for reading and writing
|
||||
usbInterface = connectDevice.getInterface(0x2);
|
||||
if (usbInterface.getEndpointCount() == 2)
|
||||
|
Loading…
Reference in New Issue
Block a user