Example mirage-eio unikernels
0

Configure Feed

Select the types of activity you want to include in your feed.

README.md

bluetooth#

bluetooth unikernel demo

A Bluetooth Low Energy scanner in a unikernel.

A Solo5 guest has no HCI transport -- no serial UART, no raw HCI socket -- so the controller is reached the way slirp reaches the network: over a device. Mirage_eio.Bluetooth.host connects to an H4 controller and drives the I/O-free BLE host over that byte stream, exactly as the same driver would over a UART. HCI H4 is a byte-stream protocol, so nothing about the host changes; only the carrier does. It grants the net device's single manifest entry.

The guest here is a central: it resets the controller, starts scanning, and prints each advertising report the controller delivers -- the discover-nearby- devices half of BLE, from inside a unikernel.

Running it#

dune exec unikernel-bluetooth-controller &
dune exec unikernel-bluetooth -- \
  --ipv4-gateway 10.0.0.1 --controller 127.0.0.1:9700
bluetooth: driving the HCI controller over the network
bluetooth: discovered 00:01:02:03:04:05 (rssi -59 dBm)
bluetooth: discovered AA:BB:CC:DD:EE:FF (rssi -65 dBm)
bluetooth: 2 device(s) discovered

controller/ is the host side: a fake H4 HCI controller that acknowledges the commands and delivers advertising reports for two fixed devices, so discovery is reproducible. Point --controller at a real H4 bridge (a UART-over-TCP proxy, or the Bluetooth_eio_host openers driving a USB dongle) and the same guest scans real air.

Under a tender the controller is reached through the slirp gateway:

mrg build -t solo5 unikernels/bin/iot/bluetooth
mrg run --host-forward 9700:127.0.0.1:9700 \
  unikernels/bin/iot/bluetooth \
  -- --ipv4-gateway 10.0.0.1 --controller 10.0.0.1:9700

Devices#

  • Bluetooth.host "service" -- the BLE host over a controller reached across the net device.