On 9/8/22 07:55, Volker Rümelin wrote: > Am 07.09.22 um 19:30 schrieb Claudio Fontana: > >> add a simple help option for -audio and -audiodev >> to show the list of available drivers, and document them. >> >> Signed-off-by: Claudio Fontana <cfont...@suse.de> >> --- >> audio/audio.c | 20 ++++++++++++++++++++ >> audio/audio.h | 1 + >> qemu-options.hx | 10 ++++++---- >> softmmu/vl.c | 9 +++++++-- >> 4 files changed, 34 insertions(+), 6 deletions(-) >> >> v1 -> v2: also extend the help to -audio. >> >> -audio help >> -audio driver=help >> -audiodev help >> >> will all show the same results. >> >> diff --git a/audio/audio.c b/audio/audio.c >> index 4f4bb10cce..ffb09ec825 100644 >> --- a/audio/audio.c >> +++ b/audio/audio.c >> @@ -32,6 +32,7 @@ >> #include "qapi/qapi-visit-audio.h" >> #include "qemu/cutils.h" >> #include "qemu/module.h" >> +#include "qemu/help_option.h" >> #include "sysemu/sysemu.h" >> #include "sysemu/replay.h" >> #include "sysemu/runstate.h" >> @@ -2105,10 +2106,29 @@ static void audio_validate_opts(Audiodev *dev, Error >> **errp) >> } >> } >> >> +void audio_help(void) >> +{ >> + int i; >> + >> + printf("Available audio drivers:\n"); >> + printf("none\n"); >> + >> + for (i = 0; audio_prio_list[i]; i++) { >> + audio_driver *driver = audio_driver_lookup(audio_prio_list[i]); > > Hi Claudio, > > there is no guarantee that the audio_prio_list contains all audio > backend drivers. I would use this > > + for (i = 0; i < AUDIODEV_DRIVER__MAX; i++) { > + const char *name = AudiodevDriver_str(i); > + audio_driver *driver = audio_driver_lookup(name); > > to enumerate all audio backend drivers.
Thanks Volker, will update accordingly. Claudio > > With best regards, > Volker > >> + if (driver) { >> + printf("%s\n", driver->name); >> + } >> + } >> +} >> + >> >