From a535ec7ac67e962087811181dc3dcb59760df467 Mon Sep 17 00:00:00 2001 From: "hans@rhel5-devel.localdomain" Date: Wed, 12 Aug 2009 09:15:17 +0200 Subject: libv4l: Also look for dmi info under /sys/class/dmi/id From: Hans de Goede libv4l was looking for dmi strings in sysfs under /sys/devices/virtual/dmi/id but with some kernel configurations this does not exist. It turns out that the dmi strings do exist under /sys/class/dmi/id here. It seems that all systems with dmi info in sysfs have /sys/class/dmi/id so default to using that instead. To be sure fall back to /sys/devices/virtual/dmi/id (the old behavor) when /sys/class/dmi/id is not found. Priority: normal Signed-off-by: Hans de Goede --- v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c') diff --git a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c index 55ebf1b54..a20c114a1 100644 --- a/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c +++ b/v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c @@ -169,11 +169,19 @@ static void v4lcontrol_get_dmi_string(const char *string, char *buf, int size) char *s, sysfs_name[512]; snprintf(sysfs_name, sizeof(sysfs_name), - "/sys/devices/virtual/dmi/id/%s", string); + "/sys/class/dmi/id/%s", string); f = fopen(sysfs_name, "r"); if (!f) { - buf[0] = 0; - return; + /* Try again with a different sysfs path, not sure if this is needed + but we used to look under /sys/devices/virtual/dmi/id in older + libv4l versions, but this did not work with some kernels */ + snprintf(sysfs_name, sizeof(sysfs_name), + "/sys/devices/virtual/dmi/id/%s", string); + f = fopen(sysfs_name, "r"); + if (!f) { + buf[0] = 0; + return; + } } s = fgets(buf, size, f); -- cgit v1.2.3