vdev virtio-input

Updated: April 19, 2023

Create an interface for input devices

Synopsis

vdev virtio-input [display display_id]
                  [force_dev_presence enabled]
                  [global_alpha number]
                  [loc addr intr guest_intr]
                  [offset x_offset,y_offset]
                  [options [+|-]bitmask]
                  [pipeline number]
                  [protocol b]
                  [sched priority]
                  [size x_dimension,y_dimension]
                  [window window_id]
                  [zorder zorder]
                  screen input_type

Options

display display_id
Create an internal transparent window on the specified display to catch all input events from this window and forward them to the guest.

This option is ignored if window is defined, because an external window is used in this case. If you don't provide display or window, by default, an internal window on the default display is created.

force_dev_presence enabled
Specify true if it's necessary to initialize the front end when no physical device is present. If not specified, the default value is false. Currently, this is supported only by the keyboard device.
global_alpha number
Specify the global alpha (SCREEN_PROPERTY_GLOBAL_ALPHA) for the internal transparent window. This option is ignored if the window option is defined, because an external window is used in this case.
intr guest_intr
Set the guest interrupt for this virtual device; include this option only if you also include the loc option.

The guest_intr argument consists of two colon-separated components:

  1. the identifier of the name of the guest device Programmable Interrupt Controller (PIC)
  2. the input line that is asserted when the interrupting device wishes to raise an interrupt

For example: gic:43

For more information on setting guest interrupts, see the section on “Configuring guests” in the QNX Hypervisor User's Guide.

loc addr
Set the device space address to addr. The addr argument is typically specified in hexadecimal.

If you include this option, the vdev presents itself to the guest as a memory-mapped I/O (MMIO) device at the location specified by addr. Otherwise, the vdev presents itself as a PCI device.

You must use this option with the intr option.

offset x_offset,y_offset

Adjust the x and y coordinates of all events by x_offset and y_offset, respectively. Both arguments are specified in pixels.

The guest will see the events at the adjusted coordinates (x+x_offset, y+y_offset).

In most cases, you don't need to use this option. It can be useful, however, if the display coordinates of the guest's window are offset from those of the hardware display.

options [+|-]bitmask
Apply the specified bitmask of options. The optional prefixes, + and -, add or clear the bits in the default bitmask. For instance, if you specify options +0x80, this sets bit 7 (VI_DEV_SENSITIVITY_CONTINUE) if it's not already set. Similarly, if you specify options -0x80, this unsets bit 7 if it's not already unset. If neither prefix is used (e.g., options 0x80), then options would be set to the bitmask (0x80).

By default, options is set to 0x12. The rest of the bits are set according to the device. For instance, if the virtio-input vdev presents itself as a mouse (see the screen option), it sets the VI_DEV_POINTER_AS_MOUSE bit when it receives a SCREEN_EVENT_POINTER event.

In most cases, you don't need to use the options option.

Option Bitmask
VI_DEV_EVSYN_MULTIPLE 0x0001
VI_DEV_EVSYN_ALWAYS 0x0002
VI_DEV_POINTER_AS_MOUSE 0x0004
VI_DEV_POINTER_HAS_WHEEL 0x0008
VI_DEV_0FILL (where 0 is zero) 0x0010
VI_DEV_TOUCH_ST 0x0020
VI_DEV_TOUCH_MT 0x0040
VI_DEV_SENSITIVITY_CONTINUE 0x0080
VI_DEV_ALL_OPTIONS 0x00ff
pipeline number
Specify the pipeline (SCREEN_PROPERTY_PIPELINE) for the internal transparent window. This option is ignored if the window option is defined, because an external window is used in this case.
protocol b

Change the protocol from type A to type B. The default protocol is type A.

This option makes the vdev use the part of the multi-touch (MT) protocol that supports type B devices, which are those devices capable of tracking identifiable contacts. In this case, the protocol describes how to send updates for individual contacts via event slots. For more information, see https://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txt.

Note: Earlier Android versions up to version 11 do not by default support type B devices. To support these devices in earlier versions, you must apply the following kernel patch: https://github.com/torvalds/linux/commit/16c10bede8b3d8594279752bf53153491f3f944f. For later Android versions, this patch is not needed.
sched priority
Set the priority of the pulses that the VM generates to indicate that new input is available. The default is 10.

In most cases, you can omit this option.

screen input_type

Set the device input type. This option is required.

This option tells the virtual device how to present itself to the guest driver. You can specify one of the following values:
keyboard
Appear as a keyboard device.
mouse|pointer
Appear as a pointing device with buttons.
Specifying mouse tells the virtual device to issue relative coordinates; specifying pointer tells it to issue absolute ones.
touch|touchscreen
single-touch|multi-touch
Appear as a touchscreen device.
The touch and touchscreen arguments are aliases; either form tells the virtual device to appear as a touchscreen.
If you specify single-touch, the virtual device captures only the first touch point of every multitouch event; if you specify multi-touch, the virtual device captures all the touch points of every multitouch event, up to a maximum of 5 points. If you specify neither of these arguments, the virtual device automatically selects the protocol according to the reported maximum number of touch points.
Here's an example of how you can advertise the virtual device as a multitouch device:
screen touch
screen multi-touch
*
Capture all input events. The guest will see all supported input devices and receive the events related to them.
size x_dimension,y_dimension
Advertise the physical size of an absolute-coordinate device (either pointer or touchscreen) as x_dimension and y_dimension. Both arguments are specified in pixels.
If you specify the window option, the vdev can automatically determine the physical size of the device and you can omit the size option. Otherwise, you must specify the size option.
window window_id
Read all input events from the specified external window and forward them to the guest.
The window_id argument takes the SCREEN_PROPERTY_ID_STRING of the window that you want to read events from. See the Screen Developer's Guide to learn more about this string and how to retrieve it.
If you omit this option, the vdev creates a full-screen input region, reads all input events from the region, and then forwards them to the guest.
zorder zorder
Specify the z-order (SCREEN_PROPERTY_ZORDER) for the internal transparent window. The default value for this window is 1000.

This option is ignored if window is defined, because an external window is used in this case.

Description

(ARM and x86) The input vdev creates an interface for input devices. It supports USB keyboards, USB mice, and touch input devices.

Normally, the vdev appears as a PCI device on x86. But if you specify the loc and intr options, the guest will see the vdev as a memory-mapped I/O (MMIO) device at the location specified by loc.

You can specify up to three input devs in a VM configuration, where each vdev presents itself as a different device to the guest. See Configuration examples for more information.

Note: At least one physical input device must be connected to your host system. The vdev expects to find an input device; if it doesn't, the vdev prevents the qvm process from starting.