# Bluetooth: command-line equivalent to bluetoothctl commands?

## fdelente

Hello,

Thanks to the push to bluez-5 and pulseaudio 4.99, I can now again use my bluetooth headset with my gentoo.

To connect the headset, I have to start bluetoothctl in a terminal, and the connect to the device with its MAC address.

Since bluetoothctl only works in interactive mode, I can't script it to automatically connect with the push of a button (e.g. in a GTK GUI).

I have search info on how to do it but can't find anything, the doc. included with bluez is very dry and I find it hard to find any info on Bluetooth in general.

Does something like sdptool, or rfcomm, can establish the connection to the headset? I read the manpages but they don't seem to mention the fact.

Thanks for any help.

----------

## ferg

I have a similar problem. I have a Gentoo box that runs as a HTPC (running Mythfrontend and XBMC).

It uses an Apple bluetooth keyboard. This has worked fine for quite a few years now.

Recently after a power cut the keyboard stopped working. The only way to get it back is to start Bluetoothctl and run

```
power on
```

Then the keyboard works fine.

Of course since I need to use SSH to get to the HTPC to do that it makes for a poor televisual experience for anybody who does not know what ssh is!

I cannot even remember how I setup this keyboard (that's the trouble about stuff that works. When i does not you don;t know when/why it went bad!  :Smile: 

Any pointers please?

Thanks!

----------

