From ff5d0628d9b4a7e10701b06c9be6f331a2a0de8e Mon Sep 17 00:00:00 2001 From: Hector Palacios Date: Fri, 17 Jul 2020 12:40:04 +0200 Subject: [PATCH] recovery: change the way to determine if the device is closed The old fsl_otp driver is deprecated and we need to determine if the device is closed using a new property of the device tree called 'digi,tf-closed'. Assume the device is open if the property is not found. Signed-off-by: Hector Palacios https://jira.digi.com/browse/DEL-7185 (cherry picked from commit fc1a73675826bd6abcb7e5ad72d48ffca84a28a7) --- .../recovery-utils/lib/recovery.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/lib/recovery.c b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/lib/recovery.c index 40b5e2fb2..1f4c1b9ab 100644 --- a/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/lib/recovery.c +++ b/meta-digi-dey/recipes-core/recovery/recovery-utils/recovery-utils/lib/recovery.c @@ -94,21 +94,15 @@ err: */ static int is_device_closed(void) { - const char *path = "/sys/fsl_otp/HW_OCOTP_CFG5"; - FILE *fd = NULL; - unsigned int value = 0; - long open = 0; + const char *path_closed = "/proc/device-tree/digi,tf-closed"; - if ((fd = fopen(path, "r")) == NULL) { - fprintf(stderr, "Cannot check device status. Assuming closed...\n"); + if (access(path_closed, F_OK) != -1) return 1; - } + else + fprintf(stderr, + "Cannot check device status. Assuming open...\n"); - open = (fscanf(fd, "%x", &value) == 1) && (value & OTP_CLOSED_BIT); - - fclose(fd); - - return open; + return 0; } /*