Skip to contentSkip to conversation

Add virtio-input driver.

PATCH Applied Gerd Hoffmann 3 participants 6 messages Mar 26, 2015 – Mar 28, 2015

Subsystems (3)
lore
Share & tools
lore

Gerd Hoffmann

author maintainer
#0 lore raw

PATCH v5 1/1 Add virtio-input driver.

virtio-input is basically evdev-events-over-virtio, so this driver isn't much more than reading configuration from config space and forwarding incoming events to the linux input layer.

---
 MAINTAINERS                       |   6 +
 drivers/virtio/Kconfig            |  10 +
 drivers/virtio/Makefile           |   1 +
 drivers/virtio/virtio_input.c     | 384 ++++++++++++++++++++++++++++++++++++++
 include/uapi/linux/Kbuild         |   1 +
 include/uapi/linux/virtio_ids.h   |   1 +
 include/uapi/linux/virtio_input.h |  76 ++++++++
 7 files changed, 479 insertions(+)
 create mode 100644 drivers/virtio/virtio_input.c
 create mode 100644 include/uapi/linux/virtio_input.h
MAINTAINERS +6 -0
index 358eb01..6f233dd 100644
@@ -10442,6 +10442,12 @@ S:	Maintained
 F:	drivers/vhost/
 F:	include/uapi/linux/vhost.h
 
+VIRTIO INPUT DRIVER
+M:	Gerd Hoffmann <[email protected]>
+S:	Maintained
+F:	drivers/virtio/virtio_input.c
+F:	include/uapi/linux/virtio_input.h
+
 VIA RHINE NETWORK DRIVER
 M:	Roger Luethi <[email protected]>
 S:	Maintained
drivers/virtio/Kconfig +10 -0
index b546da5..cab9f3f 100644
@@ -48,6 +48,16 @@ config VIRTIO_BALLOON
 
 	 If unsure, say M.
 
+config VIRTIO_INPUT
+	tristate "Virtio input driver"
+	depends on VIRTIO
+	depends on INPUT
+	---help---
+	 This driver supports virtio input devices such as
+	 keyboards, mice and tablets.
+
+	 If unsure, say M.
+
  config VIRTIO_MMIO
 	tristate "Platform bus driver for memory mapped virtio devices"
 	depends on HAS_IOMEM
drivers/virtio/Makefile +1 -0
index d85565b..41e30e3 100644
@@ -4,3 +4,4 @@ obj-$(CONFIG_VIRTIO_PCI) += virtio_pci.o
 virtio_pci-y := virtio_pci_modern.o virtio_pci_common.o
 virtio_pci-$(CONFIG_VIRTIO_PCI_LEGACY) += virtio_pci_legacy.o
 obj-$(CONFIG_VIRTIO_BALLOON) += virtio_balloon.o
+obj-$(CONFIG_VIRTIO_INPUT) += virtio_input.o
drivers/virtio/virtio_input.c new file +384 -0

384 lines not on this page · raw message

include/uapi/linux/Kbuild +1 -0
index 68ceb97..04b829e 100644
@@ -430,6 +430,7 @@ header-y += virtio_blk.h
 header-y += virtio_config.h
 header-y += virtio_console.h
 header-y += virtio_ids.h
+header-y += virtio_input.h
 header-y += virtio_net.h
 header-y += virtio_pci.h
 header-y += virtio_ring.h
include/uapi/linux/virtio_ids.h +1 -0
index 284fc3a..5f60aa4 100644
@@ -39,5 +39,6 @@
 #define VIRTIO_ID_9P		9 /* 9p virtio console */
 #define VIRTIO_ID_RPROC_SERIAL 11 /* virtio remoteproc serial link */
 #define VIRTIO_ID_CAIF	       12 /* Virtio caif */
+#define VIRTIO_ID_INPUT        18 /* virtio input */
 
 #endif /* _LINUX_VIRTIO_IDS_H */
include/uapi/linux/virtio_input.h new file +76 -0

76 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 5 lines · Gerd Hoffmann

virtio-input is basically evdev-events-over-virtio, so this driver isn't much more than reading configuration from config space and forwarding incoming events to the linux input layer.

