NadavRub NadavRub - 3 months ago 14
C++ Question

BlueTooth connection faliure

Environment





  • Ubuntu 16.04

  • Standard USB BlueTooth dongle

  • C++

  • BlueZ

  • Running as root






Problem description




While hcitool & sdptool properly operate, my code fail connecting to SDP with errno == 2 ( ENOENT ), the following is the failing code:

m_pSDPSession = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, SDP_RETRY_IF_BUSY | SDP_WAIT_ON_CLOSE);


Why do I get 'sdp_connect' failing? how can I have that resolved ?

Answer

Edit /usr/lib/systemd/system/bluetooth.service and includ the flag in the ExecStart option.

ExecStart=/usr/libexec/bluetooth/bluetoothd --compat

Then

$ systemctl daemon-reload

$ systemctl restart bluetooth.service