meta-digi: Use proc device tree information for hwid information.
Modify the atheros and bluetooth init scripts to fetch the hwid details from the device tree. https://jira.digi.com/browse/DEL-572 Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
This commit is contained in:
parent
903a7f5cc2
commit
4e76f14e42
|
|
@ -53,22 +53,26 @@ if ! cmp -s ${RAM_DRIVE}/${MAC_FILENAME} ${FIRMWARE_DIR}/${MAC_FILENAME}; then
|
||||||
fi
|
fi
|
||||||
rm -f ${RAM_DRIVE}/${MAC_FILENAME}
|
rm -f ${RAM_DRIVE}/${MAC_FILENAME}
|
||||||
|
|
||||||
BDATA_SOURCE="Digi_6203-6233-World.bin"
|
# Figure out which wireless region we are in. The US has rules for
|
||||||
|
# what channels can be used and at what power level. We use a different set of
|
||||||
|
# rules for the other regions in the world that we sell into. The mod_cert field
|
||||||
|
# in OTP will be set to 0x0 for the US. Once we know the region, make sure the
|
||||||
|
# appropriate calibration file is loaded.
|
||||||
|
#
|
||||||
if [ -e "/sys/kernel/machine/name" ]; then
|
if [ -e "/sys/kernel/machine/name" ]; then
|
||||||
# Figure out which wireless region we are in. The US has rules for
|
|
||||||
# what channels can be used and at what power level. We use a different set of
|
|
||||||
# rules for the other regions in the world that we sell into. The mod_cert field
|
|
||||||
# in OTP will be set to 0x0 for the US. Once we know the region, make sure the
|
|
||||||
# appropriate calibration file is loaded.
|
|
||||||
#
|
|
||||||
US_CODE="0x0"
|
|
||||||
MACHINE="$(cat /sys/kernel/machine/name)"
|
MACHINE="$(cat /sys/kernel/machine/name)"
|
||||||
REGION_CODE="$(cat /sys/kernel/${MACHINE}/mod_cert)"
|
REGION_CODE="$(cat /sys/kernel/${MACHINE}/mod_cert)"
|
||||||
if [ -z "${REGION_CODE}" -o "${US_CODE}" = "${REGION_CODE}" ]; then
|
elif [ -e "/proc/device-tree/digi,hwid,cert" ]; then
|
||||||
|
REGION_CODE="$(cat /proc/device-tree/digi,hwid,cert)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
US_CODE="0x0"
|
||||||
|
BDATA_SOURCE="Digi_6203-6233-World.bin"
|
||||||
|
if [ -n "${REGION_CODE}" -a "${US_CODE}" = "${REGION_CODE}" ]; then
|
||||||
BDATA_SOURCE="Digi_6203-6233-US.bin"
|
BDATA_SOURCE="Digi_6203-6233-US.bin"
|
||||||
fi
|
logger -t atheros "Setting US wireless region."
|
||||||
else
|
else
|
||||||
logger -t atheros "Undefined machine, defaulting to world region."
|
logger -t atheros "Setting non-US (world) wireless region."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# We don't want to rewrite NAND every time we boot so only
|
# We don't want to rewrite NAND every time we boot so only
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,11 @@ ccardimx28js_bt_init() {
|
||||||
# Exit if this hardware does not support Bluetooth
|
# Exit if this hardware does not support Bluetooth
|
||||||
#
|
#
|
||||||
BLUE_TOOTH_VARIANTS="0x02 0x03 0x10 0x11"
|
BLUE_TOOTH_VARIANTS="0x02 0x03 0x10 0x11"
|
||||||
|
if [ -e "/proc/device-tree/digi,hwid,variant" ]; then
|
||||||
|
MOD_VARIANT="$(cat /proc/device-tree/digi,hwid,variant)"
|
||||||
|
elif [ -e "/sys/kernel/ccardimx28/mod_variant" ]; then
|
||||||
MOD_VARIANT="$(cat /sys/kernel/ccardimx28/mod_variant)"
|
MOD_VARIANT="$(cat /sys/kernel/ccardimx28/mod_variant)"
|
||||||
|
fi
|
||||||
if ! echo ${BLUE_TOOTH_VARIANTS} | grep -qs ${MOD_VARIANT}; then
|
if ! echo ${BLUE_TOOTH_VARIANTS} | grep -qs ${MOD_VARIANT}; then
|
||||||
echo "${SCRIPTNAME}: FAILED (variant ${MOD_VARIANT} does not support bluetooth)"
|
echo "${SCRIPTNAME}: FAILED (variant ${MOD_VARIANT} does not support bluetooth)"
|
||||||
exit
|
exit
|
||||||
|
|
@ -63,7 +67,11 @@ ccardimx28js_bt_init() {
|
||||||
# for class 2 Bluetooth.
|
# for class 2 Bluetooth.
|
||||||
#
|
#
|
||||||
JAPANESE_REGION_CODE="0x2"
|
JAPANESE_REGION_CODE="0x2"
|
||||||
|
if [ -e "/proc/device-tree/digi,hwid,cert" ]; then
|
||||||
|
REGION_CODE="$(cat /proc/device-tree/digi,hwid,cert)"
|
||||||
|
elif [ -e "/sys/kernel/ccardimx28/mod_cert" ]; then
|
||||||
REGION_CODE="$(cat /sys/kernel/ccardimx28/mod_cert)"
|
REGION_CODE="$(cat /sys/kernel/ccardimx28/mod_cert)"
|
||||||
|
fi
|
||||||
if [ -n "${REGION_CODE}" -a "${JAPANESE_REGION_CODE}" = "${REGION_CODE}" ]; then
|
if [ -n "${REGION_CODE}" -a "${JAPANESE_REGION_CODE}" = "${REGION_CODE}" ]; then
|
||||||
#
|
#
|
||||||
# We don't want to wear out flash rewriting the configuration file,
|
# We don't want to wear out flash rewriting the configuration file,
|
||||||
|
|
@ -123,7 +131,13 @@ ccardimx28js_bt_init() {
|
||||||
echo "Starting bluetooth services."
|
echo "Starting bluetooth services."
|
||||||
|
|
||||||
# Initialize driver for 'ccardimx28js'
|
# Initialize driver for 'ccardimx28js'
|
||||||
[ "$(cat /sys/kernel/machine/name)" = "ccardimx28" ] && ccardimx28js_bt_init
|
if [ -e "/proc/device-tree/digi,machine,name" ]; then
|
||||||
|
MACHINENAME="$(cat /proc/device-tree/digi,machine,name)"
|
||||||
|
elif [ -e "/sys/kernel/machine/name" ]; then
|
||||||
|
MACHINENAME="$(cat /sys/kernel/machine/name)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ "${MACHINENAME}" = "ccardimx28" ] && ccardimx28js_bt_init
|
||||||
|
|
||||||
# Run bluetooth daemon
|
# Run bluetooth daemon
|
||||||
if hciconfig hci0 up && bluetoothd; then
|
if hciconfig hci0 up && bluetoothd; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue