system: attempt to parse /proc/device-tree/model
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 15 Jan 2015 11:17:21 +0000 (12:17 +0100)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 15 Jan 2015 11:42:09 +0000 (12:42 +0100)
Fallback to /proc/device-tree/model if /tmp/sysinfo/model is not available.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
system.c

index 1e88b5dfed84c381cabb2756523ea9e3008a0d24..cdb54343885ee53c2521bea1882b6e4e72b90e85 100644 (file)
--- a/system.c
+++ b/system.c
@@ -78,7 +78,8 @@ static int system_board(struct ubus_context *ctx, struct ubus_object *obj,
                fclose(f);
        }
 
-       if ((f = fopen("/tmp/sysinfo/model", "r")) != NULL)
+       if ((f = fopen("/tmp/sysinfo/model", "r")) != NULL ||
+           (f = fopen("/proc/device-tree/model", "r")) != NULL)
        {
                if (fgets(line, sizeof(line), f))
                {