0

I am running a sample code on RPI Zero W and it gets to the point where sdp_connect happens. Tried different samples, but they all fail on the same codeline:

session = sdp_connect( BDADDR_ANY, BDADDR_LOCAL, SDP_RETRY_IF_BUSY );

if (!session) {
   printf("sdp_connect failed");
}

Any ideas?

Ingo
  • 42,961
  • 20
  • 87
  • 207
Fkorv
  • 1
  • 1

2 Answers2

1

The issue may be due to the fact that bluetoothd wasn't launched with --compat option.

Take a look at Registering a sdp service with bluez on Fedora 20 for further details.

Feel free to ignore the Fedora environment referenced in the linked answer. Using or not using Fedora is not important. Launching it with --compat or -C will enable the backward compatibility and I expect that sdp_connect() will works. I pasted a link that should provide a more deeply explanation about the issue and how to solve it, in general. The result is to add a simple option to the startup of bluetoothd as I did on my RPi board.

bitfox
  • 111
  • 3
1

You need to run the bluetooth daemon in compatibility mode

  1. Edit this file
/etc/systemd/system/dbus-org.bluez.service
  1. Change this line

ExecStart=/usr/lib/bluetooth/bluetoothd

with this line

ExecStart=/usr/lib/bluetooth/bluetoothd --compat
  1. Restart bluetooth
sudo systemctl daemon-reload
sudo systemctl restart bluetooth

See this link for more details: Failed to connect to SDP server on FF:FF:FF:00:00:00: No such file or directory

leiva
  • 11
  • 1