hal: Branch 'origin' - 2 commits
Danny Kukawka
dkukawka at kemper.freedesktop.org
Tue Feb 20 09:01:01 PST 2007
hald/linux/addons/.gitignore | 1 +
hald/linux/probing/probe-smbios.c | 27 ++++++++++++++++++++++++++-
2 files changed, 27 insertions(+), 1 deletion(-)
New commits:
diff-tree d0e1baea517a8c4e538c73db77576a6d5c794657 (from fc72b90bc52d357be8cabbe188b56bbe0dc8cf6d)
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Tue Feb 20 16:01:12 2007 +0100
added hald-addon-dell-backlight to .gitignore
diff --git a/hald/linux/addons/.gitignore b/hald/linux/addons/.gitignore
index 25fcda8..2b6fd5c 100644
--- a/hald/linux/addons/.gitignore
+++ b/hald/linux/addons/.gitignore
@@ -13,5 +13,6 @@ hald-addon-keyboard
hald-addon-acpi-buttons-toshiba
hald-addon-macbookpro-backlight
hald-addon-cpufreq
+hald-addon-dell-backlight
*.o
*~
diff-tree fc72b90bc52d357be8cabbe188b56bbe0dc8cf6d (from c80d811ece728dfeba60c1a10af12eca4bb9bbc5)
Author: Danny Kukawka <danny.kukawka at web.de>
Date: Tue Feb 20 15:58:59 2007 +0100
detect path to dmidecode on runtime (fd.o bug #9318)
This adds detection of the location of dmidecode to the prober.
This would fix fd.o bug #9318
diff --git a/hald/linux/probing/probe-smbios.c b/hald/linux/probing/probe-smbios.c
index bb9ace3..f74b2f0 100644
--- a/hald/linux/probing/probe-smbios.c
+++ b/hald/linux/probing/probe-smbios.c
@@ -34,6 +34,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/stat.h>
#include <unistd.h>
#include "libhal/libhal.h"
@@ -100,6 +101,16 @@ main (int argc, char *argv[])
int dmiparser_done_system = FALSE;
int dmiparser_done_chassis = FALSE;
+ uint i;
+ struct stat s;
+ const char *path = NULL;
+ const char *possible_paths[] = {
+ "/usr/sbin/dmidecode",
+ "/bin/dmidecode",
+ "/sbin/dmidecode",
+ "/usr/local/sbin/dmidecode",
+ };
+
/* assume failure */
ret = 1;
@@ -117,6 +128,20 @@ main (int argc, char *argv[])
goto out;
}
+
+ /* find the path to dmidecode */
+ for (i = 0; i < sizeof (possible_paths) / sizeof (char *); i++) {
+ if (stat (possible_paths[i], &s) == 0 && S_ISREG (s.st_mode)) {
+ path = possible_paths[i];
+ break;
+ }
+ }
+
+ if (path == NULL) {
+ HAL_ERROR(("Could not find dmidecode, exit!"));
+ exit(1);
+ }
+
tmp_ret = pipe (dmipipe);
f = fdopen (dmipipe[0], "r");
nullfd = open ("/dev/null", O_RDONLY);
@@ -132,7 +157,7 @@ main (int argc, char *argv[])
close (dmipipe[1]);
/* execute the child */
- execl ("/usr/sbin/dmidecode", "/usr/sbin/dmidecode", NULL);
+ execl (path, path, NULL);
/* throw an error if we ever reach this point */
HAL_ERROR (("Failed to execute dmidecode!"));
More information about the hal-commit
mailing list