From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: virtio-dev@lists.oasis-open.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH spec] Add virtio input device specification
Date: Thu, 10 Apr 2014 11:07:47 +0200 [thread overview]
Message-ID: <1397120874-17166-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1397120874-17166-1-git-send-email-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
content.tex | 2 +
virtio-input.tex | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 137 insertions(+)
create mode 100644 virtio-input.tex
diff --git a/content.tex b/content.tex
index c31a99e..196950d 100644
--- a/content.tex
+++ b/content.tex
@@ -4887,6 +4887,8 @@ descriptor for the \field{sense_len}, \field{residual},
\field{status_qualifier}, \field{status}, \field{response} and
\field{sense} fields.
+\input{virtio-input.tex}
+
\chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
Currently there are three device-independent feature bits defined:
diff --git a/virtio-input.tex b/virtio-input.tex
new file mode 100644
index 0000000..3c34a52
--- /dev/null
+++ b/virtio-input.tex
@@ -0,0 +1,135 @@
+\section{Input Device}\label{sec:Device Types / Input Device}
+
+The virtio input device can be used to create virtual human interface
+devices such as keyboards, mice and tables. It basically sends linux
+input layer events over virtio.
+See \url{file:///usr/include/linux/input.h}.
+
+\subsection{Device ID}\label{sec:Device Types / Input Device / Device ID}
+
+18
+
+\subsection{Virtqueues}\label{sec:Device Types / Input Device / Virtqueues}
+
+\begin{description}
+\item[0] eventq
+\item[1] statusq
+\end{description}
+
+\subsection{Feature bits}\label{sec:Device Types / Input Device / Feature bits}
+
+None.
+
+\subsection{Device configuration layout}\label{sec:Device Types / Input Device / Device configuration layout}
+
+Device configuration holds all information the guest needs to handle
+the device, most importantly the events which are supported.
+
+\begin{lstlisting}
+enum virtio_input_config_select {
+ VIRTIO_INPUT_CFG_UNSET = 0x00,
+ VIRTIO_INPUT_CFG_ID_NAME = 0x01,
+ VIRTIO_INPUT_CFG_ID_SERIAL = 0x02,
+ VIRTIO_INPUT_CFG_ID_SEAT = 0x03,
+ VIRTIO_INPUT_CFG_PROP_BITS = 0x10,
+ VIRTIO_INPUT_CFG_EV_BITS = 0x11,
+ VIRTIO_INPUT_CFG_ABS_INFO = 0x12,
+};
+
+struct virtio_input_absinfo {
+ le32 min;
+ le32 max;
+ le32 fuzz;
+ le32 flat;
+};
+
+struct virtio_input_config {
+ u8 select;
+ u8 subsel;
+ u8 size;
+ u8 reserved;
+ union {
+ char string[128];
+ u8 bitmap[128];
+ struct virtio_input_absinfo abs;
+ } u;
+};
+\end{lstlisting}
+
+To query a specific piece of information the driver MUST set
+\field{select} and \field{subsel} accordingly, then check \field{size}
+to see and how much information is available. \field{size} can be
+zero if no information is available.
+
+\begin{description}
+
+\item[VIRTIO_INPUT_CFG_ID_NAME]
+\field{subsel} is not used and MUST be zero.
+Returns the name of the device, in \field{u.string}.
+
+Same as EVIOCGNAME ioctl for linux evdev devices.
+
+\item[VIRTIO_INPUT_CFG_ID_SERIAL]
+\field{subsel} is not used and MUST be zero.
+Returns the serial number of the device, in \field{u.string}.
+
+\item[VIRTIO_INPUT_CFG_ID_SEAT]
+\field{subsel} is not used and MUST be zero.
+Returns the seat the device should be assigned to, in \field{u.string}.
+
+\item[VIRTIO_INPUT_CFG_PROP_BITS]
+\field{subsel} is not used and MUST be zero.
+Returns input properties (INPUT_PROP_*) of the device, in \field{u.bitmap}.
+
+\item[VIRTIO_INPUT_CFG_EV_BITS]
+\field{subsel} specifies the event type (EV_*). If \field{size} is
+non-zero the event type is supported and a bitmap the of supported
+event codes is returned in \field{u.bitmap}.
+
+Same as EVIOCGBIT ioctl.
+
+\item[VIRTIO_INPUT_CFG_ABS_INFO]
+\field{subsel} specifies the absolute axes (ABS_*).
+Informations about the axis will be returned in \field{u.abs}.
+
+Same as EVIOCGABS ioctl.
+
+\end{description}
+
+\subsection{Device Initialization}\label{sec:Device Types / Input Device / Device Initialization}
+
+\begin{enumerate}
+\item The device is queried for supported event types and codes.
+\item The eventq is populated with receive buffers.
+\end{enumerate}
+
+\subsection{Device Operation}\label{sec:Device Types / Input Device / Device Operation}
+
+\begin{enumerate}
+\item Input events such as press and release events for keys and
+ buttons and motion events are send from the device to the driver
+ using the eventq.
+\item Status feedback such as keyboard led updates are sent from the
+ driver to the device using the statusq.
+\item Both queues use the same virtio_input_event struct.
+ \field{type}, \field{code} and \field{value} are filled according to
+ the linux input layer (evdev) interface, except that the fields are
+ in little endian byte order whereas the evdev ioctl interface uses
+ native endian.
+\end{enumerate}
+
+\begin{lstlisting}
+struct virtio_input_event {
+ le16 type;
+ le16 code;
+ le32 value;
+};
+\end{lstlisting}
+
+\subsection{TODO List}\label{sec:Device Types / Input Device / TODO List}
+
+\begin{description}
+\item[Multitouch]
+Just EVIOCGMTSLOTS -> cfgspace I think.
+Maybe add feature flag for this?
+\end{description}
--
1.8.3.1
next prev parent reply other threads:[~2014-04-10 9:08 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-10 9:07 [Qemu-devel] [PATCHES] add virtio input device Gerd Hoffmann
2014-04-10 9:07 ` Gerd Hoffmann [this message]
2014-04-10 15:36 ` [Qemu-devel] [PATCH spec] Add virtio input device specification Christopher Covington
2014-04-10 9:07 ` [Qemu-devel] [PATCH linux] Add virtio-input driver Gerd Hoffmann
2014-04-10 9:07 ` [Qemu-devel] [PATCH qemu 1/6] pci: add virtio input pci device id Gerd Hoffmann
2014-04-10 9:07 ` [Qemu-devel] [PATCH qemu 2/6] pci: add virtio gpu " Gerd Hoffmann
2014-04-10 9:07 ` [Qemu-devel] [PATCH qemu 3/6] virtio-input: core code & base class Gerd Hoffmann
2014-04-10 11:06 ` Michael S. Tsirkin
2014-04-10 12:22 ` Gerd Hoffmann
2014-04-10 14:56 ` Michael S. Tsirkin
2014-04-11 7:17 ` Gerd Hoffmann
2014-04-10 9:07 ` [Qemu-devel] [PATCH qemu 4/6] virtio-input: emulated devices Gerd Hoffmann
2014-04-10 10:55 ` Michael S. Tsirkin
2014-04-10 11:47 ` Gerd Hoffmann
2014-04-10 15:14 ` Michael S. Tsirkin
2014-04-11 8:01 ` Gerd Hoffmann
2014-04-10 9:07 ` [Qemu-devel] [PATCH qemu 5/6] virtio-input: control device Gerd Hoffmann
2014-04-10 11:05 ` Michael S. Tsirkin
2014-04-10 12:10 ` Gerd Hoffmann
2014-04-10 15:20 ` Michael S. Tsirkin
2014-04-11 8:25 ` Gerd Hoffmann
2014-04-10 9:07 ` [Qemu-devel] [PATCH qemu 6/6] virtio-input: evdev passthrough Gerd Hoffmann
2014-04-10 11:05 ` Michael S. Tsirkin
2014-04-10 11:57 ` Gerd Hoffmann
2014-04-10 15:16 ` Michael S. Tsirkin
2014-04-11 8:02 ` Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1397120874-17166-2-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=virtio-dev@lists.oasis-open.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).