RPI: Headless BT

From Frotmail Projects
Jump to navigation Jump to search

Prepare bluetooth service

sudo joe /lib/systemd/system/bluetooth.service
ExecStart=/usr/lib/bluetooth/bluetoothd -C 
ExecStartPost=/usr/bin/sdptool add SP 
ExecStartPost=/bin/hciconfig hci0 piscan 

Reboot PI

Prepare new rfcomm service

sudo joe /etc/systemd/system/rfcomm.service
[Unit]
Description=RFCOMM service
After=bluetooth.service
Requires=bluetooth.service
 
[Service]
ExecStart=/usr/bin/rfcomm watch hci0 1 getty rfcomm0 115200 vt100 -a pi
 
[Install]
WantedBy=multi-user.target

Start new service:

sudo systemctl enable rfcomm
sudo systemctl start rfcomm

Pair device with laptop

$ sudo bluetoothctl
[bluetooth]# discoverable on

Pair device

[bluetooth]# discoverable off

On laptop:

sudo screen /dev/rfcomm0
  • presto*