Add bluetooth agent

Signed-off-by: Hadi <[email protected]>
This commit is contained in:
Hadi
2026-08-13 23:00:59 +02:00
parent 0f7738be68
commit 7f75c7b6c0
5 changed files with 99 additions and 74 deletions
+6 -3
View File
@@ -185,10 +185,13 @@ func Scan(seconds int) error {
return err
}
// Pair initiates pairing with a device. Because non-interactive
// bluetoothctl has no agent to answer PIN/confirmation prompts, this only
// succeeds for "just works" devices (most mice, keyboards, headsets).
// Pair initiates pairing with a device, first registering settuings as
// BlueZ's default agent so devices that need PIN/passkey confirmation
// (not just "just works" ones) can complete pairing.
func Pair(address string) error {
if err := ensureAgent(); err != nil {
return err
}
_, err := run(actionTimeout, "pair", address)
return err
}