From f306747c60861799bf2ebb1a8b3647b45b3481ef Mon Sep 17 00:00:00 2001 From: Wootak Jung Date: Wed, 10 Apr 2019 10:21:21 +0900 Subject: [PATCH] Modify BT MAC address generating logic Modify BT MAC address generating logic to keep the address after image flashing. Change-Id: Ib37e508430bd529483453db17a1316f08f624bc8 --- scripts/bt-dev-start-rpi3.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/bt-dev-start-rpi3.sh b/scripts/bt-dev-start-rpi3.sh index ee8454b..0d32e8c 100644 --- a/scripts/bt-dev-start-rpi3.sh +++ b/scripts/bt-dev-start-rpi3.sh @@ -18,11 +18,16 @@ then fi GEN_BDADDR(){ - echo "BT Mac addr generates randomly." - MAC_PRE=$(echo "00:02:") - MAC_POST=$(/usr/bin/openssl rand -hex 4 | sed 's/\(..\)/\1:/g; s/.$//') - echo "Random : $MAC_PRE$MAC_POST" - BT_MAC=$MAC_PRE$MAC_POST + #echo "BT Mac addr generates randomly." + #MAC_PRE=$(echo "00:02:") + #MAC_POST=$(/usr/bin/openssl rand -hex 4 | sed 's/\(..\)/\1:/g; s/.$//') + #BT_MAC=$MAC_PRE$MAC_POST + echo "Generates BT MAC address based on serial number." + SERIAL=`cat /proc/device-tree/serial-number | cut -c9-` + B1=`echo $SERIAL | cut -c3-4` + B2=`echo $SERIAL | cut -c5-6` + B3=`echo $SERIAL | cut -c7-8` + BT_MAC=`printf b8:27:eb:%02x:%02x:%02x $((0x$B1 ^ 0xaa)) $((0x$B2 ^ 0xaa)) $((0x$B3 ^ 0xaa))` } if [ ! -e "$BT_MAC_FILE" ] -- 2.7.4