aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-11-25 10:07:13 +0100
committerTakashi Iwai <tiwai@suse.de>2013-11-25 10:07:13 +0100
commit6f8996f655eacbd8355984332d24bc8fe5b2d27e (patch)
tree8b9acc93a071e7e80e458342f2abfa2d6cd43305
parent458d299264ea398cfd5ac216e3b0ef218a68937e (diff)
downloadhda-emu-6f8996f655eacbd8355984332d24bc8fe5b2d27e.tar.gz
Allow to pass a firmware patch file output to -H option
Just like -P option does, check the input file contents and skips to [hint] section if it's a firmware patch file.
-rw-r--r--hda-emu.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/hda-emu.c b/hda-emu.c
index 1d04910..45b9fda 100644
--- a/hda-emu.c
+++ b/hda-emu.c
@@ -1156,6 +1156,7 @@ static int load_init_hints(struct xhda_codec *codec, char *hints)
FILE *fp;
char buf[256];
struct xhda_sysfs_list *sys;
+ int is_fw_file, is_in_hint;
if (strchr(hints, '=')) {
/* direct hint string */
@@ -1184,8 +1185,27 @@ static int load_init_hints(struct xhda_codec *codec, char *hints)
return -EINVAL;
}
hda_log(HDA_LOG_INFO, "Add hints from file %s\n", hints);
- while (fgets(buf, sizeof(buf), fp))
+ is_fw_file = 0;
+ is_in_hint = 0;
+ while (fgets(buf, sizeof(buf), fp)) {
+ if (*buf == '#' || *buf == '\n')
+ continue;
+ if (is_fw_file) {
+ if (*buf == '[') {
+ if (is_in_hint)
+ break;
+ is_in_hint = !strncmp(buf, "[hint]", 8);
+ continue;
+ } else if (!is_in_hint)
+ continue;
+ } else {
+ if (!strncmp(buf, "[codec]", 7)) {
+ is_fw_file = 1;
+ continue;
+ }
+ }
_parse_hints(_codec, buf);
+ }
fclose(fp);
return 0;
#else