Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bluetoothctl to hcitool equivalent commands

In Linux I used to use "hidd --connect mmac" to connect with BT devices but that is now gone since Bluez5. I can use bluetoothctl to make the connection manually but I need to use these commands from my app and using bluetoothctl would be difficult.

What are the hcitool equivalent commands to do what bluetoothctl does?

For example, I would type in bluetoothctl:

select <cmac>
scan on
trust <mmac>
pairable on
pair <mmac>
connect <mmac>

I can use "hcitool scan" for the scanning but I haven't figured out connecting. I've tried using "hcitool cc mmac" followed by "hcitool auth mmac" but nothing works.

Or can hcitool do what bluetoothctl does?

like image 849
Peter Quiring Avatar asked Feb 18 '14 16:02

Peter Quiring


1 Answers

I am using bluetoothctl from scripts like this:

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

And it is possible to specify multiple commands as one command per line.

Strangely enough, it does not work like this for me:

echo "power on" | bluetoothctl

(I am using bluez-5.21-r1 - not sure whether this is version dependent)

like image 55
Jiri Avatar answered Oct 12 '22 20:10

Jiri