diff options
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 12 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 1a9a54a86..e7a557155 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -1999,6 +1999,18 @@ void QMLManager::DC_setProduct(const QString& product) void QMLManager::DC_setDevName(const QString& devName) { DCDeviceData::instance()->setDevName(devName); +#if defined(Q_OS_ANDROID) + // get the currently valid list of devices and set up the USB device descriptor + // if the connection string matches a connection in that list + androidSerialDevices = serial_usb_android_get_devices(); + std::string connection = devName.toStdString(); + for (unsigned int i = 0; i < androidSerialDevices.size(); i++) { + if (androidSerialDevices[i].uiRepresentation == connection) { + appendTextToLog(QString("setDevName matches USB device %1").arg(i)); + DCDeviceData::instance()->setUsbDevice((void *)&androidSerialDevices[i]); + } + } +#endif } void QMLManager::DC_setDevBluetoothName(const QString& devBluetoothName) diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h index 88bb350bf..08fead029 100644 --- a/mobile-widgets/qmlmanager.h +++ b/mobile-widgets/qmlmanager.h @@ -233,6 +233,7 @@ public slots: void btRescan(); #if defined(Q_OS_ANDROID) void showDownloadPage(QAndroidJniObject usbDevice); + QString getProductVendorConnectionIdx(android_usb_serial_device_descriptor descriptor); #endif void divesChanged(const QVector<dive *> &dives, DiveField field); |