I have a Raspberry Pi Zero with a Bluetooth 2.0 dongle in the USB port, since it's Bluetooth 2.0 I can't use Simple Pairing Mode (only available on Bluetooth 2.1+). I'd like to pair my computer with the Raspberry Pi but the computer asks me for a PIN and I don't want to have to interact with the Raspberry.
Since Simple Pairing Mode is not available I thought of using a fixed PIN (like 0000) so that when the computer asks for a PIN I can input 0000 and it will pair the devices. However, I have not found a way to set a fixed PIN.
I've searched on the Internet but I could only found solutions for Bluetooth 2.1+ or using Bluez4 (I'm using Bluez 5.23-2+rpi2).
I've tried downloading simple-agent editing RequestPinCode to return "0000" as I've read somewhere that it would work, but then I run the code with:
python agent.py
And I get an error:
Illegal instruction
I also tried with:
sudo python agent.py
In this case I don't get an error, I get no output whatsoever, the program just exists.
I'm not sure how simple-agent works but I'm pretty sure it's supposed to wait on an infinite loop.
I don't know what I'm doing wrong. All I want is to set a fixed PIN (0000) for the Raspberry PI so that I can introduce that PIN every time a new device wants to connect to the Raspberry PI via Bluetooth. I don't really care how it's done as long as it works.
UPDATE #1: I've tried the answer in this question so I guess I was executing the script the wrong way, so I tried this:
./simple-agent -c NoInputNoOutput
Just like the answer said but it gives an error:
-bash: ./simple-agent: Permission denied
I tried with:
sudo ./simple-agent -c NoInputNoOutput
But then it says:
sudo: ./simple-agent: command not found
UPDATE #2: After giving executing permissions to the simple-agent file I'm getting this error now:
Actually, the ^M character is just a Windows character, I ran dos2unix and now the file should have no weird characters, I tested it again and it gives me the same errors as before (Illegal instruction) even after giving it executing permissions.-bash: ./simple-agent: /usr/bin/python^M: bad interpreter: No such file or directory