diff options
author | hans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain> | 2009-08-12 09:15:17 +0200 |
---|---|---|
committer | hans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain> | 2009-08-12 09:15:17 +0200 |
commit | a535ec7ac67e962087811181dc3dcb59760df467 (patch) | |
tree | efdb0e16948b98aab8554d4dda7ad5bed35f68b4 /v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c | |
parent | 35bee292fab703bb1156a3e5fe30518d55c0dcbf (diff) | |
download | mediapointer-dvb-s2-a535ec7ac67e962087811181dc3dcb59760df467.tar.gz mediapointer-dvb-s2-a535ec7ac67e962087811181dc3dcb59760df467.tar.bz2 |
libv4l: Also look for dmi info under /sys/class/dmi/id
From: Hans de Goede <hdegoede@redhat.com>
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 <hdegoede@redhat.com>
Diffstat (limited to 'v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c')
-rw-r--r-- | v4l2-apps/libv4l/libv4lconvert/control/libv4lcontrol.c | 14 |
1 files changed, 11 insertions, 3 deletions
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); |