-
Notifications
You must be signed in to change notification settings - Fork 112
Description
(Using bumble==0.0.212)
I have a setup where I'm running a Zephyr native_sim app, which acts as a peripheral device.
This app is invoked to specify the BT device as a virtual TCP server (like --bt-dev=127.0.0.1:9001).
I have a simple Bumble client interacting with this app via this virtual TCP link, like below:
transport = "tcp-server:_:9001"
async with await open_transport_or_link(transport) as (hci_source, hci_sink):
# Create a local link
link = LocalLink()
np_controller = Controller("native_posix_controller", host_source=hci_source, host_sink=hci_sink, link=link)
self.__logger.debug(f"native_posix_controller obj at {np_controller}")
# Create a second controller using the same link
bumble_controller = Controller("bumble_controller", link=link)
bumble_host = Host()
bumble_host.controller = bumble_controller
self.__bumble_device = Device("Bumble", "F0:F1:F2:F3:F4:F5", host=bumble_host)
self.__logger.debug(f"Virtual TCP opened with {hci_source} {hci_sink}")
Now everything I need seems to work fine, scanning, connecting, GATT writes/reads/notifies etc.
When a disconnect to the device is initiated from the bumble client side, ie via something like peer.connection.disconnect() this works fine, and the disconnect callbacks registered via the various methods get called:
new_conn = await bumble_device.connect(
found_device[0].address.to_string(),
connection_parameters_preferences={
HCI_LE_1M_PHY: ConnectionParametersPreferences(supervision_timeout=2400),
HCI_LE_2M_PHY: ConnectionParametersPreferences(supervision_timeout=2400),
},
timeout=20,
)
new_peer = Peer(new_conn)
@new_conn.on("disconnection")
def on_disconnection(reason: int):
print("***********ON DISCONNECTION**********")
# or like this?
new_peer.connection.on("disconnection", on_disconnection)
The issue is when the Zephyr app initiates a disconnect, the same callbacks never seem to fire. I can see the app sending HCI commands on disconnect, like 0x0406 but the Bumble client does not seem to be aware of the disconnect on this end at all.
Furthermore, the HCI debug messages from bumble show that the HCI disconnect message is picked up by the bumble controller, but it doesn't seem to go anywhere after that:
2025-07-03 20:27:22,710 - bumble.controller:268 - DEBUG - <<< [native_posix_controller] HOST -> CONTROLLER: HCI_DISCONNECT_COMMAND:
connection_handle: 0
reason: HCI_REMOTE_USER_TERMINATED_CONNECTION_ERROR
2025-07-03 20:27:22,710 - bumble.controller:312 - DEBUG - >>> [native_posix_controller] CONTROLLER -> HOST: HCI_COMMAND_STATUS_EVENT:
status: PENDING
num_hci_command_packets: 1
command_opcode: HCI_DISCONNECT_COMMAND
... nothing more
Is this not implemented yet, or a bug?