XenevaOS
Loading...
Searching...
No Matches
Classes | Macros
input.h File Reference
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <linux/types.h>
#include "input-event-codes.h"
Include dependency graph for input.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  input_event
 
struct  input_id
 
struct  input_absinfo
 
struct  input_keymap_entry
 
struct  input_mask
 
struct  ff_replay
 
struct  ff_trigger
 
struct  ff_envelope
 
struct  ff_constant_effect
 
struct  ff_ramp_effect
 
struct  ff_condition_effect
 
struct  ff_periodic_effect
 
struct  ff_rumble_effect
 
struct  ff_haptic_effect
 
struct  ff_effect
 

Macros

#define input_event_sec   time.tv_sec
 
#define input_event_usec   time.tv_usec
 
#define EV_VERSION   0x010001
 
#define INPUT_KEYMAP_BY_INDEX   (1 << 0)
 
#define EVIOCGVERSION   _IOR('E', 0x01, int) /* get driver version */
 
#define EVIOCGID   _IOR('E', 0x02, struct input_id) /* get device ID */
 
#define EVIOCGREP   _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */
 
#define EVIOCSREP   _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */
 
#define EVIOCGKEYCODE   _IOR('E', 0x04, unsigned int[2]) /* get keycode */
 
#define EVIOCGKEYCODE_V2   _IOR('E', 0x04, struct input_keymap_entry)
 
#define EVIOCSKEYCODE   _IOW('E', 0x04, unsigned int[2]) /* set keycode */
 
#define EVIOCSKEYCODE_V2   _IOW('E', 0x04, struct input_keymap_entry)
 
#define EVIOCGNAME(len)   _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */
 
#define EVIOCGPHYS(len)   _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */
 
#define EVIOCGUNIQ(len)   _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */
 
#define EVIOCGPROP(len)   _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */
 
#define EVIOCGMTSLOTS(len)   _IOC(_IOC_READ, 'E', 0x0a, len)
 
#define EVIOCGKEY(len)   _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */
 
#define EVIOCGLED(len)   _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */
 
#define EVIOCGSND(len)   _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */
 
#define EVIOCGSW(len)   _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */
 
#define EVIOCGBIT(ev, len)   _IOC(_IOC_READ, 'E', 0x20 + (ev), len) /* get event bits */
 
#define EVIOCGABS(abs)   _IOR('E', 0x40 + (abs), struct input_absinfo) /* get abs value/limits */
 
#define EVIOCSABS(abs)   _IOW('E', 0xc0 + (abs), struct input_absinfo) /* set abs value/limits */
 
#define EVIOCSFF   _IOW('E', 0x80, struct ff_effect) /* send a force effect to a force feedback device */
 
#define EVIOCRMFF   _IOW('E', 0x81, int) /* Erase a force effect */
 
#define EVIOCGEFFECTS   _IOR('E', 0x84, int) /* Report number of effects playable at the same time */
 
#define EVIOCGRAB   _IOW('E', 0x90, int) /* Grab/Release device */
 
#define EVIOCREVOKE   _IOW('E', 0x91, int) /* Revoke device access */
 
#define EVIOCGMASK   _IOR('E', 0x92, struct input_mask) /* Get event-masks */
 
#define EVIOCSMASK   _IOW('E', 0x93, struct input_mask) /* Set event-masks */
 
#define EVIOCSCLOCKID   _IOW('E', 0xa0, int) /* Set clockid to be used for timestamps */
 
#define ID_BUS   0
 
#define ID_VENDOR   1
 
#define ID_PRODUCT   2
 
#define ID_VERSION   3
 
#define BUS_PCI   0x01
 
#define BUS_ISAPNP   0x02
 
#define BUS_USB   0x03
 
#define BUS_HIL   0x04
 
#define BUS_BLUETOOTH   0x05
 
#define BUS_VIRTUAL   0x06
 
#define BUS_ISA   0x10
 
#define BUS_I8042   0x11
 
#define BUS_XTKBD   0x12
 
#define BUS_RS232   0x13
 
#define BUS_GAMEPORT   0x14
 
#define BUS_PARPORT   0x15
 
#define BUS_AMIGA   0x16
 
#define BUS_ADB   0x17
 
#define BUS_I2C   0x18
 
