71 lines
2 KiB
Markdown
71 lines
2 KiB
Markdown
# Bluetooth Serial Console
|
|
|
|
The below information will help you setup bluetooth as a serial console on the Raspberry Pi. This is **WILDLY INSECURE** and should **NEVER** be trusted.
|
|
|
|
This is here for folks who don't want to add a serial adapter to their builds and/or need a quick and dirty way to get into a PiFrame from their phone.
|
|
|
|
**DO NOT USE THIS IF YOU'RE UNSURE OF THE SECURITY IMPLICATIONS**
|
|
|
|
``` sh
|
|
|
|
|
|
https://www.historiantech.com/create-a-bluetooth-wireless-console-server-with-raspberry-pi-zero-w/
|
|
https://www.raspberrypi.org/forums/viewtopic.php?t=272419
|
|
https://www.raspberrypi.org/forums/viewtopic.php?t=170353
|
|
https://play.google.com/store/apps/details?id=de.kai_morich.serial_bluetooth_terminal
|
|
|
|
|
|
apt install pi-bluetooth python-pexpect python-dbus rfkill
|
|
systemctl reboot
|
|
|
|
|
|
echo "PRETTY_HOSTNAME=piframe" > /etc/machine-info
|
|
|
|
|
|
/usr/local/bin/bt-auto-agent
|
|
/usr/local/bin/bluezutils.py
|
|
/usr/local/bin/BtAutoPair.py
|
|
|
|
|
|
sed -i 's/#DiscoverableTimeout = 0/DiscoverableTimeout = 0/g' /etc/bluetooth/main.conf
|
|
|
|
nano -w /usr/local/bin/bt-config.sh
|
|
#!/usr/bin/python2
|
|
import BtAutoPair
|
|
autopair = BtAutoPair.BtAutoPair()
|
|
autopair.enable_pairing()
|
|
|
|
chmod a+x /usr/local/bin/bt-config.sh
|
|
|
|
mkdir /etc/systemd/system/bluetooth.service.d/
|
|
cat > /etc/systemd/system/bluetooth.service.d/piframe.conf <<EOF
|
|
[Service]
|
|
ExecStartPre=/usr/bin/hciconfig hci0 up
|
|
ExecStart=
|
|
ExecStart=/usr/lib/bluetooth/bluetoothd -C
|
|
ExecStartPost=/usr/bin/sdptool add SP
|
|
ExecStartPost=/bin/hciconfig hci0 piscan
|
|
ExecStartPost=/usr/local/bin/bt-config.sh
|
|
EOF
|
|
|
|
cat > /etc/systemd/system/rfcomm.service <<EOF
|
|
[Unit]
|
|
Description=RFCOMM service
|
|
After=bluetooth.service
|
|
Requires=bluetooth.service
|
|
|
|
[Service]
|
|
ExecStart=/usr/bin/rfcomm watch hci0 1 getty rfcomm0 115200 vt100
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
|
|
|
|
systemctl daemon-reload
|
|
systemctl enable --now bluetooth.service
|
|
systemctl restart bluetooth.service
|
|
systemctl enable --now rfcomm
|
|
|
|
```
|