libevdev-uinput.h
Go to the documentation of this file.
/* SPDX-License-Identifier: MIT */
/*
* Copyright © 2013 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef LIBEVDEV_UINPUT_H
#define LIBEVDEV_UINPUT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <libevdev/libevdev.h>
struct libevdev_uinput;
enum libevdev_uinput_open_mode {
/* intentionally -2 to avoid code like below from accidentally working:
fd = open("/dev/uinput", O_RDWR); // fails, fd is -1
libevdev_uinput_create_from_device(dev, fd, &uidev); // may hide the error */
LIBEVDEV_UINPUT_OPEN_MANAGED = -2
};
int libevdev_uinput_create_from_device(const struct libevdev *dev,
int uinput_fd,
struct libevdev_uinput **uinput_dev);
void libevdev_uinput_destroy(struct libevdev_uinput *uinput_dev);
int libevdev_uinput_get_fd(const struct libevdev_uinput *uinput_dev);
const char* libevdev_uinput_get_syspath(struct libevdev_uinput *uinput_dev);
const char* libevdev_uinput_get_devnode(struct libevdev_uinput *uinput_dev);
int libevdev_uinput_write_event(const struct libevdev_uinput *uinput_dev,
unsigned int type,
unsigned int code,
int value);
#ifdef __cplusplus
}
#endif
#endif /* LIBEVDEV_UINPUT_H */
libevdev_uinput_write_event
int libevdev_uinput_write_event(const struct libevdev_uinput *uinput_dev, unsigned int type, unsigned int code, int value)
Post an event through the uinput device.
libevdev_uinput_get_devnode
const char * libevdev_uinput_get_devnode(struct libevdev_uinput *uinput_dev)
Return the device node representing this uinput device.
libevdev_uinput_get_fd
int libevdev_uinput_get_fd(const struct libevdev_uinput *uinput_dev)
Return the file descriptor used to create this uinput device.
libevdev_uinput_destroy
void libevdev_uinput_destroy(struct libevdev_uinput *uinput_dev)
Destroy a previously created uinput device and free associated memory.
libevdev_uinput_get_syspath
const char * libevdev_uinput_get_syspath(struct libevdev_uinput *uinput_dev)
Return the syspath representing this uinput device.
libevdev_uinput_create_from_device
int libevdev_uinput_create_from_device(const struct libevdev *dev, int uinput_fd, struct libevdev_uinput **uinput_dev)
Create a uinput device based on the given libevdev device.
libevdev_uinput_open_mode
libevdev_uinput_open_mode
Definition: libevdev-uinput.h:110
LIBEVDEV_UINPUT_OPEN_MANAGED
@ LIBEVDEV_UINPUT_OPEN_MANAGED
let libevdev open and close /dev/uinput
Definition: libevdev-uinput.h:114
libevdev.h