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?

  • You have to enable bluetooth. – Ingo Jan 8 at 9:21
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

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.

  • Does the OP use Fedora 20 on his Raspberry Pi? You should explain more details if it also fit to a RasPi. – Ingo Feb 3 at 13:05
  • @Ingo apologize me if I was too much short in my answer, but, I think that using or not using Fedora is not important here. The issue was related to bluetoothd daemon that wasn't launched with --compat option. Launching it with --compat or -C will enable the backward compatibility and I expect that sdp_connect() will works. Further, I pasted a link that should provide a more deeply explanation about the issue and how to solve it, in general. Of course, I expect that the end user is able to add a simple option to the startup of bluetoothd in the raspberry pi as I did on my RPi board. – bitfox Feb 4 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.