Hi, > For this to go away, I'd rather have something like the -nic option that > provides an easy way to set up the front end and back end. > > In other words you would do something like -audiohw > <audiodev-args>,model=xxx and it gets desugared automatically to either > > -audiodev <audiodev-args>,id=foo -device devname,audiodev=xxx > > or > > -audiodev <audiodev-args>,id=foo -M propname=foo
Suggestions how to do that in a clean way? Given that -audiodev is qapi-based I tried it this way: --- a/qapi/audio.json +++ b/qapi/audio.json @@ -419,3 +419,22 @@ 'sdl': 'AudiodevSdlOptions', 'spice': 'AudiodevGenericOptions', 'wav': 'AudiodevWavOptions' } } + +## +# @AudioDevice: +# +# TODO +## +{ 'enum': 'AudioDevice', + 'data': [ 'pcspk', 'ac97', 'hda' ] } + +## +# @AudioConfig: +# +# TODO +## +{ 'struct': 'AudioConfig', + 'base': 'Audiodev', + 'data': { + 'model': 'AudioDevice' +}} But qemu doesn't like the schema: qapi/audio.json: In struct 'AudioConfig': qapi/audio.json:436: 'base' requires a struct type, union type 'Audiodev' isn't We could easily support the case that no additional options are specified, like this: +{ 'struct': 'AudioConfig', + 'data': { + 'driver': 'AudiodevDriver', + 'model': 'AudioDevice' +}} But then you have to switch to the long form as soon as you want specify any audiodev config option. Maybe that is ok, dunno how much configuration options -nic supports. take care, Gerd