#define BUS_HOST   0x19
 
#define BUS_GSC   0x1A
 
#define BUS_ATARI   0x1B
 
#define BUS_SPI   0x1C
 
#define BUS_RMI   0x1D
 
#define BUS_CEC   0x1E
 
#define BUS_INTEL_ISHTP   0x1F
 
#define BUS_AMD_SFH   0x20
 
#define BUS_SDW   0x21
 
#define MT_TOOL_FINGER   0x00
 
#define MT_TOOL_PEN   0x01
 
#define MT_TOOL_PALM   0x02
 
#define MT_TOOL_DIAL   0x0a
 
#define MT_TOOL_MAX   0x0f
 
#define FF_STATUS_STOPPED   0x00
 
#define FF_STATUS_PLAYING   0x01
 
#define FF_STATUS_MAX   0x01
 
#define FF_HAPTIC   0x4f
 
#define FF_RUMBLE   0x50
 
#define FF_PERIODIC   0x51
 
#define FF_CONSTANT   0x52
 
#define FF_SPRING   0x53
 
#define FF_FRICTION   0x54
 
#define FF_DAMPER   0x55
 
#define FF_INERTIA   0x56
 
#define FF_RAMP   0x57
 
#define FF_EFFECT_MIN   FF_HAPTIC
 
#define FF_EFFECT_MAX   FF_RAMP
 
#define FF_SQUARE   0x58
 
#define FF_TRIANGLE   0x59
 
#define FF_SINE   0x5a
 
#define FF_SAW_UP   0x5b
 
#define FF_SAW_DOWN   0x5c
 
#define FF_CUSTOM   0x5d
 
#define FF_WAVEFORM_MIN   FF_SQUARE
 
#define FF_WAVEFORM_MAX   FF_CUSTOM
 
#define FF_GAIN   0x60
 
#define FF_AUTOCENTER   0x61
 
#define FF_MAX_EFFECTS   FF_GAIN
 
#define FF_MAX   0x7f
 
#define FF_CNT   (FF_MAX+1)
 

Macro Definition Documentation

◆ BUS_ADB

#define BUS_ADB   0x17

◆ BUS_AMD_SFH

#define BUS_AMD_SFH   0x20

◆ BUS_AMIGA

#define BUS_AMIGA   0x16

◆ BUS_ATARI

#define BUS_ATARI   0x1B

◆ BUS_BLUETOOTH

#define BUS_BLUETOOTH   0x05

◆ BUS_CEC

#define BUS_CEC   0x1E

◆ BUS_GAMEPORT

#define BUS_GAMEPORT   0x14

◆ BUS_GSC

#define BUS_GSC   0x1A

◆ BUS_HIL

#define BUS_HIL   0x04

◆ BUS_HOST

#define BUS_HOST   0x19

◆ BUS_I2C

#define BUS_I2C   0x18

◆ BUS_I8042

#define BUS_I8042   0x11

◆ BUS_INTEL_ISHTP

#define BUS_INTEL_ISHTP   0x1F

◆ BUS_ISA

#define BUS_ISA   0x10

◆ BUS_ISAPNP

#define BUS_ISAPNP   0x02

◆ BUS_PARPORT

#define BUS_PARPORT   0x15

◆ BUS_PCI

#define BUS_PCI   0x01

◆ BUS_RMI

#define BUS_RMI   0x1D

◆ BUS_RS232

#define BUS_RS232   0x13

◆ BUS_SDW

#define BUS_SDW   0x21

◆ BUS_SPI

#define BUS_SPI   0x1C

◆ BUS_USB

#define BUS_USB   0x03

◆ BUS_VIRTUAL

#define BUS_VIRTUAL   0x06

◆ BUS_XTKBD

#define BUS_XTKBD   0x12

◆ EV_VERSION

#define EV_VERSION   0x010001

◆ EVIOCGABS

#define EVIOCGABS (   abs)    _IOR('E', 0x40 + (abs), struct input_absinfo) /* get abs value/limits */

◆ EVIOCGBIT

#define EVIOCGBIT (   ev,
  len 
)    _IOC(_IOC_READ, 'E', 0x20 + (ev), len) /* get event bits */

◆ EVIOCGEFFECTS

