summaryrefslogtreecommitdiff
path: root/lib/igt_eld.c
diff options
context:
space:
mode:
authorSimon Ser <simon.ser@intel.com>2019-09-11 15:57:55 +0300
committerSimon Ser <simon.ser@intel.com>2019-09-12 15:38:38 +0300
commit3374cd0b048f9c277b2815bf80502f9f89680176 (patch)
treea511f8b5fbc8d70b2ec72f99df4ecb9a7e5739f5 /lib/igt_eld.c
parentefb4539494d94f03374874d3b61bd04ef3802aaa (diff)
lib/igt_eld: introduce eld_is_supported
We've seen cases in which /proc/asound doesn't exist (e.g. with the new SOF framework). We've also seen cases in which no soundcard is exposed by ALSA (see bugzilla link). Last, some audio drivers din't support ELDs (non-Intel drivers). In all of these cases, skipping the tests depending on ELD support makes more sense and makes it clearer what happens. v2: also check that the driver supports ELDs entries in procfs Signed-off-by: Simon Ser <simon.ser@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102370 Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_eld.c')
-rw-r--r--lib/igt_eld.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/igt_eld.c b/lib/igt_eld.c
index 16c4ac06..5d1d8e01 100644
--- a/lib/igt_eld.c
+++ b/lib/igt_eld.c
@@ -26,6 +26,8 @@
#include "config.h"
#include <dirent.h>
+#include <errno.h>
+#include <glob.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
@@ -262,3 +264,19 @@ bool eld_has_igt(void)
struct eld_entry eld;
return eld_get_igt(&eld);
}
+
+/** eld_is_supported: check whether the ALSA procfs is enabled, audio cards
+ * are found and ELDs are supported */
+bool eld_is_supported(void)
+{
+ glob_t glob_buf = {0};
+ bool has_elds;
+
+ igt_assert_f(glob("/proc/asound/card*/" ELD_PREFIX "*",
+ GLOB_NOSORT, NULL, &glob_buf) == 0,
+ "glob failed\n");
+ has_elds = glob_buf.gl_pathc > 0;
+ globfree(&glob_buf);
+
+ return has_elds;
+}