RetroArch
Classes | Macros | Typedefs | Enumerations | Functions | Variables
udev_input.c File Reference
#include <stdint.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <limits.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/epoll.h>
#include <sys/poll.h>
#include <libudev.h>
#include <linux/input.h>
#include <linux/kd.h>
#include <file/file_path.h>
#include <compat/strl.h>
#include <string/stdstring.h>
#include <retro_miscellaneous.h>
#include "../input_driver.h"
#include "../input_keymaps.h"
#include "../../gfx/video_driver.h"
#include "../common/linux_common.h"
#include "../../configuration.h"
#include "../../verbosity.h"
Include dependency graph for udev_input.c:

Classes

struct  udev_input_mouse_t
 
struct  udev_input_device
 
struct  udev_input
 

Macros

#define HAVE_EPOLL
 
#define UDEV_MAX_KEYS   (KEY_MAX + 7) / 8
 

Typedefs

typedef struct udev_input udev_input_t
 
typedef struct udev_input_device udev_input_device_t
 
typedef void(* device_handle_cb) (void *data, const struct input_event *event, udev_input_device_t *dev)
 

Enumerations

enum  udev_input_dev_type { UDEV_INPUT_KEYBOARD = 0, UDEV_INPUT_MOUSE, UDEV_INPUT_TOUCHPAD }
 

Functions

static unsigned input_unify_ev_key_code (unsigned code)
 
static void udev_handle_keyboard (void *data, const struct input_event *event, udev_input_device_t *dev)
 
static void udev_input_kb_free (void)
 
static udev_input_mouse_tudev_get_mouse (struct udev_input *udev, unsigned port)
 
static void udev_mouse_set_x (udev_input_mouse_t *mouse, int32_t x, bool abs)
 
static int16_t udev_mouse_get_x (const udev_input_mouse_t *mouse)
 
static void udev_mouse_set_y (udev_input_mouse_t *mouse, int32_t y, bool abs)
 
static int16_t udev_mouse_get_y (const udev_input_mouse_t *mouse)
 
static int16_t udev_mouse_get_pointer_x (const udev_input_mouse_t *mouse, bool screen)
 
static int16_t udev_mouse_get_pointer_y (const udev_input_mouse_t *mouse, bool screen)
 
static void udev_handle_mouse (void *data, const struct input_event *event, udev_input_device_t *dev)
 
static bool udev_input_add_device (udev_input_t *udev, enum udev_input_dev_type type, const char *devnode, device_handle_cb cb)
 
static void udev_input_remove_device (udev_input_t *udev, const char *devnode)
 
static void udev_input_handle_hotplug (udev_input_t *udev)
 
static bool udev_input_poll_hotplug_available (struct udev_monitor *dev)
 
static void udev_input_poll (void *data)
 
static bool udev_pointer_is_off_window (const udev_input_t *udev)
 
static int16_t udev_lightgun_aiming_state (udev_input_t *udev, unsigned port, unsigned id)
 
static int16_t udev_mouse_state (udev_input_t *udev, unsigned port, unsigned id, bool screen)
 
static bool udev_keyboard_pressed (udev_input_t *udev, unsigned key)
 
static bool udev_mbutton_pressed (udev_input_t *udev, unsigned port, unsigned key)
 
static bool udev_is_pressed (udev_input_t *udev, rarch_joypad_info_t joypad_info, const struct retro_keybind *binds, unsigned port, unsigned id)
 
static int16_t udev_analog_pressed (const struct retro_keybind *binds, unsigned idx, unsigned id)
 
static int16_t udev_pointer_state (udev_input_t *udev, unsigned port, unsigned id, bool screen)
 
static int16_t udev_input_state (void *data, rarch_joypad_info_t joypad_info, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned idx, unsigned id)
 
static void udev_input_free (void *data)
 
static bool open_devices (udev_input_t *udev, enum udev_input_dev_type type, device_handle_cb cb)
 
static voidudev_input_init (const char *joypad_driver)
 
static uint64_t udev_input_get_capabilities (void *data)
 
static void udev_input_grab_mouse (void *data, bool state)
 
static bool udev_input_set_rumble (void *data, unsigned port, enum retro_rumble_effect effect, uint16_t strength)
 
static const input_device_driver_tudev_input_get_joypad_driver (void *data)
 
static bool udev_input_keyboard_mapping_is_blocked (void *data)
 
static void udev_input_keyboard_mapping_set_block (void *data, bool value)
 

Variables

static const char * g_dev_type_str []
 
static uint8_t udev_key_state [UDEV_MAX_KEYS]
 
input_driver_t input_udev
 

Macro Definition Documentation

◆ HAVE_EPOLL

#define HAVE_EPOLL

◆ UDEV_MAX_KEYS

#define UDEV_MAX_KEYS   (KEY_MAX + 7) / 8

Typedef Documentation

◆ device_handle_cb

typedef void(* device_handle_cb) (void *data, const struct input_event *event, udev_input_device_t *dev)

◆ udev_input_device_t

◆ udev_input_t

typedef struct udev_input udev_input_t

Enumeration Type Documentation

◆ udev_input_dev_type

Enumerator
UDEV_INPUT_KEYBOARD 
UDEV_INPUT_MOUSE 
UDEV_INPUT_TOUCHPAD 

Function Documentation

◆ input_unify_ev_key_code()

static unsigned input_unify_ev_key_code ( unsigned  code)
static
Here is the caller graph for this function:

◆ open_devices()

