Skip to content

feat: add BLE transport layer for MCUmgr over SMP#48

Open
moyamartin wants to merge 3 commits into
vouch-opensource:mainfrom
moyamartin:feat/add-ble-for-dfu
Open

feat: add BLE transport layer for MCUmgr over SMP#48
moyamartin wants to merge 3 commits into
vouch-opensource:mainfrom
moyamartin:feat/add-ble-for-dfu

Conversation

@moyamartin

@moyamartin moyamartin commented Jun 15, 2026

Copy link
Copy Markdown

Summary

Implements BLE as a transport layer for MCUmgr commands to be sent to Zephyr/MCUboot devices over the standard SMP-over-BLE GATT service (UUID 8D53DC1D / DA2E7828)

Changes

  • Adds src/ble.rs responsible for the BLE transport layer using btleplug
  • Supports device discovery using MAC address (--ble-address) or by advertisement name (--ble-name)
  • Handles SMP packet fragmentation across ATT notifications.
  • Extends enum in transfer.rs with Ble(BleSpecs) variant.
  • Adds the following arguments --ble-address, --ble-name, --ble-timeout and --ble-mtu. BLE takes precedence
    over UDP and serial in transport selection.

Note: this is only supported for BlueZ D-Bus (Linux), Windows and MacOS it is not supported yet.

Usage

./mcumgr-client --ble-name <advertising_name> <command>

On my local instance I have a device called vytal 75F1E9:

~ ./mcumgr-client --ble-name "vytal 75F1E9" list
**mcumgr-client 0.0.9

22:15:50 [INFO] Using BLE transport: scanning for 'Vytal 75F1E9'
22:15:50 [INFO] send image list request
response: {
  "images": [
    {
      "image": 0,
      "slot": 0,
      "version": "0.0.1",
      "hash": "13c0525197dedde0d68dcae7485150e18d956ab5673e56ea0ea6e24da5d901c11433ea9420b1106e197c37e623255b58d2faa11feef03179a551a919034526b1",
      "bootable": true,
      "pending": false,
      "confirmed": false,
      "active": true,
      "permanent": false
    },
    {
      "image": 0,
      "slot": 1,
      "version": "0.0.2",
      "hash": "cc834480bf4b0ea50813612baacf4e1c93cccab883d8e4515c09ccc5a03e001bff2d34809cf9eb6be83fcbd19858fdeda985266926a58734800d669ef85e0051",
      "bootable": true,
      "pending": false,
      "confirmed": true,
      "active": false,
      "permanent": false
    }
  ],
  "splitStatus": "NotApplicable**

Implements BLE as a transport layer for MCUmgr commands
to be sent to Zephyr/MCUboot devices over the standard
SMP-over-BLE GATT service (UUID 8D53DC1D / DA2E7828)

Note, this is only supported for BlueZ D-Bus (Linux),
Windows and MacOS it is not supported yet.
@Frank-Buss

Copy link
Copy Markdown
Contributor

Nice. I tried it as well some time ago, but got timeout problems, but I think the lib I tried supported all 3 platforms: https://github.com/vouch-opensource/mcumgr-client/tree/frankbuss/ble But BLE in general is really flaky on Linux and Windows. Only on Mac it works kind of stable. Your approach of using a lower level BlueZ lib might be the right thing for Linux.

@moyamartin

Copy link
Copy Markdown
Author

@Frank-Buss I guess it won't hurt testing that library again. I'll push a change when I tested that succesfully. It is https://github.com/deviceplug/btleplug right? MAybe it is more stable now

@Frank-Buss

Copy link
Copy Markdown
Contributor

Yes, this is the library. Looks like changes 3 months ago, so actively maintained at least. My first test of it was 3 years ago, would be nice to have it working for all 3 platforms, thanks.

testing is needed for Windows and macOS
@moyamartin

Copy link
Copy Markdown
Author

@Frank-Buss I migrated to btleplug succesfully. Feel free to test this PR with another OS.

Migrate from MUSL to GNU due to non-static libraries of d-bus and bluez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants