This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to use nRF51-ble-app-uart-static-passkey with linux

Hi

I would like to develop an application for the nrf51822 with a static passkey that connects with linux. The example "nRF51-ble-app-uart-static-passkey" gives a great template for that. However, I couldn't get it to run with linux and its bluez toolchain.

The example sets the read and write permissions of a characteristic to BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM. When I use my android devices to write to the characteristic, android asks me to enter the (static) pin. After that the write passes. That is what I would expect.

With linux however, using the gatttool does not work. When I try to access the protected characteristic, I get a message "Attribute requires authentication before read/write". The same is true if I increase the "sec-level".

So my question is: How do I authenticate my read/write using the bluez toolchain? The use of tests/simple-agent was unsuccessful as it is never triggered for a passkey entry...

Thank you in advance for any hints on that problem.

  • Try to remove the pairing info first (you may need to apt-get install bluez-tools):

    bt-device -r <DEVICE_ADDR>
    

    Start bluez-simple-agent in another terminal window. It should respond with "Agent registered". Leave it.

    bluez-simple-agent
    

    Start gatttool:

    sudo gatttool -b <DEVICE_ADDR> -t random -I
    

    In gatttool set high security level:

    sec-level high
    

    Connect:

    connect
    

    Now simple-agent should ask for a passkey in the other terminal window.

Related