mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-28 17:54:15 +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 ep1 = null;
|
||||||
UsbEndpoint ep2 = 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
|
// Using the same interface for reading and writing
|
||||||
usbInterface = connectDevice.getInterface(0x2);
|
usbInterface = connectDevice.getInterface(0x2);
|
||||||
if (usbInterface.getEndpointCount() == 2)
|
if (usbInterface.getEndpointCount() == 2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user