summaryrefslogtreecommitdiff
path: root/recipes-connectivity/bluez/bluez5/BT-Name
blob: 25c2d9f32ea34888b2577ca2e1a62ceee6092b29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
diff -Naru orig/etc/init.d/bluetooth new/etc/init.d/bluetooth
--- orig/etc/init.d/bluetooth	2020-06-12 13:14:37.000000000 -0500
+++ new/etc/init.d/bluetooth	2020-06-29 14:53:56.824235818 -0500
@@ -16,6 +16,9 @@
 # FIXME: any of the sourced files may fail if/with syntax errors
 test -f /etc/default/bluetooth && . /etc/default/bluetooth
 test -f /etc/default/rcS && . /etc/default/rcS
+DEVID=$(mts-io-sysfs show device-id)
+HOSTNAME=$(uname -n)
+NAME="${HOSTNAME}-${DEVID}"
 
 set -e
 
@@ -28,6 +31,9 @@
 		exit 0
 	fi
 
+        if ! grep -q "^Name = ${NAME}$" /etc/bluetooth/main.conf ; then
+	    sed -i "s/^Name = .*/Name = ${NAME}/" /etc/bluetooth/main.conf
+        fi
 	start-stop-daemon --start --background $SSD_OPTIONS $MOREOPTIONS
 	sleep 1
         if [[ -n ${BLUETOOTHCTL_CMD} ]] ; then