RPi Bluetooth Keyboard Auto-Reconnect

There was a small issue about my Bluetooth keyboard not reconnecting with RPi restarts. I created a startup script to ensure it reconnects before boot-up.

First, make the startup script.

nano /home/pi/.BTKB.sh

Then type this into the file.

#!/bin/bash

address=”AA:BB:CC:DD:EE:FF”

bluez-simple-agent hci0 ${address}
bluez-test-device trusted ${address} yes
bluez-test-input connect ${address}

Exit and save. Then create the startup file.

sudo nano /etc/init.d/startBTKB

Enter the following into the startup file.

#!/bin/sh

/home/pi/.BTKB.sh &

exit 0

Then set the permissions to both files to be executable by the terminal.

sudo chmod +x /etc/init.d/startBTKB
sudo chmod +x /home/pi/.BTKB.sh
sudo update-rc.d startBTKB defaults

Restart and you’re good to go. I combined the commands from the following links, but one used a deprecated command. It’s working so far, but I’ll edit this post if anything changes.

link1 link2

Advertisements
About

Christian. Audio. Technology. Go-Getter. Concise.

Tagged with:
Posted in Hacks, Technology

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s