#define EVIOCGEFFECTS   _IOR('E', 0x84, int) /* Report number of effects playable at the same time */

◆ EVIOCGID

#define EVIOCGID   _IOR('E', 0x02, struct input_id) /* get device ID */

◆ EVIOCGKEY

#define EVIOCGKEY (   len)    _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */

◆ EVIOCGKEYCODE

#define EVIOCGKEYCODE   _IOR('E', 0x04, unsigned int[2]) /* get keycode */

◆ EVIOCGKEYCODE_V2

#define EVIOCGKEYCODE_V2   _IOR('E', 0x04, struct input_keymap_entry)

◆ EVIOCGLED

#define EVIOCGLED (   len)    _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */

◆ EVIOCGMASK

#define EVIOCGMASK   _IOR('E', 0x92, struct input_mask) /* Get event-masks */

EVIOCGMASK - Retrieve current event mask

This ioctl allows user to retrieve the current event mask for specific event type. The argument must be of type "struct input_mask" and specifies the event type to query, the address of the receive buffer and the size of the receive buffer.

The event mask is a per-client mask that specifies which events are forwarded to the client. Each event code is represented by a single bit in the event mask. If the bit is set, the event is passed to the client normally. Otherwise, the event is filtered and will never be queued on the client's receive buffer.

Event masks do not affect global state of the input device. They only affect the file descriptor they are applied to.

The default event mask for a client has all bits set, i.e. all events are forwarded to the client. If the kernel is queried for an unknown event type or if the receive buffer is larger than the number of event codes known to the kernel, the kernel returns all zeroes for those codes.

At maximum, codes_size bytes are copied.

This ioctl may fail with ENODEV in case the file is revoked, EFAULT if the receive-buffer points to invalid memory, or EINVAL if the kernel does not implement the ioctl.

◆ EVIOCGMTSLOTS

#define EVIOCGMTSLOTS (   len)    _IOC(_IOC_READ, 'E', 0x0a, len)

EVIOCGMTSLOTS(len) - get MT slot values @len: size of the data buffer in bytes

The ioctl buffer argument should be binary equivalent to

struct input_mt_request_layout { __u32 code; __s32 values[num_slots]; };

where num_slots is the (arbitrary) number of MT slots to extract.

The ioctl size argument (len) is the size of the buffer, which should satisfy len = (num_slots + 1) * sizeof(__s32). If len is too small to fit all available slots, the first num_slots are returned.

Before the call, code is set to the wanted ABS_MT event type. On return, values[] is filled with the slot values for the specified ABS_MT code.

If the request code is not an ABS_MT value, -EINVAL is returned.

◆ EVIOCGNAME

#define EVIOCGNAME (   len)    _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */

◆ EVIOCGPHYS

#define EVIOCGPHYS (   len)    _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */

◆ EVIOCGPROP

#define EVIOCGPROP (   len)    _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */

◆ EVIOCGRAB

#define EVIOCGRAB   _IOW('E', 0x90, int) /* Grab/Release device */

◆ EVIOCGREP

#define EVIOCGREP   _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */

◆ EVIOCGSND

#define EVIOCGSND (   len)    _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */

◆ EVIOCGSW

#define EVIOCGSW (   len)    _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */

◆ EVIOCGUNIQ

#define EVIOCGUNIQ (   len)    _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */

◆ EVIOCGVERSION

#define EVIOCGVERSION   _IOR('E', 0x01, int) /* get driver version */

◆ EVIOCREVOKE

#define EVIOCREVOKE   _IOW('E', 0x91, int) /* Revoke device access */

◆ EVIOCRMFF

#define EVIOCRMFF   _IOW('E', 0x81, int) /* Erase a force effect */

◆ EVIOCSABS

#define EVIOCSABS (   abs)    _IOW('E', 0xc0 + (abs), struct input_absinfo) /* set abs value/limits */

◆ EVIOCSCLOCKID

#define EVIOCSCLOCKID   _IOW('E', 0xa0, int) /* Set clockid to be used for timestamps */

◆ EVIOCSFF

#define EVIOCSFF   _IOW('E', 0x80, struct ff_effect) /* send a force effect to a force feedback device */

◆ EVIOCSKEYCODE

#define EVIOCSKEYCODE   _IOW('E', 0x04, unsigned int[2]) /* set keycode */

