Paolo Bonzini <pbonz...@redhat.com> writes: > On 05/01/2018 09:18, Markus Armbruster wrote: >>>> Would it be possible to make this automatic? Before I could tell people >>>> "use -usbdevice braille to test braille", and now it would be >>>> "use -chardev braille,chardev=foobar -device usb-braille,chardev=foobar" >>> Maybe we can add "-braille" instead. Something like this: >> More sugar, ugh! >> >> What about giving braille property chardev a sensible default? >> Ideally in a self-documenting way, so that -device usb-braille,help >> shows the default. > > That would mean automatically creating a back-end in a device's realize > property. I'd rather avoid that,
That's one way to do it. A perhaps less odious way would be to make qdev core support chardev defaults just like it supports integer defaults. For integers, we specify the default value as parameter for DEFINE_PROP_INT64() & friends. For chardevs, we'd can't specify the value, but we could specify the option string to use for creating it. One reason I like sane defaults better than sugar: users can more easily grow from -device usb-braille to -device usb-braille,chardev=braille-be -chardev id=braille-be,... than from -braille > sugar is not bad per se. Stirring a teaspoon of sugar into your tea may be of debatable taste, but I certainly wouldn't call it bad per se. However, we're already closer to upending the sugar bowl, then raiding the pantry for more.