FreeBSD/Linux Kernel Cross Reference
sys/dev/evdev/uinput.h
1 /*-
2 * Copyright (c) 2016 Oleksandr Tymoshenko <gonzo@FreeBSD.org>
3 * Copyright (c) 2015-2016 Vladimir Kondratyev <wulf@FreeBSD.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD$
28 */
29
30 #ifndef _EVDEV_UINPUT_H_
31 #define _EVDEV_UINPUT_H_
32
33 #include <sys/types.h>
34 #include <dev/evdev/input.h>
35
36 #define UINPUT_VERSION 5
37 #define UINPUT_MAX_NAME_SIZE 80
38
39 struct uinput_ff_upload {
40 uint32_t request_id;
41 int32_t retval;
42 struct ff_effect effect;
43 struct ff_effect old;
44 };
45
46 struct uinput_ff_erase {
47 uint32_t request_id;
48 int32_t retval;
49 uint32_t effect_id;
50 };
51
52 /* ioctl */
53 #define UINPUT_IOCTL_BASE 'U'
54
55 #define UI_DEV_CREATE _IO(UINPUT_IOCTL_BASE, 1)
56 #define UI_DEV_DESTROY _IO(UINPUT_IOCTL_BASE, 2)
57
58 struct uinput_setup {
59 struct input_id id;
60 char name[UINPUT_MAX_NAME_SIZE];
61 uint32_t ff_effects_max;
62 };
63
64 #define UI_DEV_SETUP _IOW(UINPUT_IOCTL_BASE, 3, struct uinput_setup)
65
66 struct uinput_abs_setup {
67 uint16_t code; /* axis code */
68 struct input_absinfo absinfo;
69 };
70
71 #define UI_ABS_SETUP _IOW(UINPUT_IOCTL_BASE, 4, struct uinput_abs_setup)
72
73 #define UI_GET_SYSNAME(len) _IOC(IOC_OUT, UINPUT_IOCTL_BASE, 44, len)
74 #define UI_GET_VERSION _IOR(UINPUT_IOCTL_BASE, 45, unsigned int)
75
76 #define UI_SET_EVBIT _IOWINT(UINPUT_IOCTL_BASE, 100)
77 #define UI_SET_KEYBIT _IOWINT(UINPUT_IOCTL_BASE, 101)
78 #define UI_SET_RELBIT _IOWINT(UINPUT_IOCTL_BASE, 102)
79 #define UI_SET_ABSBIT _IOWINT(UINPUT_IOCTL_BASE, 103)
80 #define UI_SET_MSCBIT _IOWINT(UINPUT_IOCTL_BASE, 104)
81 #define UI_SET_LEDBIT _IOWINT(UINPUT_IOCTL_BASE, 105)
82 #define UI_SET_SNDBIT _IOWINT(UINPUT_IOCTL_BASE, 106)
83 #define UI_SET_FFBIT _IOWINT(UINPUT_IOCTL_BASE, 107)
84 #define UI_SET_PHYS _IO(UINPUT_IOCTL_BASE, 108)
85 #define UI_SET_SWBIT _IOWINT(UINPUT_IOCTL_BASE, 109)
86 #define UI_SET_PROPBIT _IOWINT(UINPUT_IOCTL_BASE, 110)
87
88 #define UI_BEGIN_FF_UPLOAD _IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload)
89 #define UI_END_FF_UPLOAD _IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload)
90 #define UI_BEGIN_FF_ERASE _IOWR(UINPUT_IOCTL_BASE, 202, struct uinput_ff_erase)
91 #define UI_END_FF_ERASE _IOW(UINPUT_IOCTL_BASE, 203, struct uinput_ff_erase)
92
93 /*
94 * FreeBSD specific. Set unique identifier of input device.
95 * Name and magic are chosen to reduce chances of clashing
96 * with possible future Linux extensions.
97 */
98 #define UI_SET_BSDUNIQ _IO(UINPUT_IOCTL_BASE, 109)
99
100 #define EV_UINPUT 0x0101
101 #define UI_FF_UPLOAD 1
102 #define UI_FF_ERASE 2
103
104 struct uinput_user_dev {
105 char name[UINPUT_MAX_NAME_SIZE];
106 struct input_id id;
107 uint32_t ff_effects_max;
108 int32_t absmax[ABS_CNT];
109 int32_t absmin[ABS_CNT];
110 int32_t absfuzz[ABS_CNT];
111 int32_t absflat[ABS_CNT];
112 };
113
114 #endif /* _EVDEV_UINPUT_H_ */
Cache object: 84c3fa0324069e222d3d1c474f7ba3a5
|