Add guest port capability model and incompatible-device error flags - #282
Merged
Conversation
Introduce GuestPortCapability (ETHERNET, I2C, RS232, RS485, USB2, PWM) and use it in two places: GuestPortConnectorInfo.capabilities describes the interfaces a physical port provides, and GuestPortDevice.required_capabilities describes what a device needs. The drone computes GuestPortDevice.compatible_guest_ports from the two, so clients no longer hardcode device-to-port rules. Add per-port gpN_incompatible_device error flags for dive-time warnings. Register GuestPortCapability in the Rust serde allowlist so the on-drone guest-port JSON carries the new fields. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the protocol definitions to let the drone report guest-port interface capabilities and device interface requirements, enabling clients to determine (and suggest) compatible ports for a connected device. It also adds per-port “incompatible device” warning bits to ErrorFlags, and updates Rust pbjson generation to include the new enum in on-drone guest-port JSON.
Changes:
- Added
GuestPortCapabilityenum and introduced capability/requirement fields onGuestPortConnectorInfoandGuestPortDevice. - Added
ErrorFlags.gp{1..6}_incompatible_devicewarning bits (tags 78–83) to signal capability mismatch per port. - Updated
rust/build.rspbjson allowlist to include.blueye.protocol.GuestPortCapabilityso the new fields can round-trip via JSON.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
protobuf_definitions/message_formats.proto |
Adds GuestPortCapability, device-required capabilities, compatible port list, port capabilities, and new incompatible-device error flags. |
rust/build.rs |
Adds GuestPortCapability to the pbjson serde allowlist for guest-port JSON serialization/deserialization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jp-pino
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First step of the X7 guest port work tracked in the design doc BluEye-Robotics/libguestport#383: make the drone the owner of device↔port compatibility by modelling port capabilities and device requirements in the protocol.
Closes #243.
Changes
GuestPortCapabilityenum —ETHERNET,I2C,RS232,RS485,USB2,PWM. Used both for the interfaces a port provides and for the interfaces a device requires.GuestPortConnectorInfo.capabilities = 4(repeated) — the interfaces the physical port provides. Placed outside theconnected_deviceoneof so a port that errors (e.g.NOT_FLASHED) still advertises what it supports.GuestPortDevice.required_capabilities = 8(repeated) — the interfaces the device needs, sourced fromperipherals.jsonin libguestport.GuestPortDevice.compatible_guest_ports = 9(repeatedGuestPortNumber) — computed by the drone as the ports whose capabilities cover the device's requirements. Clients derive incompatibility asguest_port_number ∉ compatible_guest_portsand can suggest valid ports.ErrorFlags.gp1_incompatible_device = 78…gp6_incompatible_device = 83— per-port dive-time warning bits, to be raised by the guest port supervisor.rust/build.rs—GuestPortCapabilityadded to the pbjson serde allowlist so the on-drone guest-port JSON carries the new fields.Design notes
GUEST_PORT_ERROR_INCOMPATIBLE_PORTvalue (as originally floated in Add error flag if a guest port device is connected to an incompatible port #243):GuestPortConnectorInforeportsdevice_listXORerrorvia the oneof, and an incompatible device is still a successfully read device — signalling throughGuestPortErrorwould discard the device info.🤖 Generated with Claude Code