On Thu, Jun 18, 2015 at 05:44:48PM +0200, Gerd Hoffmann wrote: > Hi, > > > > +static Property virtio_input_host_pci_properties[] = { > > > + DEFINE_VIRTIO_INPUT_PROPERTIES(VirtIOInputPCI, vdev.input), > > > + DEFINE_PROP_STRING("evdev", VirtIOInputHostPCI, vdev.evdev), > > > + DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), > > > + DEFINE_PROP_END_OF_LIST(), > > > +}; > > > + > > > > Hmm I only noticed this now: I think properties > > should all move into virtio input, there is > > no reason to make them pci specific. > > Hmm, looking into this. Can't figure how this works. For virtio-net a > bunch of properties are defined for virtio-net-device. But they show up > (using -device $dev,?) on both virtio-net-device and virtio-net-pci. > > Trying to do the same for the (already merged) virtio-input hid devices. > Not working. Patch below. Any clues? > > thanks, > Gerd >
I think the missing magic is virtio_instance_init_common which calls qdev_alias_all_properties. > diff --git a/hw/input/virtio-input-hid.c b/hw/input/virtio-input-hid.c > index f7c6bc9..55998a2 100644 > --- a/hw/input/virtio-input-hid.c > +++ b/hw/input/virtio-input-hid.c > @@ -337,10 +337,17 @@ static void virtio_input_hid_handle_status(VirtIOInput > *vinput, > } > } > > +static Property virtio_input_hid_properties[] = { > + DEFINE_VIRTIO_INPUT_PROPERTIES(VirtIOInput, input), > + DEFINE_PROP_END_OF_LIST(), > +}; > + > static void virtio_input_hid_class_init(ObjectClass *klass, void *data) > { > + DeviceClass *dc = DEVICE_CLASS(klass); > VirtIOInputClass *vic = VIRTIO_INPUT_CLASS(klass); > > + dc->props = virtio_input_hid_properties; > vic->realize = virtio_input_hid_realize; > vic->unrealize = virtio_input_hid_unrealize; > vic->change_active = virtio_input_hid_change_active; > diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c > index 2c053c7..46dc77a 100644 > --- a/hw/virtio/virtio-pci.c > +++ b/hw/virtio/virtio-pci.c > @@ -1901,7 +1901,6 @@ static const TypeInfo virtio_rng_pci_info = { > /* virtio-input-pci */ > > static Property virtio_input_hid_pci_properties[] = { > - DEFINE_VIRTIO_INPUT_PROPERTIES(VirtIOInputPCI, vdev.input), > DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), > DEFINE_PROP_END_OF_LIST(), > };