startreksteve
Posts: 44
Joined: Tue Mar 13, 2012 10:23 am

Connecting Bluetooth on Pi W in terminal

Sat Mar 04, 2017 3:49 pm

Hi Guys,
I got my Pi Zero W this week and having great fun with it, as I only ever connect normally with SSH I decided to boot to command line. Im trying to connect to a bluetooth speaker in terminal, but Im struggling. I started X and connected to the speaker no trouble, I was hoping once I'd connected in X it would save the config in a terminal. No suck Luck, I've gone through the whole
sudo bluetoothctrl
Agent on
default-agent
scan on
pair XX:XX:XX:XX:XX:XX
which works, but I dont want to type all this every time I want audio output. Is there a way I can put this into a script and run that?
TIA
Steve

llewmihs
Posts: 3
Joined: Wed Dec 30, 2015 11:17 am

Re: Connecting Bluetooth on Pi W in terminal

Thu Mar 16, 2017 10:43 pm

This has worked for me with a BT keyboard...
As before:

Code: Select all

sudo bluetoothctl
agent on
agent-default
discoverable on
scan on
Put the BT device into pairing mode and then copy the address when you see it.

Code: Select all

pair xx:xx:xx:xx:xx:xx
Then to keep the device in memory:

Code: Select all

trust xx:xx:xx:xx:xx:xx

msoori
Posts: 1
Joined: Mon Nov 12, 2018 8:14 pm

Re: Connecting Bluetooth on Pi W in terminal

Mon Nov 12, 2018 8:17 pm

In my case, it hangs after bring out the waiting message. Doesn't go any further

sudo bluetoothctl
Waiting to connect to bluetoothd...

Return to “Troubleshooting”