RetroArch
Classes | Macros | Functions | Variables
udev_joypad.c File Reference
#include <stdint.h>
#include <unistd.h>
#include <string.h>
#include <limits.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/poll.h>
#include <libudev.h>
#include <linux/input.h>
#include <retro_inline.h>
#include <compat/strl.h>
#include <string/stdstring.h>
#include "../input_driver.h"
#include "../../tasks/tasks_internal.h"
#include "../../verbosity.h"
Include dependency graph for udev_joypad.c:

Classes

struct  udev_joypad
 
struct  joypad_udev_entry
 

Macros

#define UDEV_NUM_BUTTONS   32
 
#define NUM_AXES   32
 
#define NUM_HATS   4
 
#define test_bit(nr, addr)   (((1UL << ((nr) % (sizeof(long) * CHAR_BIT))) & ((addr)[(nr) / (sizeof(long) * CHAR_BIT)])) != 0)
 
#define NBITS(x)   ((((x) - 1) / (sizeof(long) * CHAR_BIT)) + 1)
 

Functions

static INLINE int16_t udev_compute_axis (const struct input_absinfo *info, int value)
 
static int udev_find_vacant_pad (void)
 
static int udev_open_joystick (const char *path)
 
static int udev_add_pad (struct udev_device *dev, unsigned p, int fd, const char *path)
 
static void udev_check_device (struct udev_device *dev, const char *path)
 
static void udev_free_pad (unsigned pad)
 
static void udev_joypad_remove_device (const char *path)
 
static void udev_joypad_destroy (void)
 
static bool udev_set_rumble (unsigned i, enum retro_rumble_effect effect, uint16_t strength)
 
static bool udev_joypad_poll_hotplug_available (struct udev_monitor *dev)
 
static void udev_joypad_poll (void)
 
static int sort_devnodes (const void *a, const void *b)
 
static bool udev_joypad_init (void *data)
 
static bool udev_joypad_button (unsigned port, uint16_t joykey)
 
static void udev_joypad_get_buttons (unsigned port, input_bits_t *state)
 
static int16_t udev_joypad_axis (unsigned port, uint32_t joyaxis)
 
static bool udev_joypad_query_pad (unsigned pad)
 
static const char * udev_joypad_name (unsigned pad)
 

Variables

static struct udev * udev_joypad_fd = NULL
 
static struct udev_monitor * udev_joypad_mon = NULL
 
static struct udev_joypad udev_pads [MAX_USERS]
 
input_device_driver_t udev_joypad
 

Macro Definition Documentation

◆ NBITS

#define NBITS (   x)    ((((x) - 1) / (sizeof(long) * CHAR_BIT)) + 1)

◆ NUM_AXES

#define NUM_AXES   32

◆ NUM_HATS

#define NUM_HATS   4

◆ test_bit

#define test_bit (   nr,
  addr 
)    (((1UL << ((nr) % (sizeof(long) * CHAR_BIT))) & ((addr)[(nr) / (sizeof(long) * CHAR_BIT)])) != 0)

◆ UDEV_NUM_BUTTONS

#define UDEV_NUM_BUTTONS   32

Function Documentation

◆ sort_devnodes()

static int sort_devnodes ( const void a,
const void b 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_add_pad()

static int udev_add_pad ( struct udev_device *  dev,
unsigned  p,
int  fd,
const char *  path 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_check_device()

static void udev_check_device ( struct udev_device *  dev,
const char *  path 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_compute_axis()

static INLINE int16_t udev_compute_axis ( const struct input_absinfo *  info,
int  value 
)
static
Here is the caller graph for this function:

◆ udev_find_vacant_pad()

static int udev_find_vacant_pad ( void  )
static
Here is the caller graph for this function:

◆ udev_free_pad()

static void udev_free_pad ( unsigned  pad)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_joypad_axis()

static int16_t udev_joypad_axis ( unsigned  port,
uint32_t  joyaxis 
)
static

◆ udev_joypad_button()

static bool udev_joypad_button ( unsigned  port,
uint16_t  joykey 
)
static

◆ udev_joypad_destroy()

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

◆ udev_joypad_get_buttons()

static void udev_joypad_get_buttons ( unsigned  port,
input_bits_t state 
)
static

◆ udev_joypad_init()

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

◆ udev_joypad_name()

static const char* udev_joypad_name ( unsigned  pad)
static
Here is the call graph for this function:

◆ udev_joypad_poll()

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

◆ udev_joypad_poll_hotplug_available()

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

◆ udev_joypad_query_pad()

static bool udev_joypad_query_pad ( unsigned  pad)
static

◆ udev_joypad_remove_device()

static void udev_joypad_remove_device ( const char *  path)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_open_joystick()

static int udev_open_joystick ( const char *  path)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ udev_set_rumble()

static bool udev_set_rumble ( unsigned  i,
enum retro_rumble_effect  effect,
uint16_t  strength 
)
static
Here is the call graph for this function:

Variable Documentation

◆ udev_joypad

Initial value:
= {
"udev",
}
static bool udev_joypad_button(unsigned port, uint16_t joykey)
Definition: udev_joypad.c:625
static bool udev_joypad_init(void *data)
Definition: udev_joypad.c:552
static void udev_joypad_destroy(void)
Definition: udev_joypad.c:349
static bool udev_set_rumble(unsigned i, enum retro_rumble_effect effect, uint16_t strength)
Definition: udev_joypad.c:366
static int16_t udev_joypad_axis(unsigned port, uint32_t joyaxis)
Definition: udev_joypad.c:665
static const char * udev_joypad_name(unsigned pad)
Definition: udev_joypad.c:703
static void udev_joypad_get_buttons(unsigned port, input_bits_t *state)
Definition: udev_joypad.c:652
static bool udev_joypad_query_pad(unsigned pad)
Definition: udev_joypad.c:698
static void udev_joypad_poll(void)
Definition: udev_joypad.c:447

◆ udev_joypad_fd

struct udev* udev_joypad_fd = NULL
static

◆ udev_joypad_mon

struct udev_monitor* udev_joypad_mon = NULL
static

◆ udev_pads

struct udev_joypad udev_pads[MAX_USERS]
static