Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
virtio-input-pci: add virtio-multitouch-pci
Add virtio-multitouch-pci, a Multitouch-capable input device, to the
list of devices that can be provided by virtio-input-pci.

Signed-off-by: Sergio Lopez <slp@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20230526112925.38794-5-slp@redhat.com>
  • Loading branch information
slp authored and elmarco committed May 28, 2023
1 parent 8e9ebd7 commit 4b2321c
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions hw/virtio/virtio-input-pci.c
Expand Up @@ -25,10 +25,11 @@ struct VirtIOInputPCI {
VirtIOInput vdev;
};

#define TYPE_VIRTIO_INPUT_HID_PCI "virtio-input-hid-pci"
#define TYPE_VIRTIO_KEYBOARD_PCI "virtio-keyboard-pci"
#define TYPE_VIRTIO_MOUSE_PCI "virtio-mouse-pci"
#define TYPE_VIRTIO_TABLET_PCI "virtio-tablet-pci"
#define TYPE_VIRTIO_INPUT_HID_PCI "virtio-input-hid-pci"
#define TYPE_VIRTIO_KEYBOARD_PCI "virtio-keyboard-pci"
#define TYPE_VIRTIO_MOUSE_PCI "virtio-mouse-pci"
#define TYPE_VIRTIO_TABLET_PCI "virtio-tablet-pci"
#define TYPE_VIRTIO_MULTITOUCH_PCI "virtio-multitouch-pci"
OBJECT_DECLARE_SIMPLE_TYPE(VirtIOInputHIDPCI, VIRTIO_INPUT_HID_PCI)

struct VirtIOInputHIDPCI {
Expand Down Expand Up @@ -102,6 +103,14 @@ static void virtio_tablet_initfn(Object *obj)
TYPE_VIRTIO_TABLET);
}

static void virtio_multitouch_initfn(Object *obj)
{
VirtIOInputHIDPCI *dev = VIRTIO_INPUT_HID_PCI(obj);

virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
TYPE_VIRTIO_MULTITOUCH);
}

static const TypeInfo virtio_input_pci_info = {
.name = TYPE_VIRTIO_INPUT_PCI,
.parent = TYPE_VIRTIO_PCI,
Expand Down Expand Up @@ -140,6 +149,13 @@ static const VirtioPCIDeviceTypeInfo virtio_tablet_pci_info = {
.instance_init = virtio_tablet_initfn,
};

static const VirtioPCIDeviceTypeInfo virtio_multitouch_pci_info = {
.generic_name = TYPE_VIRTIO_MULTITOUCH_PCI,
.parent = TYPE_VIRTIO_INPUT_HID_PCI,
.instance_size = sizeof(VirtIOInputHIDPCI),
.instance_init = virtio_multitouch_initfn,
};

static void virtio_pci_input_register(void)
{
/* Base types: */
Expand All @@ -150,6 +166,7 @@ static void virtio_pci_input_register(void)
virtio_pci_types_register(&virtio_keyboard_pci_info);
virtio_pci_types_register(&virtio_mouse_pci_info);
virtio_pci_types_register(&virtio_tablet_pci_info);
virtio_pci_types_register(&virtio_multitouch_pci_info);
}

type_init(virtio_pci_input_register)

0 comments on commit 4b2321c

Please sign in to comment.