2

To connect to the RPi3 through the Bluetooth Terminal App, I have to run this command first:

sudo rfcomm watch hci0

How to execute this command automatically during startup of the Rpi?

I found this link, Serial Bluetooth Communication

It does help me connect without running the command after reboot. But Once the device is disconnected, I'm not able to reconnect.

2
  • If I understood correctly, you should find some help on the Raspberry Pi forum with this link: Raspberry Pi Forum - Run a command on start up. – Deon Leggett May 30 '19 at 15:17
  • tl;dr; the link you have given. How is that command started at boot up? And why do you can't reconnect? – Ingo May 31 '19 at 18:53
0

edit your /etc/rc.local file and add

sudo rfcomm watch hci0 

if it does not work try putting the command inside a script then make the script executeable. then run the script from rc.local like so...

sudo nano startfile.sh

and put in contents

#!/bin/sh

sudo rfcomm watch hci0 

Press Ctrl+X then Y to save and Enter to exit

then make it executeable

chmod +x startfile.sh

finally in the rc.local just put in the file name

startfile.sh

Should work...little rusty on the details but it goes something like that.

2
  • Please take note that using /etc/rc.local has limitations due to Compatibility with SysV. We have seen many problems here on this site using it. Following the recommendation of the developers from systemd you should avoid using it. – Ingo May 31 '19 at 18:49
  • adding sudo rfcomm watch hci0 & to /etc/rc.local file worked just fine! 👍 – Santhosh Dhaipule Chandrakanth Jun 2 '19 at 14:34

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.