static bool open_devices ( udev_input_t udev,
enum udev_input_dev_type  type,
device_handle_cb  cb 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_analog_pressed()

static int16_t udev_analog_pressed ( const struct retro_keybind binds,
unsigned  idx,
unsigned  id 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_get_mouse()

static udev_input_mouse_t* udev_get_mouse ( struct udev_input udev,
unsigned  port 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_handle_keyboard()

static void udev_handle_keyboard ( void data,
const struct input_event *  event,
udev_input_device_t dev 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_handle_mouse()

static void udev_handle_mouse ( void data,
const struct input_event *  event,
udev_input_device_t dev 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_input_add_device()

static bool udev_input_add_device ( udev_input_t udev,
enum udev_input_dev_type  type,
const char *  devnode,
device_handle_cb  cb 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_input_free()

static void udev_input_free ( void data)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_input_get_capabilities()

static uint64_t udev_input_get_capabilities ( void data)
static
Here is the call graph for this function:

◆ udev_input_get_joypad_driver()

static const input_device_driver_t* udev_input_get_joypad_driver ( void data)
static

◆ udev_input_grab_mouse()

static void udev_input_grab_mouse ( void data,
bool  state 
)
static
Here is the call graph for this function:

◆ udev_input_handle_hotplug()

static void udev_input_handle_hotplug ( udev_input_t udev)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_input_init()

static void* udev_input_init ( const char *  joypad_driver)
static
Here is the call graph for this function:

◆ udev_input_kb_free()

static void udev_input_kb_free ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_input_keyboard_mapping_is_blocked()

static bool udev_input_keyboard_mapping_is_blocked ( void data)
static

◆ udev_input_keyboard_mapping_set_block()

static void udev_input_keyboard_mapping_set_block ( void data,
bool  value 
)
static

◆ udev_input_poll()

static void udev_input_poll ( void data)
static
Here is the call graph for this function:

◆ udev_input_poll_hotplug_available()

static bool udev_input_poll_hotplug_available ( struct udev_monitor *  dev)
static
Here is the caller graph for this function:

◆ udev_input_remove_device()

static void udev_input_remove_device ( udev_input_t udev,
const char *  devnode 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_input_set_rumble()

static bool udev_input_set_rumble ( void data,
unsigned  port,
enum retro_rumble_effect  effect,
uint16_t  strength 
)
static
Here is the call graph for this function:

◆ udev_input_state()

static int16_t udev_input_state ( void data,
rarch_joypad_info_t  joypad_info,
const struct retro_keybind **  binds,
unsigned  port,
unsigned  device,
unsigned  idx,
unsigned  id 
)
static
Here is the call graph for this function:

◆ udev_is_pressed()

static bool udev_is_pressed ( udev_input_t udev,
rarch_joypad_info_t  joypad_info,
const struct retro_keybind binds,
unsigned  port,
unsigned  id 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_keyboard_pressed()

static bool udev_keyboard_pressed ( udev_input_t udev,
unsigned  key 
)
static
Here is the caller graph for this function:

◆ udev_lightgun_aiming_state()

static int16_t udev_lightgun_aiming_state ( udev_input_t udev,
unsigned  port,
unsigned  id 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_mbutton_pressed()

static bool udev_mbutton_pressed ( udev_input_t udev,
unsigned  port,
unsigned  key 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_mouse_get_pointer_x()

static int16_t udev_mouse_get_pointer_x ( const udev_input_mouse_t mouse,
bool  screen 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_mouse_get_pointer_y()

static int16_t udev_mouse_get_pointer_y ( const udev_input_mouse_t mouse,
bool  screen 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_mouse_get_x()

static int16_t udev_mouse_get_x ( const udev_input_mouse_t mouse)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_mouse_get_y()

static int16_t udev_mouse_get_y ( const udev_input_mouse_t mouse)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_mouse_set_x()

static void udev_mouse_set_x ( udev_input_mouse_t mouse,
int32_t  x,
bool  abs 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_mouse_set_y()

static void udev_mouse_set_y ( udev_input_mouse_t mouse,
int32_t  y,
bool  abs 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_mouse_state()

static int16_t udev_mouse_state ( udev_input_t udev,
unsigned  port,
unsigned  id,
bool  screen 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_pointer_is_off_window()

static bool udev_pointer_is_off_window ( const udev_input_t udev)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_pointer_state()

static int16_t udev_pointer_state ( udev_input_t udev,
unsigned  port,
unsigned  id,
bool  screen 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ g_dev_type_str

const char* g_dev_type_str[]
static
Initial value:
=
{
"ID_INPUT_KEYBOARD",
"ID_INPUT_MOUSE",
"ID_INPUT_TOUCHPAD"
}

◆ input_udev

input_driver_t input_udev
Initial value:
= {
"udev",
}
static const input_device_driver_t * udev_input_get_joypad_driver(void *data)
Definition: udev_input.c:1273
static void udev_input_free(void *data)
Definition: udev_input.c:1051
static void udev_input_keyboard_mapping_set_block(void *data, bool value)
Definition: udev_input.c:1289
static void udev_input_grab_mouse(void *data, bool state)
Definition: udev_input.c:1237
static void * udev_input_init(const char *joypad_driver)
Definition: udev_input.c:1133
static void udev_input_poll(void *data)
Definition: udev_input.c:680
static bool udev_input_keyboard_mapping_is_blocked(void *data)
Definition: udev_input.c:1281
#define NULL
Pointer to 0.
Definition: gctypes.h:65
static bool udev_input_set_rumble(void *data, unsigned port, enum retro_rumble_effect effect, uint16_t strength)
Definition: udev_input.c:1263
static int16_t udev_input_state(void *data, rarch_joypad_info_t joypad_info, const struct retro_keybind **binds, unsigned port, unsigned device, unsigned idx, unsigned id)
Definition: udev_input.c:962
static uint64_t udev_input_get_capabilities(void *data)
Definition: udev_input.c:1225

◆ udev_key_state

uint8_t udev_key_state[UDEV_MAX_KEYS]
static