fclose(f);
}
- if ((f = fopen("/tmp/sysinfo/board_name", "r")) != NULL ||
+ if ((f = fopen("/tmp/sysinfo/model", "r")) != NULL ||
(f = fopen("/proc/device-tree/model", "r")) != NULL)
{
if (fgets(line, sizeof(line), f))
fclose(f);
}
+ if ((f = fopen("/tmp/sysinfo/board_name", "r")) != NULL)
+ {
+ if (fgets(line, sizeof(line), f))
+ {
+ val = strtok(line, "\t\n");
+
+ if (val)
+ blobmsg_add_string(&b, "board_name", val);
+ }
+
+ fclose(f);
+ }
+ else if ((f = fopen("/proc/device-tree/compatible", "r")) != NULL)
+ {
+ if (fgets(line, sizeof(line), f))
+ {
+ val = strtok(line, "\t\n");
+
+ if (val)
+ {
+ next = val;
+ while ((next = strchr(next, ',')) != NULL)
+ {
+ *next = '-';
+ next++;
+ }
+
+ blobmsg_add_string(&b, "board_name", val);
+ }
+ }
+
+ fclose(f);
+ }
+
if ((f = fopen("/etc/openwrt_release", "r")) != NULL)
{
c = blobmsg_open_table(&b, "release");