After using my trusted raspberry pi for a little over 2 years, I was in need of an upgrade. In the beginning my goal was just to make a home firewall/server using PFsense, but then I added an extra requirement, it had to use as little energy as possible. My top priority was getting a system that…
Installing Bluetooth on PwnPi
First I need to install all the Bluetooth management tools. Luckily I had a project in my last education where Bluetooth on a Raspberry was needed. The system at that time was Rasbian, but since PwnPi uses the same repository as Rasbian (Debian) the commands works just as well.
Installing Bluetooth on PwnPi :
apt-get install -y bluetooth bluez-utils blueman python-gobject python-dbus
This will install all the necessary drivers and tools to use Bluetooth on a Raspberry. The “-y” command is there just to make it easier, it will automatically say “yes” to any prompts there might be. If you want to see everything, leave it out and the program will install with your input.
Next up we need to use a tool from the bluez package. This is called hcitool and contains a lot of helpful programs that we need to use in order to pair our android device to the Raspberry pi.
First up we need to see if the device is present and working properly. This is done by using the command
This shows the MAC address of my Bluetooth device connect to my Pi. Now we need to do a scan to see if the two devices can see each other. There we go, now we have a working set of Bluetooth devices, all there is left to do in this post is to pair them up. This process can either be done with the GUI or via the terminal interface. I choose to show the command line method.
Moving on to the pairing part. We need to know my phones MAC address. For this we issue the command hcitool again.
This will generate a something simiar to this
Apparently I also caught my neighbors TV remote, but no matter. The MAC of my phone is “CC:F9:E8:E2:20:36” . This will be needed to pair and trust the device.
Now I should be able to pair my device with the Raspberry, but I wasn’t that lucky. I ran into a problem with the error code
Creating device failed: org.bluez.Error.AuthenticationRejected: Authentication Rejected
Luckily I found the blog Correlatedcontent detailing with this problem, and the solution was simple enough.
Here you should look for a word called KeyboardDisplay, its almost at the bottom of the file. This should be changed to DisplayYesNo as I’ve shown in the picture below:
Now lets save the file and get ready to pair the devices one more time.
Now my Raspberry is paired with my Samsung, now to the fun part!