Still a bit worried about using input.h as host/guest interface (can't we use some formal standard, e.g. USB HID?), but I'll let Rusty decide that.

Otherwise mostly looks good. One nit below.

Quoted 1 line

---

Could you pls include changelog in the future?
You are sending multiple versions per day and it's hard to keep up.

drivers/virtio/virtio_input.c line 359

Quoted 3 lines
drivers/virtio/virtio_input.c new file +3 -0
+static unsigned int features[] = {
+	/* none */
+};

An empty line wouldn't hurt here about variable definition.

Quoted 4 lines
drivers/virtio/virtio_input.c new file +4 -0
+static struct virtio_device_id id_table[] = {
+	{ VIRTIO_ID_INPUT, VIRTIO_DEV_ANY_ID },
+	{ 0 },
+};
#2 lore raw
Quoted 10 lines · Michael S. Tsirkin
Quoted 5 lines · Gerd Hoffmann

virtio-input is basically evdev-events-over-virtio, so this driver isn't much more than reading configuration from config space and forwarding incoming events to the linux input layer.

Still a bit worried about using input.h as host/guest interface (can't we use some formal standard, e.g. USB HID?), but I'll let Rusty decide that.

I like the simplicity, and this API is pretty well proven.

Since this is under drivers/virtio rather than drivers/input, I've applied it to my tree.

I have a dream where Denys Vlasenko adds this and the virtio gl device to lguest, and we have X running under lguest :)

Applied!
Rusty.

#3 lore raw
In reply to Michael S. Tsirkin
Quoted 10 lines · Michael S. Tsirkin
Quoted 5 lines · Gerd Hoffmann

virtio-input is basically evdev-events-over-virtio, so this driver isn't much more than reading configuration from config space and forwarding incoming events to the linux input layer.

Still a bit worried about using input.h as host/guest interface (can't we use some formal standard, e.g. USB HID?), but I'll let Rusty decide that.

I like the simplicity, and this API is pretty well proven.

Since this is under drivers/virtio rather than drivers/input, I've applied it to my tree.

I have a dream where Denys Vlasenko adds this and the virtio gl device to lguest, and we have X running under lguest :)

Applied!
Rusty.

maintainer Acked-by
#4 lore raw
In reply to Michael S. Tsirkin
Quoted 5 lines · Michael S. Tsirkin
Quoted 4 lines · Gerd Hoffmann

virtio-input is basically evdev-events-over-virtio, so this driver isn't much more than reading configuration from config space and forwarding incoming events to the linux input layer.

Quoted 7 lines
Quoted 1 line

Still a bit worried about using input.h as host/guest interface (can't we use some formal standard, e.g. USB HID?), but I'll let Rusty decide that.

Otherwise mostly looks good. One nit below.

Forgot to include:

Quoted 20 lines
Quoted 2 lines

---

Could you pls include changelog in the future?
You are sending multiple versions per day and it's hard to keep up.

drivers/virtio/virtio_input.c line 359

Quoted 3 lines
drivers/virtio/virtio_input.c new file +3 -0
+static unsigned int features[] = {
+	/* none */
+};

An empty line wouldn't hurt here about variable definition.

drivers/virtio/virtio_input.c line 363

Quoted 4 lines
drivers/virtio/virtio_input.c new file +4 -0
+static struct virtio_device_id id_table[] = {
+	{ VIRTIO_ID_INPUT, VIRTIO_DEV_ANY_ID },
+	{ 0 },
+};

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

#5 lore raw
In reply to Gerd Hoffmann
Quoted 5 lines · Gerd Hoffmann

virtio-input is basically evdev-events-over-virtio, so this driver isn't much more than reading configuration from config space and forwarding incoming events to the linux input layer.

Still a bit worried about using input.h as host/guest interface (can't we use some formal standard, e.g. USB HID?), but I'll let Rusty decide that.

Otherwise mostly looks good. One nit below.

Quoted 1 line

---

Could you pls include changelog in the future?
You are sending multiple versions per day and it's hard to keep up.

drivers/virtio/virtio_input.c line 359

Quoted 3 lines
drivers/virtio/virtio_input.c new file +3 -0
+static unsigned int features[] = {
+	/* none */
+};

An empty line wouldn't hurt here about variable definition.

Quoted 4 lines
drivers/virtio/virtio_input.c new file +4 -0
+static struct virtio_device_id id_table[] = {
+	{ VIRTIO_ID_INPUT, VIRTIO_DEV_ANY_ID },
+	{ 0 },
+};