Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/linux
File: uinput.h
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
[0] Fix | Delete
/*
[1] Fix | Delete
* User level driver support for input subsystem
[2] Fix | Delete
*
[3] Fix | Delete
* Heavily based on evdev.c by Vojtech Pavlik
[4] Fix | Delete
*
[5] Fix | Delete
* This program is free software; you can redistribute it and/or modify
[6] Fix | Delete
* it under the terms of the GNU General Public License as published by
[7] Fix | Delete
* the Free Software Foundation; either version 2 of the License, or
[8] Fix | Delete
* (at your option) any later version.
[9] Fix | Delete
*
[10] Fix | Delete
* This program is distributed in the hope that it will be useful,
[11] Fix | Delete
* but WITHOUT ANY WARRANTY; without even the implied warranty of
[12] Fix | Delete
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
[13] Fix | Delete
* GNU General Public License for more details.
[14] Fix | Delete
*
[15] Fix | Delete
* You should have received a copy of the GNU General Public License
[16] Fix | Delete
* along with this program; if not, write to the Free Software
[17] Fix | Delete
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
[18] Fix | Delete
*
[19] Fix | Delete
* Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
[20] Fix | Delete
*
[21] Fix | Delete
* Changes/Revisions:
[22] Fix | Delete
* 0.5 08/13/2015 (David Herrmann <dh.herrmann@gmail.com> &
[23] Fix | Delete
* Benjamin Tissoires <benjamin.tissoires@redhat.com>)
[24] Fix | Delete
* - add UI_DEV_SETUP ioctl
[25] Fix | Delete
* - add UI_ABS_SETUP ioctl
[26] Fix | Delete
* - add UI_GET_VERSION ioctl
[27] Fix | Delete
* 0.4 01/09/2014 (Benjamin Tissoires <benjamin.tissoires@redhat.com>)
[28] Fix | Delete
* - add UI_GET_SYSNAME ioctl
[29] Fix | Delete
* 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>)
[30] Fix | Delete
* - update ff support for the changes in kernel interface
[31] Fix | Delete
* - add UINPUT_VERSION
[32] Fix | Delete
* 0.2 16/10/2004 (Micah Dowty <micah@navi.cx>)
[33] Fix | Delete
* - added force feedback support
[34] Fix | Delete
* - added UI_SET_PHYS
[35] Fix | Delete
* 0.1 20/06/2002
[36] Fix | Delete
* - first public version
[37] Fix | Delete
*/
[38] Fix | Delete
#ifndef __UINPUT_H_
[39] Fix | Delete
#define __UINPUT_H_
[40] Fix | Delete
[41] Fix | Delete
#include <linux/types.h>
[42] Fix | Delete
#include <linux/input.h>
[43] Fix | Delete
[44] Fix | Delete
#define UINPUT_VERSION 5
[45] Fix | Delete
#define UINPUT_MAX_NAME_SIZE 80
[46] Fix | Delete
[47] Fix | Delete
struct uinput_ff_upload {
[48] Fix | Delete
__u32 request_id;
[49] Fix | Delete
__s32 retval;
[50] Fix | Delete
struct ff_effect effect;
[51] Fix | Delete
struct ff_effect old;
[52] Fix | Delete
};
[53] Fix | Delete
[54] Fix | Delete
struct uinput_ff_erase {
[55] Fix | Delete
__u32 request_id;
[56] Fix | Delete
__s32 retval;
[57] Fix | Delete
__u32 effect_id;
[58] Fix | Delete
};
[59] Fix | Delete
[60] Fix | Delete
/* ioctl */
[61] Fix | Delete
#define UINPUT_IOCTL_BASE 'U'
[62] Fix | Delete
#define UI_DEV_CREATE _IO(UINPUT_IOCTL_BASE, 1)
[63] Fix | Delete
#define UI_DEV_DESTROY _IO(UINPUT_IOCTL_BASE, 2)
[64] Fix | Delete
[65] Fix | Delete
struct uinput_setup {
[66] Fix | Delete
struct input_id id;
[67] Fix | Delete
char name[UINPUT_MAX_NAME_SIZE];
[68] Fix | Delete
__u32 ff_effects_max;
[69] Fix | Delete
};
[70] Fix | Delete
[71] Fix | Delete
/**
[72] Fix | Delete
* UI_DEV_SETUP - Set device parameters for setup
[73] Fix | Delete
*
[74] Fix | Delete
* This ioctl sets parameters for the input device to be created. It
[75] Fix | Delete
* supersedes the old "struct uinput_user_dev" method, which wrote this data
[76] Fix | Delete
* via write(). To actually set the absolute axes UI_ABS_SETUP should be
[77] Fix | Delete
* used.
[78] Fix | Delete
*
[79] Fix | Delete
* The ioctl takes a "struct uinput_setup" object as argument. The fields of
[80] Fix | Delete
* this object are as follows:
[81] Fix | Delete
* id: See the description of "struct input_id". This field is
[82] Fix | Delete
* copied unchanged into the new device.
[83] Fix | Delete
* name: This is used unchanged as name for the new device.
[84] Fix | Delete
* ff_effects_max: This limits the maximum numbers of force-feedback effects.
[85] Fix | Delete
* See below for a description of FF with uinput.
[86] Fix | Delete
*
[87] Fix | Delete
* This ioctl can be called multiple times and will overwrite previous values.
[88] Fix | Delete
* If this ioctl fails with -EINVAL, it is recommended to use the old
[89] Fix | Delete
* "uinput_user_dev" method via write() as a fallback, in case you run on an
[90] Fix | Delete
* old kernel that does not support this ioctl.
[91] Fix | Delete
*
[92] Fix | Delete
* This ioctl may fail with -EINVAL if it is not supported or if you passed
[93] Fix | Delete
* incorrect values, -ENOMEM if the kernel runs out of memory or -EFAULT if the
[94] Fix | Delete
* passed uinput_setup object cannot be read/written.
[95] Fix | Delete
* If this call fails, partial data may have already been applied to the
[96] Fix | Delete
* internal device.
[97] Fix | Delete
*/
[98] Fix | Delete
#define UI_DEV_SETUP _IOW(UINPUT_IOCTL_BASE, 3, struct uinput_setup)
[99] Fix | Delete
[100] Fix | Delete
struct uinput_abs_setup {
[101] Fix | Delete
__u16 code; /* axis code */
[102] Fix | Delete
/* __u16 filler; */
[103] Fix | Delete
struct input_absinfo absinfo;
[104] Fix | Delete
};
[105] Fix | Delete
[106] Fix | Delete
/**
[107] Fix | Delete
* UI_ABS_SETUP - Set absolute axis information for the device to setup
[108] Fix | Delete
*
[109] Fix | Delete
* This ioctl sets one absolute axis information for the input device to be
[110] Fix | Delete
* created. It supersedes the old "struct uinput_user_dev" method, which wrote
[111] Fix | Delete
* part of this data and the content of UI_DEV_SETUP via write().
[112] Fix | Delete
*
[113] Fix | Delete
* The ioctl takes a "struct uinput_abs_setup" object as argument. The fields
[114] Fix | Delete
* of this object are as follows:
[115] Fix | Delete
* code: The corresponding input code associated with this axis
[116] Fix | Delete
* (ABS_X, ABS_Y, etc...)
[117] Fix | Delete
* absinfo: See "struct input_absinfo" for a description of this field.
[118] Fix | Delete
* This field is copied unchanged into the kernel for the
[119] Fix | Delete
* specified axis. If the axis is not enabled via
[120] Fix | Delete
* UI_SET_ABSBIT, this ioctl will enable it.
[121] Fix | Delete
*
[122] Fix | Delete
* This ioctl can be called multiple times and will overwrite previous values.
[123] Fix | Delete
* If this ioctl fails with -EINVAL, it is recommended to use the old
[124] Fix | Delete
* "uinput_user_dev" method via write() as a fallback, in case you run on an
[125] Fix | Delete
* old kernel that does not support this ioctl.
[126] Fix | Delete
*
[127] Fix | Delete
* This ioctl may fail with -EINVAL if it is not supported or if you passed
[128] Fix | Delete
* incorrect values, -ENOMEM if the kernel runs out of memory or -EFAULT if the
[129] Fix | Delete
* passed uinput_setup object cannot be read/written.
[130] Fix | Delete
* If this call fails, partial data may have already been applied to the
[131] Fix | Delete
* internal device.
[132] Fix | Delete
*/
[133] Fix | Delete
#define UI_ABS_SETUP _IOW(UINPUT_IOCTL_BASE, 4, struct uinput_abs_setup)
[134] Fix | Delete
[135] Fix | Delete
#define UI_SET_EVBIT _IOW(UINPUT_IOCTL_BASE, 100, int)
[136] Fix | Delete
#define UI_SET_KEYBIT _IOW(UINPUT_IOCTL_BASE, 101, int)
[137] Fix | Delete
#define UI_SET_RELBIT _IOW(UINPUT_IOCTL_BASE, 102, int)
[138] Fix | Delete
#define UI_SET_ABSBIT _IOW(UINPUT_IOCTL_BASE, 103, int)
[139] Fix | Delete
#define UI_SET_MSCBIT _IOW(UINPUT_IOCTL_BASE, 104, int)
[140] Fix | Delete
#define UI_SET_LEDBIT _IOW(UINPUT_IOCTL_BASE, 105, int)
[141] Fix | Delete
#define UI_SET_SNDBIT _IOW(UINPUT_IOCTL_BASE, 106, int)
[142] Fix | Delete
#define UI_SET_FFBIT _IOW(UINPUT_IOCTL_BASE, 107, int)
[143] Fix | Delete
#define UI_SET_PHYS _IOW(UINPUT_IOCTL_BASE, 108, char*)
[144] Fix | Delete
#define UI_SET_SWBIT _IOW(UINPUT_IOCTL_BASE, 109, int)
[145] Fix | Delete
#define UI_SET_PROPBIT _IOW(UINPUT_IOCTL_BASE, 110, int)
[146] Fix | Delete
[147] Fix | Delete
#define UI_BEGIN_FF_UPLOAD _IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload)
[148] Fix | Delete
#define UI_END_FF_UPLOAD _IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload)
[149] Fix | Delete
#define UI_BEGIN_FF_ERASE _IOWR(UINPUT_IOCTL_BASE, 202, struct uinput_ff_erase)
[150] Fix | Delete
#define UI_END_FF_ERASE _IOW(UINPUT_IOCTL_BASE, 203, struct uinput_ff_erase)
[151] Fix | Delete
[152] Fix | Delete
/**
[153] Fix | Delete
* UI_GET_SYSNAME - get the sysfs name of the created uinput device
[154] Fix | Delete
*
[155] Fix | Delete
* @return the sysfs name of the created virtual input device.
[156] Fix | Delete
* The complete sysfs path is then /sys/devices/virtual/input/--NAME--
[157] Fix | Delete
* Usually, it is in the form "inputN"
[158] Fix | Delete
*/
[159] Fix | Delete
#define UI_GET_SYSNAME(len) _IOC(_IOC_READ, UINPUT_IOCTL_BASE, 44, len)
[160] Fix | Delete
[161] Fix | Delete
/**
[162] Fix | Delete
* UI_GET_VERSION - Return version of uinput protocol
[163] Fix | Delete
*
[164] Fix | Delete
* This writes uinput protocol version implemented by the kernel into
[165] Fix | Delete
* the integer pointed to by the ioctl argument. The protocol version
[166] Fix | Delete
* is hard-coded in the kernel and is independent of the uinput device.
[167] Fix | Delete
*/
[168] Fix | Delete
#define UI_GET_VERSION _IOR(UINPUT_IOCTL_BASE, 45, unsigned int)
[169] Fix | Delete
[170] Fix | Delete
/*
[171] Fix | Delete
* To write a force-feedback-capable driver, the upload_effect
[172] Fix | Delete
* and erase_effect callbacks in input_dev must be implemented.
[173] Fix | Delete
* The uinput driver will generate a fake input event when one of
[174] Fix | Delete
* these callbacks are invoked. The userspace code then uses
[175] Fix | Delete
* ioctls to retrieve additional parameters and send the return code.
[176] Fix | Delete
* The callback blocks until this return code is sent.
[177] Fix | Delete
*
[178] Fix | Delete
* The described callback mechanism is only used if ff_effects_max
[179] Fix | Delete
* is set.
[180] Fix | Delete
*
[181] Fix | Delete
* To implement upload_effect():
[182] Fix | Delete
* 1. Wait for an event with type == EV_UINPUT and code == UI_FF_UPLOAD.
[183] Fix | Delete
* A request ID will be given in 'value'.
[184] Fix | Delete
* 2. Allocate a uinput_ff_upload struct, fill in request_id with
[185] Fix | Delete
* the 'value' from the EV_UINPUT event.
[186] Fix | Delete
* 3. Issue a UI_BEGIN_FF_UPLOAD ioctl, giving it the
[187] Fix | Delete
* uinput_ff_upload struct. It will be filled in with the
[188] Fix | Delete
* ff_effects passed to upload_effect().
[189] Fix | Delete
* 4. Perform the effect upload, and place a return code back into
[190] Fix | Delete
the uinput_ff_upload struct.
[191] Fix | Delete
* 5. Issue a UI_END_FF_UPLOAD ioctl, also giving it the
[192] Fix | Delete
* uinput_ff_upload_effect struct. This will complete execution
[193] Fix | Delete
* of our upload_effect() handler.
[194] Fix | Delete
*
[195] Fix | Delete
* To implement erase_effect():
[196] Fix | Delete
* 1. Wait for an event with type == EV_UINPUT and code == UI_FF_ERASE.
[197] Fix | Delete
* A request ID will be given in 'value'.
[198] Fix | Delete
* 2. Allocate a uinput_ff_erase struct, fill in request_id with
[199] Fix | Delete
* the 'value' from the EV_UINPUT event.
[200] Fix | Delete
* 3. Issue a UI_BEGIN_FF_ERASE ioctl, giving it the
[201] Fix | Delete
* uinput_ff_erase struct. It will be filled in with the
[202] Fix | Delete
* effect ID passed to erase_effect().
[203] Fix | Delete
* 4. Perform the effect erasure, and place a return code back
[204] Fix | Delete
* into the uinput_ff_erase struct.
[205] Fix | Delete
* 5. Issue a UI_END_FF_ERASE ioctl, also giving it the
[206] Fix | Delete
* uinput_ff_erase_effect struct. This will complete execution
[207] Fix | Delete
* of our erase_effect() handler.
[208] Fix | Delete
*/
[209] Fix | Delete
[210] Fix | Delete
/*
[211] Fix | Delete
* This is the new event type, used only by uinput.
[212] Fix | Delete
* 'code' is UI_FF_UPLOAD or UI_FF_ERASE, and 'value'
[213] Fix | Delete
* is the unique request ID. This number was picked
[214] Fix | Delete
* arbitrarily, above EV_MAX (since the input system
[215] Fix | Delete
* never sees it) but in the range of a 16-bit int.
[216] Fix | Delete
*/
[217] Fix | Delete
#define EV_UINPUT 0x0101
[218] Fix | Delete
#define UI_FF_UPLOAD 1
[219] Fix | Delete
#define UI_FF_ERASE 2
[220] Fix | Delete
[221] Fix | Delete
struct uinput_user_dev {
[222] Fix | Delete
char name[UINPUT_MAX_NAME_SIZE];
[223] Fix | Delete
struct input_id id;
[224] Fix | Delete
__u32 ff_effects_max;
[225] Fix | Delete
__s32 absmax[ABS_CNT];
[226] Fix | Delete
__s32 absmin[ABS_CNT];
[227] Fix | Delete
__s32 absfuzz[ABS_CNT];
[228] Fix | Delete
__s32 absflat[ABS_CNT];
[229] Fix | Delete
};
[230] Fix | Delete
#endif /* __UINPUT_H_ */
[231] Fix | Delete
[232] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function