diff options
author | Simon Ser <simon.ser@intel.com> | 2019-06-06 14:40:34 +0300 |
---|---|---|
committer | Simon Ser <simon.ser@intel.com> | 2019-06-12 18:19:12 +0300 |
commit | dc2b07fa1478efae15f0f50b678c0ae0dbbaf391 (patch) | |
tree | c5ffaa40dc079292c6364ed5d7f51ea76084c756 /lib/igt_eld.c | |
parent | b90ebd9c21518f305a61ee50aea38462ef01e65c (diff) |
lib/igt_eld: add eld_get_igt
The existing eld_has_igt function doesn't allow the caller to retrieve the
parsed ELD and check audio parameters.
Signed-off-by: Simon Ser <simon.ser@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
Diffstat (limited to 'lib/igt_eld.c')
-rw-r--r-- | lib/igt_eld.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/igt_eld.c b/lib/igt_eld.c index 8b602796..15dd8ac9 100644 --- a/lib/igt_eld.c +++ b/lib/igt_eld.c @@ -202,16 +202,14 @@ static bool eld_parse_entry(const char *path, struct eld_entry *eld) return monitor_present; } -/** eld_has_igt: check whether ALSA has detected the audio-capable IGT EDID by - * parsing ELD entries */ -bool eld_has_igt(void) +/** eld_get_igt: retrieve the ALSA ELD entry matching the IGT EDID */ +bool eld_get_igt(struct eld_entry *eld) { DIR *dir; struct dirent *dirent; int i; char card[64]; char path[PATH_MAX]; - struct eld_entry eld; for (i = 0; i < 8; i++) { snprintf(card, sizeof(card), "/proc/asound/card%d", i); @@ -226,19 +224,19 @@ bool eld_has_igt(void) snprintf(path, sizeof(path), "%s/%s", card, dirent->d_name); - if (!eld_parse_entry(path, &eld)) { + if (!eld_parse_entry(path, eld)) { continue; } - if (!eld.valid) { + if (!eld->valid) { igt_debug("Skipping invalid ELD: %s\n", path); continue; } - if (strcmp(eld.monitor_name, "IGT") != 0) { + if (strcmp(eld->monitor_name, "IGT") != 0) { igt_debug("Skipping non-IGT ELD: %s " "(monitor name: %s)\n", - path, eld.monitor_name); + path, eld->monitor_name); continue; } @@ -250,3 +248,11 @@ bool eld_has_igt(void) return false; } + +/** eld_has_igt: check whether ALSA has detected the audio-capable IGT EDID by + * parsing ELD entries */ +bool eld_has_igt(void) +{ + struct eld_entry eld; + return eld_get_igt(&eld); +} |