meta-digi-dey: sysinfo: Fix for use with mainline kernels

* Check for file before using it

This just avoids the failure, on mainline access to OTP would need to be
done differently, see:

https://jira.digi.com/browse/ACL-163

* Use compatible node instead of digi,machine,name

Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
This commit is contained in:
Alex Gonzalez 2018-05-31 14:20:06 +02:00
parent 6a95035b3c
commit f85cd4e2ee
1 changed files with 7 additions and 5 deletions

View File

@ -236,10 +236,12 @@ make_report(){
echo "--------------------------------------"
echo ""
if [ "$(($(cat /sys/fsl_otp/HW_OCOTP_CFG5) & 2))" != "0" ]; then
echo "Device status: [CLOSED]"
else
echo "Device status: [OPEN]"
if [ -e /sys/fsl_otp/HW_OCOTP_CFG5 ]; then
if [ "$(($(cat /sys/fsl_otp/HW_OCOTP_CFG5) & 2))" != "0" ]; then
echo "Device status: [CLOSED]"
else
echo "Device status: [OPEN]"
fi
fi
if [ -f "/proc/device-tree/digi,uboot-env,encrypted" ]; then
@ -260,7 +262,7 @@ if [ -z "${UBOOT_VERSION}" ]; then
[ -c "/dev/mtd0" ] && UBOOT_PARTITION="/dev/mtd0"
UBOOT_VERSION="$(strings ${UBOOT_PARTITION} | grep -m 1 dub | cut -d' ' -f2)"
fi
MACHINE="$(cat /proc/device-tree/digi,machine,name | tr -d '\0')"
MACHINE="$(cat /proc/device-tree/compatible | tr '\0' '\t' | cut -f 1)"
BOARD_VARIANT="$(cat /proc/device-tree/digi,hwid,variant | tr -d '\0')"
BOARD_SN="$(cat /proc/device-tree/digi,hwid,sn | tr -d '\0')"
BOARD_VERSION="$(cat /proc/device-tree/digi,carrierboard,version | tr -d '\0')"