Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bluetooth.btcommon.BluetoothError: (2, 'No such file or directory')

Tags:

bluetooth

I'm simply trying to run the RFCOMM server example at https://code.google.com/p/pybluez/source/browse/trunk/examples/simple/rfcomm-server.py

$ python2 rfcomm-server.py
Traceback (most recent call last):
  File "rfcomm-server.py", line 20, in <module>
    profiles = [ SERIAL_PORT_PROFILE ],
  File "/usr/lib/python2.7/site-packages/bluetooth/bluez.py", line 176, in advertise_service
    raise BluetoothError (str (e))
bluetooth.btcommon.BluetoothError: (2, 'No such file or directory')

I am getting this error. My code is working on windows but I could not work Ubuntu 15.10.

like image 968
Gulcan Ulke Avatar asked Apr 17 '16 11:04

Gulcan Ulke


1 Answers

I had the same problem on Raspbian, and solved by:

  • Running bluetooth in compatibility mode,

    by modifying /etc/systemd/system/dbus-org.bluez.service,

    changing

    ExecStart=/usr/lib/bluetooth/bluetoothd

    into

    ExecStart=/usr/lib/bluetooth/bluetoothd -C

  • Then adding the Serial Port Profile, executing: sudo sdptool add SP

References:

  • https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=133263

  • https://github.com/karulis/pybluez/issues/161

  • https://raspberrypi.stackexchange.com/questions/41776/failed-to-connect-to-sdp-server-on-ffffff000000-no-such-file-or-directory

like image 81
GozzoMan Avatar answered Sep 28 '22 19:09

GozzoMan