From f4db37bf88ad74d31e4950df8a21cd4e1d4f2200 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Tue, 3 Jul 2018 11:00:00 +0200 Subject: [PATCH] Support new way of read serial number from SoC (#341) * Support new way of read serial number from SoC * Update config.json * Update CHANGELOG.md * Update run.sh * Update run.sh --- bluetooth_bcm43xx/CHANGELOG.md | 3 +++ bluetooth_bcm43xx/config.json | 5 +++-- bluetooth_bcm43xx/run.sh | 9 ++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/bluetooth_bcm43xx/CHANGELOG.md b/bluetooth_bcm43xx/CHANGELOG.md index 14f5c39..8e66aa4 100644 --- a/bluetooth_bcm43xx/CHANGELOG.md +++ b/bluetooth_bcm43xx/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 2.1 +- Support new way to read `serial-number` from device-tree + ## 2.0 - Update Firmware blobs diff --git a/bluetooth_bcm43xx/config.json b/bluetooth_bcm43xx/config.json index 6b47bc6..df9dc0a 100644 --- a/bluetooth_bcm43xx/config.json +++ b/bluetooth_bcm43xx/config.json @@ -1,12 +1,13 @@ { "name": "Bluetooth BCM43xx", - "version": "2.0", + "version": "2.1", "slug": "bluetooth_bcm43xx", "description": "Activate Bluetooth for Broadcom 43xx chips", "url": "https://home-assistant.io/addons/bluetooth_bcm43xx/", "startup": "initialize", "boot": "auto", - "host_network": "true", + "host_network": true, + "devicetree": true, "privileged": ["NET_ADMIN"], "devices": ["/dev/ttyAMA0:/dev/ttyAMA0:rwm"], "options": {}, diff --git a/bluetooth_bcm43xx/run.sh b/bluetooth_bcm43xx/run.sh index af65631..944597b 100644 --- a/bluetooth_bcm43xx/run.sh +++ b/bluetooth_bcm43xx/run.sh @@ -1,7 +1,14 @@ #!/bin/bash set -e -SERIAL="$(grep Serial /proc/cpuinfo | cut -c19-)" +# Read serial number +if [ -e /proc/device-tree/serial-number ]; then + SERIAL="$(cut -c9- /proc/device-tree/serial-number)" +else + SERIAL="$(grep Serial /proc/cpuinfo | cut -c19-)" +fi + +# Generate MAC B1="$(echo "$SERIAL" | cut -c3-4)" B2="$(echo "$SERIAL" | cut -c5-6)" B3="$(echo "$SERIAL" | cut -c7-8)"