1
0
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:
James Cotton 2012-10-03 00:13:26 -05:00
parent 94c5b30e68
commit 9255785c31

View File

@ -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)