Skip to content

fix(bluetooth): allow custom adapter in connection settings#492

Closed
Biqydu wants to merge 1 commit into
freedesktop-rs:masterfrom
Biqydu:master
Closed

fix(bluetooth): allow custom adapter in connection settings#492
Biqydu wants to merge 1 commit into
freedesktop-rs:masterfrom
Biqydu:master

Conversation

@Biqydu

@Biqydu Biqydu commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Description

Currently, add_and_activate_connection hardcodes hci0 for bluetooth device paths, which causes issues on hosts with multiple bluetooth adapters. This PR updates the logic to read the adapter field from the bluetooth settings section if it is provided.

Closes #481

@cachebag cachebag added bluetooth Bluetooth device/adapter management bug Something isn't working feature New feature or request labels Jul 11, 2026

@cachebag cachebag left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fn bluetooth_section(settings: &BluetoothIdentity) -> HashMap<&'static str, Value<'static>> {

On our bluetooth builders, it still ignores BluetoothIdentity::adapter, so normal builder output cannot exercise the new path anyway.. For instance, a user doing BluetoothIdentity::with_adapter(..., "hci1") then build_bluetooth_connection(...) then add_and_activate_connection(..., None, None) still gets no adapter in the settings map, so this does not really fix the builder workflow.

Perhaps a better approach here that is "non-schema" is probably to derive the BlueZ adapter from the interface argument or resolved NM Bluetooth device when specific_object is None, instead of smuggling adapter through the NM settings dictionary.

Comment on lines +106 to +110
let adapter = section.get("adapter").and_then(|v| match v {
Value::Str(s) => Some(s.to_string()),
_ => None,
});

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no such thing as adapter on NetworkManagers bluetooth setting.

Since the same settings map is passed unchanged into AddAndActivateConnection, callers would need to include a non-NM key in the profile settings to trigger this behavior. That risks NetworkManager rejecting the connection as an invalid/unknown setting.

https://networkmanager.pages.freedesktop.org/NetworkManager/NetworkManager/nm-settings-dbus.html#bluetooth-setting

@Biqydu Biqydu closed this Jul 11, 2026
@Biqydu

Biqydu commented Jul 11, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for the time you spent reviewing my code. I decided to close this PR because completing it properly requires more advanced knowledge of Rust and this system's architecture than I currently have. I wanted to free up the issue so someone else can take it over. Thanks again for your guidance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bluetooth Bluetooth device/adapter management bug Something isn't working feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] add_and_activate_connection hardcodes hci0 for bluetooth paths

2 participants