◆ EVIOCSKEYCODE_V2

#define EVIOCSKEYCODE_V2   _IOW('E', 0x04, struct input_keymap_entry)

◆ EVIOCSMASK

#define EVIOCSMASK   _IOW('E', 0x93, struct input_mask) /* Set event-masks */

EVIOCSMASK - Set event mask

This ioctl is the counterpart to EVIOCGMASK. Instead of receiving the current event mask, this changes the client's event mask for a specific type. See EVIOCGMASK for a description of event-masks and the argument-type.

This ioctl provides full forward compatibility. If the passed event type is unknown to the kernel, or if the number of event codes specified in the mask is bigger than what is known to the kernel, the ioctl is still accepted and applied. However, any unknown codes are left untouched and stay cleared. That means, the kernel always filters unknown codes regardless of what the client requests. If the new mask doesn't cover all known event-codes, all remaining codes are automatically cleared and thus filtered.

This ioctl may fail with ENODEV in case the file is revoked. EFAULT is returned if the receive-buffer points to invalid memory. EINVAL is returned if the kernel does not implement the ioctl.

◆ EVIOCSREP

#define EVIOCSREP   _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */

◆ FF_AUTOCENTER

#define FF_AUTOCENTER   0x61

◆ FF_CNT

#define FF_CNT   (FF_MAX+1)

◆ FF_CONSTANT

#define FF_CONSTANT   0x52

◆ FF_CUSTOM

#define FF_CUSTOM   0x5d

◆ FF_DAMPER

#define FF_DAMPER   0x55

◆ FF_EFFECT_MAX

#define FF_EFFECT_MAX   FF_RAMP

◆ FF_EFFECT_MIN

#define FF_EFFECT_MIN   FF_HAPTIC

◆ FF_FRICTION

#define FF_FRICTION   0x54

◆ FF_GAIN

#define FF_GAIN   0x60

◆ FF_HAPTIC

#define FF_HAPTIC   0x4f

◆ FF_INERTIA

#define FF_INERTIA   0x56

◆ FF_MAX

#define FF_MAX   0x7f

◆ FF_MAX_EFFECTS

#define FF_MAX_EFFECTS   FF_GAIN

◆ FF_PERIODIC

#define FF_PERIODIC   0x51

◆ FF_RAMP

#define FF_RAMP   0x57

◆ FF_RUMBLE

#define FF_RUMBLE   0x50

◆ FF_SAW_DOWN

#define FF_SAW_DOWN   0x5c

◆ FF_SAW_UP

#define FF_SAW_UP   0x5b

◆ FF_SINE

#define FF_SINE   0x5a

◆ FF_SPRING

#define FF_SPRING   0x53

◆ FF_SQUARE

#define FF_SQUARE   0x58

◆ FF_STATUS_MAX

#define FF_STATUS_MAX   0x01

◆ FF_STATUS_PLAYING

#define FF_STATUS_PLAYING   0x01

◆ FF_STATUS_STOPPED

#define FF_STATUS_STOPPED   0x00

◆ FF_TRIANGLE

#define FF_TRIANGLE   0x59

◆ FF_WAVEFORM_MAX

#define FF_WAVEFORM_MAX   FF_CUSTOM

◆ FF_WAVEFORM_MIN

#define FF_WAVEFORM_MIN   FF_SQUARE

◆ ID_BUS

#define ID_BUS   0

◆ ID_PRODUCT

#define ID_PRODUCT   2

◆ ID_VENDOR

#define ID_VENDOR   1

◆ ID_VERSION

#define ID_VERSION   3

◆ input_event_sec

#define input_event_sec   time.tv_sec

◆ input_event_usec

#define input_event_usec   time.tv_usec

◆ INPUT_KEYMAP_BY_INDEX

#define INPUT_KEYMAP_BY_INDEX   (1 << 0)

◆ MT_TOOL_DIAL

#define MT_TOOL_DIAL   0x0a

◆ MT_TOOL_FINGER

#define MT_TOOL_FINGER   0x00

◆ MT_TOOL_MAX

#define MT_TOOL_MAX   0x0f

◆ MT_TOOL_PALM

#define MT_TOOL_PALM   0x02

◆ MT_TOOL_PEN

#define MT_TOOL_PEN   0x01