Search code examples
raspberry-pibluetoothdbusbluezbluetooth-gatt

Raspberry Pi Bluetooth: Enable legacy pairing / connection without PIN input


For a few days I'm desperately trying to configure Bluetooth legacy pairing on my Raspberry Pi. Unfortunately I hadn't had any success until today. I tried countless tutorials/posts on several forums but no one worked.

Can anyone give me an up to date method that worked in your case? I noticed that almost all posts about this topic are at least 2 years old, which doesn't make it easier to get to a solution.

Thanks in advance.


Solution

  • Assuming you want to do this from the command line, all you need to do is launch bluetoothctl with no input/no output capabilities. See below the recommended sequence of commands:-

    sudo btmgmt power off
    sudo btmgmt discov on
    sudo btmgmt connectable on
    sudo btmgmt pairable on
    sudo btmgmt power on
    sudo btmgmt io-cap 3
    

    The last command sets your IO capabilities to NoInputNoOutput, and the numberical values correspond to the following:-

    0       DisplayOnly
    1       DisplayYesNo
    2       KeyboardOnly
    3       NoInputNoOutput
    4       KeyboardDisplay
    

    Finally, launch bluetoothctl as follows:-

    bluetoothctl --agent NoInputNoOutput
    

    Some references:-