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
This commit is contained in:
Pascal Vizeli
2018-07-03 11:00:00 +02:00
committed by GitHub
parent 0d059b3e06
commit f4db37bf88
3 changed files with 14 additions and 3 deletions

View File

@@ -1,5 +1,8 @@
# Changelog
## 2.1
- Support new way to read `serial-number` from device-tree
## 2.0
- Update Firmware blobs

View File

@@ -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": {},

View File

@@ -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)"