|
|
|
@ -25,6 +25,22 @@
@@ -25,6 +25,22 @@
|
|
|
|
|
|
|
|
|
|
QGC_LOGGING_CATEGORY(QGCSerialPortInfoLog, "QGCSerialPortInfoLog") |
|
|
|
|
|
|
|
|
|
static const struct VIDPIDMapInfo_s { |
|
|
|
|
int vendorId; |
|
|
|
|
int productId; |
|
|
|
|
QGCSerialPortInfo::BoardType_t boardType; |
|
|
|
|
const char * boardString; |
|
|
|
|
} s_rgVIDPIDMappings[] = { |
|
|
|
|
{ QGCSerialPortInfo::px4VendorId, QGCSerialPortInfo::pixhawkFMUV4ProductId, QGCSerialPortInfo::BoardTypePX4FMUV4, "Found PX4 FMU V4" }, |
|
|
|
|
{ QGCSerialPortInfo::px4VendorId, QGCSerialPortInfo::pixhawkFMUV2ProductId, QGCSerialPortInfo::BoardTypePX4FMUV2, "Found PX4 FMU V2" }, |
|
|
|
|
{ QGCSerialPortInfo::px4VendorId, QGCSerialPortInfo::pixhawkFMUV2OldBootloaderProductId, QGCSerialPortInfo::BoardTypePX4FMUV2, "Found PX4 FMU V2"}, |
|
|
|
|
{ QGCSerialPortInfo::px4VendorId, QGCSerialPortInfo::pixhawkFMUV1ProductId, QGCSerialPortInfo::BoardTypePX4FMUV1, "Found PX4 FMU V1" }, |
|
|
|
|
{ QGCSerialPortInfo::px4VendorId, QGCSerialPortInfo::px4FlowProductId, QGCSerialPortInfo::BoardTypePX4Flow, "Found PX4 Flow" }, |
|
|
|
|
{ QGCSerialPortInfo::px4VendorId, QGCSerialPortInfo::AeroCoreProductId, QGCSerialPortInfo::BoardTypeAeroCore, "Found AeroCore" }, |
|
|
|
|
{ QGCSerialPortInfo::threeDRRadioVendorId, QGCSerialPortInfo::threeDRRadioProductId, QGCSerialPortInfo::BoardTypeSikRadio, "Found SiK Radio" }, |
|
|
|
|
{ QGCSerialPortInfo::siLabsRadioVendorId, QGCSerialPortInfo::siLabsRadioProductId, QGCSerialPortInfo::BoardTypeSikRadio, "Found SiK Radio" }, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
QGCSerialPortInfo::QGCSerialPortInfo(void) : |
|
|
|
|
QSerialPortInfo() |
|
|
|
|
{ |
|
|
|
@ -45,31 +61,14 @@ QGCSerialPortInfo::BoardType_t QGCSerialPortInfo::boardType(void) const
@@ -45,31 +61,14 @@ QGCSerialPortInfo::BoardType_t QGCSerialPortInfo::boardType(void) const
|
|
|
|
|
|
|
|
|
|
BoardType_t boardType = BoardTypeUnknown; |
|
|
|
|
|
|
|
|
|
switch (vendorIdentifier()) { |
|
|
|
|
case px4VendorId: |
|
|
|
|
if (productIdentifier() == pixhawkFMUV4ProductId) { |
|
|
|
|
qCDebug(QGCSerialPortInfoLog) << "Found PX4 FMU V4"; |
|
|
|
|
boardType = BoardTypePX4FMUV4; |
|
|
|
|
} else if (productIdentifier() == pixhawkFMUV2ProductId || productIdentifier() == pixhawkFMUV2OldBootloaderProductId) { |
|
|
|
|
qCDebug(QGCSerialPortInfoLog) << "Found PX4 FMU V2"; |
|
|
|
|
boardType = BoardTypePX4FMUV2; |
|
|
|
|
} else if (productIdentifier() == pixhawkFMUV1ProductId) { |
|
|
|
|
qCDebug(QGCSerialPortInfoLog) << "Found PX4 FMU V1"; |
|
|
|
|
boardType = BoardTypePX4FMUV1; |
|
|
|
|
} else if (productIdentifier() == px4FlowProductId) { |
|
|
|
|
qCDebug(QGCSerialPortInfoLog) << "Found PX4 Flow"; |
|
|
|
|
boardType = BoardTypePX4Flow; |
|
|
|
|
} else if (productIdentifier() == AeroCoreProductId) { |
|
|
|
|
qCDebug(QGCSerialPortInfoLog) << "Found AeroCore"; |
|
|
|
|
boardType = BoardTypeAeroCore; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case threeDRRadioVendorId: |
|
|
|
|
if (productIdentifier() == threeDRRadioProductId) { |
|
|
|
|
qCDebug(QGCSerialPortInfoLog) << "Found SiK Radio"; |
|
|
|
|
boardType = BoardType3drRadio; |
|
|
|
|
} |
|
|
|
|
for (size_t i=0; i<sizeof(s_rgVIDPIDMappings)/sizeof(s_rgVIDPIDMappings[0]); i++) { |
|
|
|
|
const struct VIDPIDMapInfo_s* pIDMap = &s_rgVIDPIDMappings[i]; |
|
|
|
|
|
|
|
|
|
if (vendorIdentifier() == pIDMap->vendorId && productIdentifier() == pIDMap->productId) { |
|
|
|
|
boardType = pIDMap->boardType; |
|
|
|
|
qCDebug(QGCSerialPortInfoLog) << pIDMap->boardString; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (boardType == BoardTypeUnknown) { |
|
|
|
@ -92,13 +91,13 @@ QGCSerialPortInfo::BoardType_t QGCSerialPortInfo::boardType(void) const
@@ -92,13 +91,13 @@ QGCSerialPortInfo::BoardType_t QGCSerialPortInfo::boardType(void) const
|
|
|
|
|
boardType = BoardTypePX4Flow; |
|
|
|
|
} else if (description() == "FT231X USB UART") { |
|
|
|
|
qCDebug(QGCSerialPortInfoLog) << "Found possible Radio (by name matching fallback)"; |
|
|
|
|
boardType = BoardType3drRadio; |
|
|
|
|
boardType = BoardTypeSikRadio; |
|
|
|
|
#ifdef __android__ |
|
|
|
|
} else if (description().endsWith("USB UART")) { |
|
|
|
|
// This is a fairly broad fallbacks for radios which will also catch most FTDI devices. That would
|
|
|
|
|
// cause problems on desktop due to incorrect connections. Since mobile is more anal about connecting
|
|
|
|
|
// it will work fine here.
|
|
|
|
|
boardType = BoardType3drRadio; |
|
|
|
|
boardType = BoardTypeSikRadio; |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|