shell: allow selecting SERIAL_CONTROL device - #3042
Conversation
CI note (aerial watcher 2026-08-24)style and proto check + docs check are red by design until the proto dependency lands:
Unblock path
Impl in |
| return Shell::Result::Success; | ||
| } | ||
|
|
||
| bool ShellImpl::device_to_mavlink(Shell::Device device, uint8_t& out_device) |
There was a problem hiding this comment.
Generally, we don't do out parameters. You can return a pair or an optional if you need result and value.
There was a problem hiding this comment.
Thanks — switched device_to_mavlink to return std::optional<uint8_t> (no out-param). Pushed in 962ca8a.
| return Shell::Result::InvalidArgument; | ||
| } | ||
|
|
||
| std::lock_guard<std::mutex> lock(_device_mutex); |
There was a problem hiding this comment.
Given this is lock is only around ever around _device you can just use std::atomic.
There was a problem hiding this comment.
Agreed — replaced the mutex with std::atomic<uint8_t> _device and relaxed loads/stores. Pushed in 962ca8a.
| } _receive; | ||
|
|
||
| std::mutex _device_mutex{}; | ||
| uint8_t _device{10}; // SERIAL_CONTROL_DEV_SHELL |
There was a problem hiding this comment.
You should have the mavlink enum define available.
There was a problem hiding this comment.
Now using SERIAL_CONTROL_DEV::* (and SERIAL_CONTROL_SERIAL*) via the mavlink headers instead of magic numbers. Pushed in 962ca8a.
- device_to_mavlink returns optional instead of out-param - store selected device in std::atomic - use SERIAL_CONTROL_DEV::* enum values
|
Addressed @julianoes review on the impl:
Still draft pending proto shape + submodule bump / regen after MAVSDK-Proto#427 lands in the new Send/Receive field form. |
|
Thanks for the fixes, please check CI. |
|
@julianoes Thanks — checked CI on the latest tip. Green: full build matrix (Linux/macOS/Windows/Kotlin/iOS/fuzz) after the impl review fixes (optional Still red (expected until proto lands):
Unblock: merge mavlink/MAVSDK-Proto#427 (CI green / MERGEABLE there), bump this repo’s Happy to adjust the public shape if you’d rather land proto first or change the SetDevice RPC. |
julianoes
left a comment
There was a problem hiding this comment.
This isn't updated to the latest proto changes yet, right?
|
@julianoes Correct — this PR is not updated to the latest proto yet. Still blocked on mavlink/MAVSDK-Proto#427 (
Keeping this draft until then so style/docs don’t thrash on hand-edited |
|
Please update this PR to match the proto PR. Once it is passing (with wrong/temporary proto submodule), I'll merge the proto PR, and bump it here. |
Point proto submodule at temporary MAVSDK-Proto tip (Device on Send/Receive, nested Receive for codegen). Regenerate public API + server bindings, drop set_device, pass device per send, surface device on receive. Keeps draft path Julian requested before proto merge.
|
@julianoes Updated this PR to match the proto shape (Device on Send/Receive, nested
CI will still see a “wrong” submodule SHA vs upstream main until you merge proto and repoint — that’s intentional per your note. Happy to adjust anything once style/docs run on your side. |
Committed shell.pb.* was generated with host protoc 36 / 7.36.0 headers, which broke the full build matrix (protobuf version guard). Regen C++ pb/grpc with protobuf 29.1 to match third_party; refresh C/JNI/Kotlin/Python shell bindings and docs for Device on Send/Receive. Still uses temporary proto submodule tip until MAVSDK-Proto#427 merges.
|
@julianoes Follow-up on CI after matching the proto shape: Root cause of matrix red: Fix just pushed (
Still draft with temporary |
Apply style/proto-check drift from ubuntu-24.04 job: - fix empty Device translate_ names (translate_device_*) - drop grpc ports_def.inc on shell.grpc.pb.* - match protoc-gen-mavsdk formatting across C/JNI/Kotlin/Python Still draft; temporary proto submodule tip until MAVSDK-Proto#427 merges.
aerial-watch (2026-08-29 04:47 ET)Style/proto check on
Pushed |
Docs job failed WARN_AS_ERROR on empty @brief for Shell::Receive and Receive::device. Proto tip e48f56d documents Receive; hand-sync hpp + md to match generate_from_protos output.
aerial-watch (2026-08-29 ~08:47 ET)CI on
Fix pushed:
Still draft with temporary proto submodule per your note. |
Style/proto check still drifted after Receive @brief proto comments: C/Kotlin/Python Receive descriptions + regenerated shell API markdown anchors from docs check. Still draft with temp proto tip e48f56d.
aerial-watch (2026-08-29 ~12:47 ET)CI on
Fix pushed Still draft with temporary proto tip |
aerial-watch (2026-08-30 ~00:47 ET)@julianoes CI on tip Ready for your side: merge proto #427 → bump submodule here (or tell me the merge SHA and I can push the bump) → undraft. |
Summary
Expose SERIAL_CONTROL device selection on shell
Send/Receive(default remains shell).Linked
Notes
Receivemessage for protoc-gen-mavsdk (single non-Result stream field).