xref: /openbmc/qemu/subprojects/libvduse/standard-headers/linux/virtio_input.h (revision 498147529d1f8e902e6528a0115143b53475791e)
1*7a52ce8aSCornelia Huck #ifndef _LINUX_VIRTIO_INPUT_H
2*7a52ce8aSCornelia Huck #define _LINUX_VIRTIO_INPUT_H
3*7a52ce8aSCornelia Huck /* This header is BSD licensed so anyone can use the definitions to implement
4*7a52ce8aSCornelia Huck  * compatible drivers/servers.
5*7a52ce8aSCornelia Huck  *
6*7a52ce8aSCornelia Huck  * Redistribution and use in source and binary forms, with or without
7*7a52ce8aSCornelia Huck  * modification, are permitted provided that the following conditions
8*7a52ce8aSCornelia Huck  * are met:
9*7a52ce8aSCornelia Huck  * 1. Redistributions of source code must retain the above copyright
10*7a52ce8aSCornelia Huck  *    notice, this list of conditions and the following disclaimer.
11*7a52ce8aSCornelia Huck  * 2. Redistributions in binary form must reproduce the above copyright
12*7a52ce8aSCornelia Huck  *    notice, this list of conditions and the following disclaimer in the
13*7a52ce8aSCornelia Huck  *    documentation and/or other materials provided with the distribution.
14*7a52ce8aSCornelia Huck  * 3. Neither the name of IBM nor the names of its contributors
15*7a52ce8aSCornelia Huck  *    may be used to endorse or promote products derived from this software
16*7a52ce8aSCornelia Huck  *    without specific prior written permission.
17*7a52ce8aSCornelia Huck  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18*7a52ce8aSCornelia Huck  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19*7a52ce8aSCornelia Huck  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20*7a52ce8aSCornelia Huck  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR
21*7a52ce8aSCornelia Huck  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22*7a52ce8aSCornelia Huck  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23*7a52ce8aSCornelia Huck  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24*7a52ce8aSCornelia Huck  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25*7a52ce8aSCornelia Huck  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26*7a52ce8aSCornelia Huck  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
27*7a52ce8aSCornelia Huck  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28*7a52ce8aSCornelia Huck  * SUCH DAMAGE. */
29*7a52ce8aSCornelia Huck 
30*7a52ce8aSCornelia Huck #include "standard-headers/linux/types.h"
31*7a52ce8aSCornelia Huck 
32*7a52ce8aSCornelia Huck enum virtio_input_config_select {
33*7a52ce8aSCornelia Huck 	VIRTIO_INPUT_CFG_UNSET      = 0x00,
34*7a52ce8aSCornelia Huck 	VIRTIO_INPUT_CFG_ID_NAME    = 0x01,
35*7a52ce8aSCornelia Huck 	VIRTIO_INPUT_CFG_ID_SERIAL  = 0x02,
36*7a52ce8aSCornelia Huck 	VIRTIO_INPUT_CFG_ID_DEVIDS  = 0x03,
37*7a52ce8aSCornelia Huck 	VIRTIO_INPUT_CFG_PROP_BITS  = 0x10,
38*7a52ce8aSCornelia Huck 	VIRTIO_INPUT_CFG_EV_BITS    = 0x11,
39*7a52ce8aSCornelia Huck 	VIRTIO_INPUT_CFG_ABS_INFO   = 0x12,
40*7a52ce8aSCornelia Huck };
41*7a52ce8aSCornelia Huck 
42*7a52ce8aSCornelia Huck struct virtio_input_absinfo {
43*7a52ce8aSCornelia Huck 	uint32_t min;
44*7a52ce8aSCornelia Huck 	uint32_t max;
45*7a52ce8aSCornelia Huck 	uint32_t fuzz;
46*7a52ce8aSCornelia Huck 	uint32_t flat;
47*7a52ce8aSCornelia Huck 	uint32_t res;
48*7a52ce8aSCornelia Huck };
49*7a52ce8aSCornelia Huck 
50*7a52ce8aSCornelia Huck struct virtio_input_devids {
51*7a52ce8aSCornelia Huck 	uint16_t bustype;
52*7a52ce8aSCornelia Huck 	uint16_t vendor;
53*7a52ce8aSCornelia Huck 	uint16_t product;
54*7a52ce8aSCornelia Huck 	uint16_t version;
55*7a52ce8aSCornelia Huck };
56*7a52ce8aSCornelia Huck 
57*7a52ce8aSCornelia Huck struct virtio_input_config {
58*7a52ce8aSCornelia Huck 	uint8_t    select;
59*7a52ce8aSCornelia Huck 	uint8_t    subsel;
60*7a52ce8aSCornelia Huck 	uint8_t    size;
61*7a52ce8aSCornelia Huck 	uint8_t    reserved[5];
62*7a52ce8aSCornelia Huck 	union {
63*7a52ce8aSCornelia Huck 		char string[128];
64*7a52ce8aSCornelia Huck 		uint8_t bitmap[128];
65*7a52ce8aSCornelia Huck 		struct virtio_input_absinfo abs;
66*7a52ce8aSCornelia Huck 		struct virtio_input_devids ids;
67*7a52ce8aSCornelia Huck 	} u;
68*7a52ce8aSCornelia Huck };
69*7a52ce8aSCornelia Huck 
70*7a52ce8aSCornelia Huck struct virtio_input_event {
71*7a52ce8aSCornelia Huck 	uint16_t type;
72*7a52ce8aSCornelia Huck 	uint16_t code;
73*7a52ce8aSCornelia Huck 	uint32_t value;
74*7a52ce8aSCornelia Huck };
75*7a52ce8aSCornelia Huck 
76*7a52ce8aSCornelia Huck #endif /* _LINUX_VIRTIO_INPUT_H */
77