diff options
author | Burt P <pburt0@gmail.com> | 2017-07-19 00:55:42 -0500 |
---|---|---|
committer | Leandro Pereira <leandro@hardinfo.org> | 2017-07-19 07:20:40 -0700 |
commit | 9b2982813bdb1241e2149bd48893d03e139d24bb (patch) | |
tree | 613fb1becf462956dace385c60294a8e816714f2 /modules/devices.c | |
parent | af68d862d46e0bdc2d3d32a2fe5fba53456072cb (diff) |
device tree: reworked and cleaned up
* Moved device tree functions to
modules/devices/devicetree/dt_util.c
* The dtr_* functions usable from outside devicetree.c,
for example in get_motherboard().
Must #include "dt_util.h"
* Now possible to use an alternate device tree root for testing
-DOVRDTRROOT=\"/some/path\"
* Alternately, pass dtr_new() an alternate base path.
* Abandoned the tuple grouping and inherited properties stuff
for now.
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'modules/devices.c')
-rw-r--r-- | modules/devices.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/devices.c b/modules/devices.c index fe430621..afa645d6 100644 --- a/modules/devices.c +++ b/modules/devices.c @@ -37,6 +37,7 @@ #include <socket.h> #include "devices.h" +#include "dt_util.h" gchar *callback_processors(); gchar *callback_memory(); @@ -218,12 +219,12 @@ gchar *get_motherboard(void) return g_strconcat(board_name, _(" (vendor unknown)"), NULL); else if (board_vendor && *board_vendor) return g_strconcat(board_vendor, _(" (model unknown)"), NULL); -#else +#endif + /* use device tree "model" */ - if (g_file_get_contents("/proc/device-tree/model", &board_vendor, NULL, NULL)) { + board_vendor = dtr_get_string("/model"); + if (board_vendor != NULL) return board_vendor; - } -#endif return g_strdup(_("Unknown")); } |