Skip to contentSkip to conversation

BlueZ 5 : Tool recommendation for scripts

DISCUSSION tony 1 participant 1 message Nov 5, 2015 Bluetooth drivers

lore
Share & tools
lore

tony

author
#0 lore raw

Hi All,
What is the recommended BlueZ 5 tool to connect a device from scripts?

'bluetoothctl' is very good in interactive mode. I tried using 'hcitool' + 'simple-agent'. But they do not seem to detect device unless a scan is initiated from 'bluetoothctl' first.

hcitool scan does scan and find devices. But simple-agent returns

Exception: Bluetooth device not found.

bluetoothctl commands which does not take much time could be run from scripts.

eg:
#!/bin/bash
bluetoothctl << EOF
power on
EOF

But starting a scan does not work, because it exits before the scan is complete.

Many Thanks,
Tony