Tachyon (current)  Current Main Branch
Data Structures | Macros | Functions
eventio.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/time.h>
#include <linux/input.h>
#include "eventio.h"

Go to the source code of this file.

Data Structures

struct  evio
 

Macros

#define REL_RX   0x03
 
#define REL_RY   0x04
 
#define REL_RZ   0x05
 
#define EVIO_LBIT   (8*sizeof(long))
 
#define EVIO_BITSTOLONGS(bnr)   (((bnr) + EVIO_LBIT - 1) / EVIO_LBIT)
 
#define EVIO_TESTBIT(bnr, array)   (((1UL << ((bnr)&(EVIO_LBIT-1))) & ((array)[(bnr)/EVIO_LBIT]))!=0)
 

Functions

evio_handle evio_open (const char *devpath)
 
int evio_close (evio_handle v)
 
int evio_dev_joystick (evio_handle v)
 
int evio_dev_spaceball (evio_handle v)
 
int evio_dev_recognized (evio_handle v)
 
int evio_read_events (evio_handle v)
 
float evio_absinfo2float (struct input_absinfo *absinfo)
 
int evio_get_button_status (evio_handle v, int evbtn, int btnflag)
 
int evio_get_joystick_status (evio_handle v, float *abs_x1, float *abs_y1, float *abs_x2, float *abs_y2, int *buttons)
 
int evio_get_spaceball_status (evio_handle v, int *rel_x, int *rel_y, int *rel_z, int *rel_rx, int *rel_ry, int *rel_rz, int *buttons)
 
int evio_print_devinfo (evio_handle v)
 

Macro Definition Documentation

◆ EVIO_BITSTOLONGS

#define EVIO_BITSTOLONGS (   bnr)    (((bnr) + EVIO_LBIT - 1) / EVIO_LBIT)

Definition at line 74 of file eventio.c.

◆ EVIO_LBIT

#define EVIO_LBIT   (8*sizeof(long))

Definition at line 73 of file eventio.c.

◆ EVIO_TESTBIT

#define EVIO_TESTBIT (   bnr,
  array 
)    (((1UL << ((bnr)&(EVIO_LBIT-1))) & ((array)[(bnr)/EVIO_LBIT]))!=0)

◆ REL_RX

#define REL_RX   0x03

Definition at line 62 of file eventio.c.

Referenced by evio_get_spaceball_status(), and evio_open().

◆ REL_RY

#define REL_RY   0x04

Definition at line 65 of file eventio.c.

Referenced by evio_get_spaceball_status(), and evio_open().

◆ REL_RZ

#define REL_RZ   0x05

Definition at line 68 of file eventio.c.

Referenced by evio_get_spaceball_status(), and evio_open().

Function Documentation

◆ evio_absinfo2float()

float evio_absinfo2float ( struct input_absinfo *  absinfo)

Definition at line 282 of file eventio.c.

Referenced by evio_get_joystick_status().

◆ evio_close()

int evio_close ( evio_handle  v)

Definition at line 172 of file eventio.c.

References evio::fd.

◆ evio_dev_joystick()

int evio_dev_joystick ( evio_handle  v)

Definition at line 181 of file eventio.c.

References evio::devjoystick.

◆ evio_dev_recognized()

int evio_dev_recognized ( evio_handle  v)

Definition at line 203 of file eventio.c.

References evio::devjoystick, and evio::devspaceball.

Referenced by evio_print_devinfo().

◆ evio_dev_spaceball()

int evio_dev_spaceball ( evio_handle  v)

Definition at line 192 of file eventio.c.

References evio::devspaceball.

◆ evio_get_button_status()

int evio_get_button_status ( evio_handle  v,
int  evbtn,
int  btnflag 
)

Definition at line 289 of file eventio.c.

References EVIO_TESTBIT, and evio::keystate.

Referenced by evio_get_joystick_status().

◆ evio_get_joystick_status()

int evio_get_joystick_status ( evio_handle  v,
float *  abs_x1,
float *  abs_y1,
float *  abs_x2,
float *  abs_y2,
int *  buttons 
)

◆ evio_get_spaceball_status()

int evio_get_spaceball_status ( evio_handle  v,
int *  rel_x,
int *  rel_y,
int *  rel_z,
int *  rel_rx,
int *  rel_ry,
int *  rel_rz,
int *  buttons 
)

Definition at line 393 of file eventio.c.

References EVIO_TESTBIT, REL_RX, REL_RY, and REL_RZ.

◆ evio_open()

evio_handle evio_open ( const char *  devpath)

◆ evio_print_devinfo()

int evio_print_devinfo ( evio_handle  v)

◆ evio_read_events()

int evio_read_events ( evio_handle  v)

Definition at line 213 of file eventio.c.

References evio::fd, and evio::inpev.