From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: mkletzan@redhat.com
Subject: [PATCH 3/9] vl: support -audio BACKEND without model
Date: Fri, 22 Sep 2023 11:44:53 +0200 [thread overview]
Message-ID: <20230922094459.265509-4-pbonzini@redhat.com> (raw)
In-Reply-To: <20230922094459.265509-1-pbonzini@redhat.com>
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
next prev parent reply other threads:[~2023-09-22 9:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-22 9:44 [PATCH 0/9] audio: make sound cards require the audiodev property Paolo Bonzini
2023-09-22 9:44 ` [PATCH 1/9] audio: Add easy dummy audio initialiser Paolo Bonzini
2023-09-22 11:45 ` Marc-André Lureau
2023-09-22 9:44 ` [PATCH 2/9] Introduce machine property "audiodev" Paolo Bonzini
2023-09-22 9:44 ` Paolo Bonzini [this message]
2023-09-22 9:44 ` [PATCH 4/9] hw/arm: Support machine-default audiodev with fallback Paolo Bonzini
2023-09-22 9:44 ` [PATCH 5/9] hw/ppc: " Paolo Bonzini
2023-09-22 9:44 ` [PATCH 6/9] vt82c686: " Paolo Bonzini
2023-09-22 12:16 ` BALATON Zoltan
2023-09-22 13:32 ` Paolo Bonzini
2023-09-22 23:54 ` BALATON Zoltan
2023-09-22 9:44 ` [PATCH 7/9] vl: recognize audiodev groups in configuration files Paolo Bonzini
2023-09-22 9:44 ` [PATCH 8/9] audio: Make AUD_register_card fallible and require audiodev= Paolo Bonzini
2023-09-22 11:17 ` Philippe Mathieu-Daudé
2023-09-22 9:44 ` [PATCH 9/9] audio: Be more strict during audio backend initialisation Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230922094459.265509-4-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=mkletzan@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).