0

I am trying to connect raspberry pi to my galaxy note to use it for serial communication. I have somewhat succeeded at that.

First I paired it and trusted through bluetoothctl. Then I run sudo rfcomm watch hci0 and opened with cat /dev/rfcomm. I was able to connect to raspberry pi using bluetooth terminal (only this app, every other one failed) and strings sent from galaxy would be shown in the cat window.

I have somehow messed up later and now running sudo rfcomm watch hci0 gives me Can't bind RFCOMM socket: Address already in use. I can't release it with sudo rfcomm release hci0 or sudo rfcomm release 0 as it then gives me Can't release device: No such device. Likewise cat /dev/rfcomm0 too now gives me No such file or directory.

I killed the process listed with sudo lsof | grep /dev/rfcomm0, this had no effect on my ability to use RFCOMM. Reloading with systemctl daemon-reload and restarting with service bluetooth restart too has had no effect.

I can still scan for other bluetooth devices, and I can connect to raspberry pi with bluetooth terminal, but it seems rfcomm is gone. I am aware that rebooting can solve this, though I would like to do that programatically if possible without having to resort to power-cycling.

I have seen similar issue pop up on this stack, but have not found an answer that would solve this issue.

Thanks for your help.

1

rfcomm is one of the tools that has been deprecated by the BlueZ team as working at that low level can lead to unpleasant things happening on the system because those tools by passed the the bluetooth daemon that is running. There are higher levels of API available to use that go through tbe Bluetooth daemon.

A couple of Python examples of how to create an rfcomm (Serial Port Profile) server are:

http://blog.kevindoran.co/bluetooth-programming-with-python-3/

https://bluedot.readthedocs.io/en/latest/btcommapi.html#bluetoothserver

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.