Hi I'm writing about the hcitool enc <bdaddr>
behavior.
As described in the thread, I'm dealing with the Bluetooth stuff. I'm using the Bluez 5.4x C API.
At the moment, I'm able to scan and open a connection with a BLE device either using the command line or my C code.
To do this I'm working with the HCI API, so after:
id = hci_get_route(NULL);
dd = hci_open_dev(id);
hci_le_set_scan_enable();
hci_le_create_conn();
I achieve a connection handle = 71. At this point, I'd like to encrypt the link using the C equivalent for the hcitool enc functionality in C. However, I can't do this.
Once, the connection is established I check for the available connection using:
hcitool con
that returns:
< LE <bdaddr> handle 71 state 7 lm MASTER
so I suppose that my C code works, at least up to this point.
If I try to encrypt the link invoking the hci_encrypt_link()
function the system fails and returns:
Get connection info failed: No such file or directory
To test if the behavior is correct, I tried to execute the same operational flow from the command line executing:
sudo hcitool lescan
sudo hcitool lecc --random <bdaddr> - return: connection handle 71
sudo hcitool enc <bdaddr> - return: Not connected
Can anyone help me to identify the solution?