mirror of
https://github.com/gophernicus/gophernicus.git
synced 2024-10-13 05:03:40 -04:00
Get hardware vendor and type from DMI data on Linux
This commit is contained in:
parent
81d0ee1348
commit
fd80023b17
18
platform.c
18
platform.c
@ -134,6 +134,24 @@ void platform(state *st)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Get hardware type from DMI data */
|
||||||
|
if (!*st->server_description && (fp = fopen("/sys/class/dmi/id/board_vendor" , "r"))) {
|
||||||
|
fgets(buf, sizeof(buf), fp);
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
sstrlcpy(st->server_description, buf);
|
||||||
|
chomp(st->server_description);
|
||||||
|
|
||||||
|
if ((fp = fopen("/sys/class/dmi/id/board_name" , "r"))) {
|
||||||
|
fgets(buf, sizeof(buf), fp);
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
if (*st->server_description) sstrlcat(st->server_description, " ");
|
||||||
|
sstrlcat(st->server_description, buf);
|
||||||
|
chomp(st->server_description);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Identify RedHat */
|
/* Identify RedHat */
|
||||||
if (!*sysname && (fp = fopen("/etc/redhat-release", "r"))) {
|
if (!*sysname && (fp = fopen("/etc/redhat-release", "r"))) {
|
||||||
fgets(sysname, sizeof(sysname), fp);
|
fgets(sysname, sizeof(sysname), fp);
|
||||||
|
Loading…
Reference in New Issue
Block a user