fix(Android): Overhaul serial port — deadlock, async writes, Qt 6.10 …#14282
fix(Android): Overhaul serial port — deadlock, async writes, Qt 6.10 …#14282HTRamsey wants to merge 3 commits intomavlink:masterfrom
Conversation
…API parity Fix critical deadlock in JNI read callback (s_ptrLock held across newDataArrived), make writeData() non-blocking via async IO manager writes, and map Java IOExceptions to ResourceError for hot-unplug detection. Assert DTR on open for CP210x/CH340 chips (fixes Radiomaster AX12), sync public API with Qt 6.10.2 (sendBreak, settingsRestoredOnClose, writeBufferSize stubs), fix readyRead reentrancy guard, remove dead code (6 unused JNI control line getters, _writeDataOneShot), and harden JNI bridge (bounded token loop, cache lock, exception ordering). Also fixes FTDI driver races (volatile statics, endpoint fallback scoped to single-port devices, no double-close on open failure) and adds u-blox 9 (ZED-F9P) to the probe table.
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (30.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #14282 +/- ##
=========================================
Coverage ? 25.51%
=========================================
Files ? 754
Lines ? 68025
Branches ? 31527
=========================================
Hits ? 17358
Misses ? 38026
Partials ? 12641
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Build ResultsPlatform Status
Some builds failed. Pre-commit
Pre-commit hooks: 4 passed, 36 failed, 7 skipped. Test Resultslinux-coverage: 78 passed, 0 skipped Code CoverageCoverage: 58.1% No baseline available for comparison Artifact Sizes
Updated: 2026-04-16 09:16:42 UTC • Triggered by: Android |
…apse - Migrate all AndroidSerial JNI calls to QJniObject::callStaticMethod<T>(), removing manual method ID caching (JniMethodCache, JniContext, ~180 lines) - Convert QGCUsbSerialManager to singleton with ConcurrentHashMap resource model - Collapse QGCFtdiDriver into QGCFtdiSerialDriver (D2XX lifecycle + serial port) - Extract QGCUsbPermissionHandler from QGCUsbSerialManager - Fix stale QGCFtdiDriver reference after collapse - Restore test helpers with lightweight no-Context constructor - Fix getOrCreateResourceId placeholder insertion - Simplify read path: O(1) swap drain, eliminate intermediate buffer machinery - Restructure write path: writeBuffer + QTimer drain (matches Qt Win pattern) - Zero-copy read drain via QRingBuffer::append(QByteArray&&) - QObjectPrivate::connect for type-safe private slot dispatch - Add writeBufferMaxSize support, align QSERIALPORT_BUFFERSIZE to 32K - Fix BlockingQueuedConnection deadlock in dispatchToPortObject - Remove dead code: cleanupJniCache, unused AndroidSerial::read() - Fix stale _bufferBytesEstimate references, explicit int narrowing in write - Wire sendBreak/writeBufferSize through to private implementation
Two targeted fixes for serial port "Access denied" after FC reboot: 1. _portAlreadyConnected() returns false when a link exists in _rgLinks but isConnected() is false, allowing autoconnect to retry instead of skipping the port forever. 2. Manual serial connect preempts any existing autoconnect link on the same port via _disconnectAutoConnectLink(), preventing exclusive- handle conflicts on Windows. Ref: mavlink#13932
cc4b5c4 to
0a69c28
Compare
…API parity
Fix critical deadlock in JNI read callback (s_ptrLock held across
newDataArrived), make writeData() non-blocking via async IO manager
writes, and map Java IOExceptions to ResourceError for hot-unplug
detection.
Assert DTR on open for CP210x/CH340 chips (fixes Radiomaster AX12),
sync public API with Qt 6.10.2 (sendBreak, settingsRestoredOnClose,
writeBufferSize stubs), fix readyRead reentrancy guard, remove dead
code (6 unused JNI control line getters, _writeDataOneShot), and
harden JNI bridge (bounded token loop, cache lock, exception ordering).
Also fixes FTDI driver races (volatile statics, endpoint fallback
scoped to single-port devices, no double-close on open failure)
and adds u-blox 9 (ZED-F9P) to the probe table.## Description
Type of Change
Testing
Platforms Tested
Flight Stacks Tested
Screenshots
Checklist
Related Issues
By submitting this pull request, I confirm that my contribution is made under the terms of the project's dual license (Apache 2.0 and GPL v3).