(I currently use usb-serial cables for this, but my students keep breaking them

Thanks in advance for any pointers to achieving this,
-Duncan.
Start by adding the Serial Port Profile. Edit this file:Duncan_Rowland wrote:>Yes, I think that's exactly what I'd like to do
Code: Select all
sudo nano /etc/systemd/system/dbus-org.bluez.service
Code: Select all
ExecStart=/usr/lib/bluetooth/bluetoothd -C
ExecStartPost=/usr/bin/sdptool add SP
Code: Select all
sudo rfcomm watch hci0 1 getty rfcomm0 115200 vt100 -a pi
Code: Select all
$ bluetoothctl
[bluetooth]# discoverable on
[bluetooth]# quit
Code: Select all
sudo rfcomm watch hci0 1 getty rfcomm0 115200 vt100 -a pi
Code: Select all
screen /dev/cu.raspberrypi-SerialPort 115200
Code: Select all
sudo nano /etc/systemd/system/rfcomm.service
Code: Select all
[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
Code: Select all
sudo systemctl enable rfcomm
Code: Select all
sudo systemctl start rfcomm
Yes, I find the same thing, but it only hogs the CPU while a terminal is connected. After disconnect, everything is back to normal.wei wrote:Thanks guys, your solution works for me, but there is a problem I found that the rfcomm service would keep hogging the CPU of about 35%.
Any solutions to this?
I encountered this as well (only when connected).hogs the CPU while a terminal is connected
Code: Select all
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2042 root 20 0 2036 452 384 S 33.3 0.1 21:19.97 rfcomm
2415 root 20 0 5112 2424 2020 R 1.0 0.3 0:00.07 top
1 root 20 0 22788 3908 2740 S 0.0 0.5 0:06.91 systemd
Code: Select all
ppoll([{fd=6, events=POLLERR|POLLHUP}], 1, {0, 200}, ~[HUP INT PIPE TERM CHLD RTMIN RT_1], 8) = 0 (Timeout)
wait4(-1, 0x7ebf245c, WNOHANG, NULL) = 0
ppoll([{fd=6, events=POLLERR|POLLHUP}], 1, {0, 200}, ~[HUP INT PIPE TERM CHLD RTMIN RT_1], 8) = 0 (Timeout)
wait4(-1, 0x7ebf245c, WNOHANG, NULL) = 0
ppoll([{fd=6, events=POLLERR|POLLHUP}], 1, {0, 200}, ~[HUP INT PIPE TERM CHLD RTMIN RT_1], 8) = 0 (Timeout)
wait4(-1, 0x7ebf245c, WNOHANG, NULL) = 0
ppoll([{fd=6, events=POLLERR|POLLHUP}], 1, {0, 200}, ~[HUP INT PIPE TERM CHLD RTMIN RT_1], 8) = 0 (Timeout)
wait4(-1, 0x7ebf245c, WNOHANG, NULL) = 0
ppoll([{fd=6, events=POLLERR|POLLHUP}], 1, {0, 200}, ~[HUP INT PIPE TERM CHLD RTMIN RT_1], 8) = 0 (Timeout)
wait4(-1, 0x7ebf245c, WNOHANG, NULL) = 0
Code: Select all
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
17981 pi 20 0 5276 2568 2092 R 1.0 0.3 0:00.35 top
2015 pi 20 0 12000 3896 2868 S 0.3 0.5 0:03.24 sshd
13648 root 20 0 0 0 0 S 0.3 0.0 0:00.35 kworker/3:0
17798 root 20 0 0 0 0 S 0.3 0.0 0:00.13 kworker/u8+
17957 root 20 0 1860 348 292 S 0.3 0.0 0:00.02 rfcomm
I have, it works there too.
Code: Select all
~# cat /etc/systemd/system/multi-user.target.wants/rfcomm.service
[Unit]
Description=RFCOMM service
After=bluetooth.service
Requires=bluetooth.service
[Service]
ExecStart=/usr/bin/rfcomm watch hci0 1 getty rfcomm0 115200 linux
[Install]
WantedBy=multi-user.target
Code: Select all
ExecStart=/usr/lib/bluetooth/bluetoothd -C
ExecStartPost=/usr/bin/sdptool add SP
ExecStartPost=/bin/hciconfig hci0 piscan
Code: Select all
[Unit]
Description=RFCOMM service
After=bluetooth.service
Requires=bluetooth.service
[Service]
# ExecStart=/usr/bin/rfcomm watch hci0 1 getty rfcomm0 115200 vt100 -a pi
# ExecStart=/usr/bin/rfcomm watch hci0 1 setsid /sbin/agetty -L rfcomm0 115200 vt100 -a pi
ExecStart=/usr/bin/rfcomm watch hci0 1 setsid /sbin/agetty -L rfcomm0 115200 vt100 -a pi
[Install]
WantedBy=multi-user.target
Douglas6 wrote: ↑Sun Apr 17, 2016 11:04 pmStart by adding the Serial Port Profile. Edit this file:Duncan_Rowland wrote:>Yes, I think that's exactly what I'd like to doAdd a ' -C' compataibility flag at the end off the ExecStart= line, and add a new line to add the SP profile. The two lines should look like this:Code: Select all
sudo nano /etc/systemd/system/dbus-org.bluez.service
Save the file and reboot. Now enter this line in a terminal:Code: Select all
ExecStart=/usr/lib/bluetooth/bluetoothd -C ExecStartPost=/usr/bin/sdptool add SP
You should be able to connect with a Bluetooth serial terminal, and get a command prompt (auto-logged in as pi). If that works for you, we can automate the rfcomm command at boot.Code: Select all
sudo rfcomm watch hci0 1 getty rfcomm0 115200 vt100 -a pi