1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:37:43 +00:00

Ports: Add a port of dmidecode

This commit is contained in:
Liav A 2021-01-29 14:05:06 +02:00 committed by Andreas Kling
parent c6fe1de30e
commit a9d1ddb1a5
3 changed files with 77 additions and 0 deletions

View file

@ -0,0 +1,31 @@
diff --git a/dmidecode.c b/dmidecode.c
index 6559567..17573a9 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -80,7 +80,7 @@ static const char *bad_index = "<BAD INDEX>";
#define FLAG_NO_FILE_OFFSET (1 << 0)
#define FLAG_STOP_AT_EOT (1 << 1)
-#define SYS_FIRMWARE_DIR "/sys/firmware/dmi/tables"
+#define SYS_FIRMWARE_DIR "/proc"
#define SYS_ENTRY_FILE SYS_FIRMWARE_DIR "/smbios_entry_point"
#define SYS_TABLE_FILE SYS_FIRMWARE_DIR "/DMI"
@@ -5053,7 +5053,7 @@ int main(int argc, char * const argv[])
}
/*
- * First try reading from sysfs tables. The entry point file could
+ * First try reading from procfs tables. The entry point file could
* contain one of several types of entry points, so read enough for
* the largest one, then determine what type it contains.
*/
@@ -5062,7 +5062,7 @@ int main(int argc, char * const argv[])
&& (buf = read_file(0, &size, SYS_ENTRY_FILE)) != NULL)
{
if (!(opt.flags & FLAG_QUIET))
- printf("Getting SMBIOS data from sysfs.\n");
+ printf("Getting SMBIOS data from procfs.\n");
if (size >= 24 && memcmp(buf, "_SM3_", 5) == 0)
{
if (smbios3_decode(buf, SYS_TABLE_FILE, FLAG_NO_FILE_OFFSET))