Feature/usb#252
Conversation
There was a problem hiding this comment.
Pull request overview
Adds USB serial transport support to the MeshCore Flutter app/connector, complementing the existing Bluetooth transport. This includes a new USB connection UI flow, platform-specific USB serial implementations (native + Web Serial), and Android USB-host bridging code.
Changes:
- Introduce USB serial service + framing codec and integrate it into
MeshCoreConnectorwith transport-aware send/connect/disconnect flows. - Add new UI entry point to choose USB vs Bluetooth and a dedicated USB port selection/connect screen.
- Update platform build plumbing (Flutter desktop plugins, Android Gradle/Manifest) and add unit tests + localized strings for the new screens.
Reviewed changes
Copilot reviewed 51 out of 51 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| windows/flutter/generated_plugins.cmake | Registers flserial as an FFI plugin for Windows builds. |
| windows/CMakeLists.txt | Guards native-asset install step to avoid failing when assets dir is absent. |
| linux/flutter/generated_plugins.cmake | Registers flserial as an FFI plugin for Linux builds. |
| pubspec.yaml | Adds flserial dependency for native serial transport. |
| lib/utils/usb_port_labels.dart | Adds utilities for normalizing/friendly USB port labels across platforms. |
| lib/services/usb_serial_frame_codec.dart | Defines USB serial frame wrapper and a streaming frame decoder. |
| lib/services/usb_serial_service.dart | Provides conditional export for native vs web USB serial implementations. |
| lib/services/usb_serial_service_native.dart | Implements USB serial transport using flserial + Android USB-host bridge channels. |
| lib/services/usb_serial_service_web.dart | Implements USB serial transport using the browser Web Serial API via JS interop. |
| lib/connector/meshcore_connector.dart | Refactors connector to support both Bluetooth and USB transport, including USB connect and write paths. |
| lib/screens/connection_choice_screen.dart | Adds new home screen letting users choose USB vs Bluetooth connection. |
| lib/screens/usb_screen.dart | Adds USB port listing/selection UI and triggers USB connect flow. |
| lib/screens/scanner_screen.dart | Refactors connector reference + adds conditional back button handling. |
| lib/main.dart | Switches app home from ScannerScreen to ConnectionChoiceScreen. |
| test/utils/usb_port_labels_test.dart | Unit tests for USB port label normalization/description helpers. |
| test/services/usb_serial_frame_codec_test.dart | Unit tests for USB serial frame wrapping/decoding behavior. |
| android/build.gradle.kts | Adds JitPack repository for Android USB serial dependency resolution. |
| android/app/build.gradle.kts | Pins NDK version and adds usb-serial-for-android dependency. |
| android/app/src/main/AndroidManifest.xml | Declares optional USB host feature support. |
| android/app/src/main/kotlin/com/meshcore/meshcore_open/MainActivity.kt | Implements Android USB-host serial bridge (port listing, permissions, connect/read/write). |
| lib/l10n/app_en.arb | Adds new strings for connection choice + USB screen. |
| lib/l10n/app_bg.arb | Adds localized strings for connection choice + USB screen. |
| lib/l10n/app_de.arb | Adds localized strings for connection choice + USB screen. |
| lib/l10n/app_es.arb | Adds localized strings for connection choice + USB screen. |
| lib/l10n/app_fr.arb | Adds localized strings for connection choice + USB screen. |
| lib/l10n/app_it.arb | Adds localized strings for connection choice + USB screen. |
| lib/l10n/app_nl.arb | Adds localized strings for connection choice + USB screen. |
| lib/l10n/app_pl.arb | Adds localized strings for connection choice + USB screen. |
| lib/l10n/app_pt.arb | Adds localized strings for connection choice + USB screen. |
| lib/l10n/app_ru.arb | Adds localized strings for connection choice + USB screen. |
| lib/l10n/app_sk.arb | Adds localized strings for connection choice + USB screen. |
| lib/l10n/app_sl.arb | Adds localized strings for connection choice + USB screen. |
| lib/l10n/app_sv.arb | Adds localized strings for connection choice + USB screen. |
| lib/l10n/app_uk.arb | Adds localized strings for connection choice + USB screen. |
| lib/l10n/app_zh.arb | Adds localized strings for connection choice + USB screen. |
| lib/l10n/app_localizations.dart | Adds new localization getters for the connection choice + USB screen strings. |
| lib/l10n/app_localizations_bg.dart | Generated localization updates for new strings (Bulgarian). |
| lib/l10n/app_localizations_de.dart | Generated localization updates for new strings (German). |
| lib/l10n/app_localizations_en.dart | Generated localization updates for new strings (English). |
| lib/l10n/app_localizations_es.dart | Generated localization updates for new strings (Spanish). |
| lib/l10n/app_localizations_fr.dart | Generated localization updates for new strings (French). |
| lib/l10n/app_localizations_it.dart | Generated localization updates for new strings (Italian). |
| lib/l10n/app_localizations_nl.dart | Generated localization updates for new strings (Dutch). |
| lib/l10n/app_localizations_pl.dart | Generated localization updates for new strings (Polish). |
| lib/l10n/app_localizations_pt.dart | Generated localization updates for new strings (Portuguese). |
| lib/l10n/app_localizations_ru.dart | Generated localization updates for new strings (Russian). |
| lib/l10n/app_localizations_sk.dart | Generated localization updates for new strings (Slovak). |
| lib/l10n/app_localizations_sl.dart | Generated localization updates for new strings (Slovenian). |
| lib/l10n/app_localizations_sv.dart | Generated localization updates for new strings (Swedish). |
| lib/l10n/app_localizations_uk.dart | Generated localization updates for new strings (Ukrainian). |
| lib/l10n/app_localizations_zh.dart | Generated localization updates for new strings (Chinese). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 51 out of 51 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Can anyone test on linux and MacOS. Then leave a review here. Or fork and submit a PR to this branch |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 52 out of 52 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 52 out of 52 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 52 out of 52 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 52 out of 52 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@wel97459 @zjs81 @446564 @benallfree @ericszimmermann can i get a non AI review. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 52 out of 52 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I pushed updates to address the review threads and wanted to summarize what I changed, what remains open, and a few questions to help move this forward. Summary of changes (in response to review)
Files/areas I’d particularly like a re-check
Remaining items / questions
Next steps I propose
If I missed any review comments or misinterpreted a request, please point me to the specific thread and I’ll address it right away. Thanks again for the review — looking forward to your guidance on the remaining items. |
|
@codex |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 99967d3799
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 54 out of 54 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8bffafd to
f584c4f
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f584c4fba0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb58a3262c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Rewrite UsbScreen to mirror ScannerScreen patterns (status bar, tap-to-connect port list, bottom FABs, SnackBar errors) - Extract MeshCoreUsbManager from MeshCoreConnector for cleaner USB transport ownership - Add debug logging throughout USB connection flow (connector, manager, web/native services) - Print debug logs to console in debug mode even when app debug log setting is disabled - Localize remaining hardcoded strings (Web Serial Device fallback label, USB status bar keys, companion firmware timeout hint) - Fix Swedish misspelling in translations (stöderliga → stödda) - Guard Linux notification init against missing D-Bus session bus - Fix SNRIndicator hit-test error by adding minimum size constraints - Update USB flow tests for new UI patterns
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fef73b7b62
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (PlatformInfo.isWeb && | ||
| _activeTransport == MeshCoreTransportType.bluetooth) { | ||
| _pendingInitialContactsSync = true; |
There was a problem hiding this comment.
Trigger contact sync even when channel 0 is unavailable
On web BLE, this path defers getContacts() and only sets _pendingInitialContactsSync, which means contact sync is later triggered only by the channel.index == 0 branch in _handleChannelInfo. If channel 0 never arrives (for example, channel requests time out or firmware doesn't respond to cmdGetChannel), there is no fallback path that starts contact sync, so the app can remain connected with an empty contacts list indefinitely.
Useful? React with 👍 / 👎.
…ng and debug logging
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review |
On web BLE, contact sync is deferred until channel 0 arrives via _handleChannelInfo. If channel 0 times out or channel sync completes without it, _pendingInitialContactsSync stays true and contacts never load. Add fallback in _cleanupChannelSync to trigger getContacts() if the flag is still set when channel sync ends.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e1327a93c7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The /dev/ prefix granted read/write to all device nodes. The app only needs access to serial port devices (/dev/cu.* and /dev/tty.*) for USB LoRa communication.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This pull request introduces support for USB serial transport alongside existing Bluetooth connectivity in the MeshCore connector. It refactors connection logic to accommodate multiple transport types, adds robust error handling especially for web platforms, and updates dependencies and Android configuration to enable USB features. The changes ensure the connector can list and connect to USB ports, manage transport state, and handle device communication via USB or Bluetooth seamlessly.
Transport Abstraction and USB Support
MeshCoreTransportTypeenum and refactored connection logic to support both Bluetooth and USB transports, including new properties and methods for transport state management (activeTransport,activeUsbPort,listUsbPorts,connectUsb, etc.) inMeshCoreConnector. [1] [2] [3] [4] [5]UsbSerialService, including frame subscription and error handling. [1] [2] [3]Platform-Specific Improvements and Error Handling
PlatformInfo) to gate certain operations and ensure proper behavior on web vs. native environments. [1] [2] [3] [4]State Management Enhancements
Android Build and Dependency Updates
Codebase Integration
usb_serial_service.dart,platform_info.dart) required for USB support and platform detection. [1] [2]Platform status:
Feature Request #193