summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkhali <khali>2015-04-21 07:38:05 +0000
committerkhali <khali>2015-04-21 07:38:05 +0000
commit44c77f0814e12e004676706fd5545ee2efaf7c9a (patch)
tree99605627d754d46a4fac13fcbb4302f3b9dcc4a6
parentfbc5e88eaa6971d7e1e14adb9c92922be5ea5fe7 (diff)
downloaddmidecode-44c77f0814e12e004676706fd5545ee2efaf7c9a.tar.gz
dmidecode: Add --no-sysfs option to disable use of sysfs
This option forces any SMBIOS information in sysfs to be ignored, resulting in dmidecode using /dev/mem for SMBIOS access. This is likely most useful for debugging. Contributed by Roy Franz.
-rw-r--r--CHANGELOG3
-rw-r--r--dmidecode.c3
-rw-r--r--dmiopt.c4
-rw-r--r--dmiopt.h1
-rw-r--r--man/dmidecode.84
5 files changed, 14 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 1f30bcd..282a89e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,9 @@
entire binary file into a buffer.
* dmidecode.c: Add passing of flags parameter to dmi_table.
* dmidecode.c: Add reading of SMBIOS tables from sysfs.
+ * dmidecode.c, dmiopt.c, dmiopt.h: Add --no-sysfs option to disable
+ use of sysfs.
+ * dmidecode.8: Document the changes above.
2015-04-20 Jean Delvare <jdelvare@suse.de>
diff --git a/dmidecode.c b/dmidecode.c
index 6cd59f4..6321b84 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -4677,7 +4677,8 @@ int main(int argc, char * const argv[])
* contain one of several types of entry points, so read enough for
* the largest one, then determine what type it contains.
*/
- if ((buf = read_file(0x20, SYS_ENTRY_FILE)) != NULL)
+ if (!(opt.flags & FLAG_NO_SYSFS)
+ && (buf = read_file(0x20, SYS_ENTRY_FILE)) != NULL)
{
if (!(opt.flags & FLAG_QUIET))
printf("Getting SMBIOS data from sysfs.\n");
diff --git a/dmiopt.c b/dmiopt.c
index 1c56a0e..c86e7dd 100644
--- a/dmiopt.c
+++ b/dmiopt.c
@@ -225,6 +225,7 @@ int parse_command_line(int argc, char * const argv[])
{ "dump", no_argument, NULL, 'u' },
{ "dump-bin", required_argument, NULL, 'B' },
{ "from-dump", required_argument, NULL, 'F' },
+ { "no-sysfs", no_argument, NULL, 'S' },
{ "version", no_argument, NULL, 'V' },
{ 0, 0, 0, 0 }
};
@@ -262,6 +263,9 @@ int parse_command_line(int argc, char * const argv[])
case 'u':
opt.flags |= FLAG_DUMP;
break;
+ case 'S':
+ opt.flags |= FLAG_NO_SYSFS;
+ break;
case 'V':
opt.flags |= FLAG_VERSION;
break;
diff --git a/dmiopt.h b/dmiopt.h
index b7f2533..5f3103c 100644
--- a/dmiopt.h
+++ b/dmiopt.h
@@ -42,6 +42,7 @@ extern struct opt opt;
#define FLAG_QUIET (1 << 3)
#define FLAG_DUMP_BIN (1 << 4)
#define FLAG_FROM_DUMP (1 << 5)
+#define FLAG_NO_SYSFS (1 << 6)
int parse_command_line(int argc, char * const argv[]);
void print_help(void);
diff --git a/man/dmidecode.8 b/man/dmidecode.8
index 8b1c79b..a64cf5d 100644
--- a/man/dmidecode.8
+++ b/man/dmidecode.8
@@ -130,6 +130,10 @@ later.
Read the DMI data from a binary file previously generated using
\fB--dump-bin\fR.
.TP
+.BR " " " " "--no-sysfs"
+Do not attempt to read DMI data from sysfs files. This is mainly useful for
+debugging.
+.TP
.BR "-h" ", " "--help"
Display usage information and exit
.TP