diff --git a/roles/bluetooth/README.rst b/roles/bluetooth/README.rst index 5b4f460a5..357e0ee4c 100644 --- a/roles/bluetooth/README.rst +++ b/roles/bluetooth/README.rst @@ -4,6 +4,8 @@ Bluetooth README This role provides two services, pan or Personal Area Network, and term, terminal emulation. +The terminal operates at 115200 bps. + They may be turned on or off with iiab-bt-pan-on(off) and iiab-bt-term-on(off), respectively. The role is only available for the Raspberry Pi. diff --git a/roles/bluetooth/tasks/main.yml b/roles/bluetooth/tasks/main.yml index 48de6a784..421b9c63e 100644 --- a/roles/bluetooth/tasks/main.yml +++ b/roles/bluetooth/tasks/main.yml @@ -1,4 +1,4 @@ # This is rpi only -- include_tasks: rpi_bluetooth_install.yml - when: is_rpi | bool +- include_tasks: rpi_install.yml + when: is_rpi and bluetooth_install diff --git a/roles/bluetooth/tasks/rpi_install.yml b/roles/bluetooth/tasks/rpi_install.yml index 8ebe3881b..4590e4549 100644 --- a/roles/bluetooth/tasks/rpi_install.yml +++ b/roles/bluetooth/tasks/rpi_install.yml @@ -25,6 +25,13 @@ - { src: 'iiab-bt-term-on.j2', dest: '/usr/bin/iiab-bt-term-on' } - { src: 'iiab-bt-term-off.j2', dest: '/usr/bin/iiab-bt-term-off' } +# Bluetooth service needs /usr/lib/bluetooth/bluetoothd -C --noplugin=sap +- name: Add -C --noplugin=sap to execStart of bluetooth service + lineinfile: + path: /lib/systemd/system/bluetooth.service + regexp: '^ExecStart=/usr/lib/bluetooth/bluetoothd' + line: 'ExecStart=/usr/lib/bluetooth/bluetoothd -C --noplugin=sap' + # enable or disable bt-agent - name: Enable & Restart 'bt-agent' service systemd: diff --git a/roles/bluetooth/templates/bt-term.service.j2 b/roles/bluetooth/templates/bt-term.service.j2 index 66f9377dc..a0efc270d 100644 --- a/roles/bluetooth/templates/bt-term.service.j2 +++ b/roles/bluetooth/templates/bt-term.service.j2 @@ -4,9 +4,8 @@ After=bluetooth.service Requires=bluetooth.service [Service] -Type=oneshot -ExecStart=/usr/bin/sdptool add SP -ExecStartPost=/bin/hciconfig hci0 piscan +ExecStartPre=/usr/bin/sdptool add SP +ExecStartPre=/bin/hciconfig hci0 piscan ExecStart=/usr/bin/rfcomm watch hci0 1 getty rfcomm0 115200 vt100 [Install]