Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mariotpc/5184a122c73c10dc8c6bae0e5fa6fc50 to your computer and use it in GitHub Desktop.
Save mariotpc/5184a122c73c10dc8c6bae0e5fa6fc50 to your computer and use it in GitHub Desktop.
create a connection between serial console and bluetooth serial port
first all the bluez apps must be updated
root@raspberrypi:/home/pi# vi /etc/systemd/system/dbus-org.bluez.service
add:
[Unit]
Description=Bluetooth service
Documentation=man:bluetoothd(8)
ConditionPathIsDirectory=/sys/class/bluetooth
[Service]
Type=dbus
BusName=org.bluez
ExecStart=/usr/lib/bluetooth/bluetoothd -C --noplugin=sap
ExecStartPost=/usr/bin/sdptool add SP
NotifyAccess=main
#WatchdogSec=10
#Restart=on-failure
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
LimitNPROC=1
ProtectHome=true
ProtectSystem=full
[Install]
WantedBy=bluetooth.target
Alias=dbus-org.bluez.service
the entry: --noplugin=sap was util to me, because i was getting an error on
Nov 11 09:41:40 530uarch bluetoothd[1495]: Starting SDP server
Nov 11 09:41:40 530uarch bluetoothd[1495]: Bluetooth management interface 1.7 initialized
Nov 11 09:41:40 530uarch bluetoothd[1495]: Sap driver initialization failed.
Nov 11 09:41:40 530uarch bluetoothd[1495]: sap-server: Operation not permitted (1)
sudo apt-get install bluez
root@raspberrypi:/home/pi# sudo hciconfig
hci0: Type: Primary Bus: USB
BD Address: 00:11:67:60:A9:1C ACL MTU: 678:8 SCO MTU: 48:10
UP RUNNING PSCAN
RX bytes:18061 acl:338 sco:0 events:1533 errors:0
TX bytes:57330 acl:1328 sco:0 commands:121 errors:0
pi@raspberrypi:~ $ sudo bluetoothctl
[NEW] Controller 00:15:83:0C:BF:EB raspberrypi [default]
[NEW] Device 14:1A:A3:D4:5D:73 XT1039
[bluetooth]# power on
[bluetooth]# pair 14:1A:A3:D4:5D:73
pi@raspberrypi:~ $ sdptool add --channel=1 SP
Start serial port service on RPI
The Bluetooth serial port (SP) service is handled by “rfcomm”. It starts a terminal with”agettty” and shows a login screen when a bluetooth connection is made to channel 1. The “rfcomm” needs to be running for a connection to work. I have used the “screen” command to keep the process alive in the background in a virtual terminal.
1
2
screen sudo rfcomm watch /dev/rfcomm0 1 /sbin/agetty rfcomm0 linux 115200
Waiting for connection on channel 1
install blueterm app on your android
Credits comes from:
https://hobbylad.wordpress.com/2016/10/13/rpi-control-over-bt-android/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment