Ubuntu – Bluetooth pairing on the command line in Ubuntu 11.10

bluetoothcommand linepinubuntu 11.10

I'm using Ubuntu 11.10 and try to connect to a Bluetooth device from the command line but I always need to enter the PIN in a graphical dialog box. The commands I use:

root@ubuntu:~# hcitool scan
Scanning ...
00:00:00:00:00:00   device
root@ubuntu:~# rfcomm connect 0 00:00:00:00:00:00 1

And after this, the enter PIN dialog appears.

Is there any way to keep the interaction in the command line? In my environment it is not allowed to use GUIs or require the user to enter PINs. Btw, the PIN is always the same but the MAC will change from time to time.

Best Answer

What you are looking for is a bluetooth agent, which validates the PIN. You'll find a very straightforward one at here, written in python. You just have to change the end of RequestPinCode to 'return "0000"' for instance.

Related Question