sshbluetoothraspberry-pi3pairing

How to automatically accept bluetooth pair request without popping confirmation dialogue box in raspberry pi through terminal or through SSH


I need to accept the bluetooth pair request in raspberry pi without manual confirmation. My task is to send a pair request from Android phone to raspberry pi 3 and to automatically accept the pair request based on MAC address of mobile, But it asking manual confirmation in raspberry pi, how can i automatically accept the request,

when i pass the below commands .bluetoothctl .power on .discoverable on and made a request from Android device, manual confirmation is asking for authentication

how to achieve this, without manual confirmation


Solution

  • As ukBaz suggested, you can do this by setting your IO capabilities to NoInputNoOutput.I would recommend sending the following sequence of commands to achieve this:-

    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
    

    You can then set this with bluetoothctl as well via the following commands:-

    bluetoothctl --agent NoInputNoOutput
    

    Have a look at the links below for more info:-