aboutsummaryrefslogtreecommitdiff
path: root/board/bluetooth.sh
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2022-05-16 15:17:59 +0200
committerSébastien Dailly <sebastien@dailly.me>2022-05-16 15:17:59 +0200
commit6e497c22ea3302994c0a81cf54e67834d8e13d83 (patch)
tree1971215344868318e218c81468a0cff17969d8dc /board/bluetooth.sh
parentcbb58e2287efb5c9c5d6e6eafbe70f329ff16098 (diff)
Moved the configuration in differents files
Diffstat (limited to 'board/bluetooth.sh')
-rw-r--r--board/bluetooth.sh47
1 files changed, 47 insertions, 0 deletions
diff --git a/board/bluetooth.sh b/board/bluetooth.sh
new file mode 100644
index 0000000..e49a345
--- /dev/null
+++ b/board/bluetooth.sh
@@ -0,0 +1,47 @@
+#############################
+# #
+# Bluetooth configuration #
+# #
+#############################
+
+create_missing_dir "/etc/bluetooth/"
+cat << __EOF__ > "${TARGET_DIR}/etc/bluetooth/main.conf"
+[General]
+
+Class = 200428
+DiscoverableTimeout = 0
+PairableTimeout = 0
+
+[Policy]
+AutoEnable=true
+__EOF__
+
+
+cat << __EOF__ > "${TARGET_DIR}/etc/systemd/system/bt-agent.service"
+[Unit]
+Description=Bluetooth Agent
+After=bluetooth.service
+Requires=bluetooth.service
+
+[Service]
+Type=simple
+ExecStartPre=bt-adapter --set Discoverable 1
+ExecStart=bt-agent -c NoInputNoOutput
+RestartSec=5
+Restart=always
+KillSignal=SIGUSR1
+
+[Install]
+WantedBy=bluetooth.target
+__EOF__
+
+# The same for the bluetooth, as bluetoothd keep a track for each paired device
+create_missing_dir "/var/lib/bluetooth/"
+if ! grep -qE '/var/lib/bluetooth' "${TARGET_DIR}/etc/fstab"; then
+ cat << __EOF__ >> "${TARGET_DIR}/etc/fstab"
+tmpfs /var/lib/bluetooth tmpfs rw 0 0
+__EOF__
+fi
+
+
+