[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/9] vl: support -audio BACKEND without model
From: |
Paolo Bonzini |
Subject: |
[PATCH 3/9] vl: support -audio BACKEND without model |
Date: |
Fri, 22 Sep 2023 11:44:53 +0200 |
For machines with an embedded audio device, "-audio BACKEND" will
set the audiodev property of the machine itself.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
softmmu/vl.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 5a1413da2aa..70c9eb34dcf 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2933,11 +2933,12 @@ void qemu_init(int argc, char **argv)
if (!qdict_haskey(dict, "id")) {
qdict_put_str(dict, "id", "audiodev0");
}
- if (!qdict_haskey(dict, "model")) {
- error_setg(&error_fatal, "Parameter 'model' is missing");
+ if (qdict_haskey(dict, "model")) {
+ model = g_strdup(qdict_get_str(dict, "model"));
+ qdict_del(dict, "model");
+ } else {
+ model = g_strdup("default");
}
- model = g_strdup(qdict_get_str(dict, "model"));
- qdict_del(dict, "model");
if (is_help_option(model)) {
show_valid_soundhw();
exit(0);
@@ -2947,7 +2948,11 @@ void qemu_init(int argc, char **argv)
visit_type_Audiodev(v, NULL, &dev, &error_fatal);
visit_free(v);
audio_define(dev);
- select_soundhw(model, dev->id);
+ if (g_str_equal(model, "default")) {
+ qdict_put_str(machine_opts_dict, "audiodev", dev->id);
+ } else {
+ select_soundhw(model, dev->id);
+ }
g_free(model);
break;
}
--
2.41.0
- [PATCH 0/9] audio: make sound cards require the audiodev property, Paolo Bonzini, 2023/09/22
- [PATCH 1/9] audio: Add easy dummy audio initialiser, Paolo Bonzini, 2023/09/22
- [PATCH 3/9] vl: support -audio BACKEND without model,
Paolo Bonzini <=
- [PATCH 5/9] hw/ppc: Support machine-default audiodev with fallback, Paolo Bonzini, 2023/09/22
- [PATCH 2/9] Introduce machine property "audiodev", Paolo Bonzini, 2023/09/22
- [PATCH 4/9] hw/arm: Support machine-default audiodev with fallback, Paolo Bonzini, 2023/09/22
- [PATCH 7/9] vl: recognize audiodev groups in configuration files, Paolo Bonzini, 2023/09/22
- [PATCH 8/9] audio: Make AUD_register_card fallible and require audiodev=, Paolo Bonzini, 2023/09/22
- [PATCH 9/9] audio: Be more strict during audio backend initialisation, Paolo Bonzini, 2023/09/22
- [PATCH 6/9] vt82c686: Support machine-default audiodev with fallback, Paolo Bonzini, 2023/09/22