実際のところ
前提
前回の記事の内容を実行している。
自動起動するようにする
"/etc/systemd/system/dbus-org.bluez.service"を更に編集
前回追加したExecStartの下に、”ExecStartPost=/usr/bin/sdptool add --channel=22 SP”とsdpの起動を追加
[Unit] Description=Bluetooth service Documentation=man:bluetoothd(8) ConditionPathIsDirectory=/sys/class/bluetooth [Service] Type=dbus BusName=org.bluez ExecStart=/usr/lib/bluetooth/bluetoothd ExecStartPost=/usr/bin/sdptool add --channel=22 SP ...
更に"/etc/systemd/system/rfcomm.service"を以下のような内容で新規作成。
[Unit] Description=RFCOMM service After=bluetooth.service Requires=bluetooth.service [Service] ExecStart=/usr/bin/rfcomm watch 0 22 /sbin/agetty rfcomm0 115200 linux [Install] WantedBy=multi-user.target
再起動&新しいサービスを有効化
$ sudo systemctl daemon-reload $ sudo systemctl restart bluetooth $ sudo systemctl enable rfcomm $ sudo systemctl start rfcomm
一応念のため再起動
$ sudo reboot