diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2020-03-14 18:11:46 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-03-16 07:58:20 -0700 |
commit | ec3a968df9d8fc706fedb788959631e2ed84e04b (patch) | |
tree | aaa56de98ae2a861aef1d9bc2ab78fe05f06f745 /mobile-widgets/qmlmanager.cpp | |
parent | 1495aa2dbf5366cc135c1ceb959c6a12abbb3e0b (diff) | |
download | subsurface-ec3a968df9d8fc706fedb788959631e2ed84e04b.tar.gz |
android/usb: pass in the UsbDevice when downloading
This finally allows us to download from not just the first device, but specifically
the device that the user picks.
Passing the object through a void pointer is not nice - but since this traverses
C code other solutions (like passing an index into the list) seemed even worse.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qmlmanager.cpp')
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 12 |
1 files changed, 12 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) |