libx52  0.3.2
Saitek X52/X52Pro drivers for Linux/Unix
libx52io.h
Go to the documentation of this file.
1 /*
2  * Saitek X52 IO driver
3  *
4  * Copyright (C) 2012-2020 Nirenjan Krishnan (nirenjan@nirenjan.org)
5  *
6  * SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0
7  */
8 
20 #ifndef LIBX52IO_H
21 #define LIBX52IO_H
22 
23 #include <stdint.h>
24 #include <stdbool.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
42 struct libx52io_context;
43 
51 typedef struct libx52io_context libx52io_context;
52 
58 typedef enum {
61 
64 
67 
70 
73 
76 
80 
84 typedef enum {
87 
90 
93 
96 
99 
102 
105 
108 
111 
114 
117 
118  LIBX52IO_AXIS_MAX
119 } libx52io_axis;
120 
124 typedef enum {
127 
130 
133 
136 
139 
142 
145 
148 
151 
154 
157 
160 
163 
166 
169 
172 
175 
178 
181 
184 
187 
190 
193 
196 
199 
202 
205 
208 
211 
214 
217 
220 
223 
226 
229 
232 
235 
238 
241 
242  LIBX52IO_BUTTON_MAX
244 
252  int32_t axis[LIBX52IO_AXIS_MAX];
253 
255  bool button[LIBX52IO_BUTTON_MAX];
256 
258  uint8_t mode;
259 
261  uint8_t hat;
262 };
263 
269 typedef struct libx52io_report libx52io_report;
270 
297 
309 
326 
340 
361 
379 
397 int libx52io_get_axis_range(libx52io_context *ctx, libx52io_axis axis, int32_t *min, int32_t *max);
398 
407 
417 
427 
436 
445 
454 
467 
480 
493 
496 #ifdef __cplusplus
497 }
498 #endif
499 
500 #endif // !defined LIBX52IO_H
uint16_t libx52io_get_product_id(libx52io_context *ctx)
Get the product ID of the connected X52 device.
const char * libx52io_get_product_string(libx52io_context *ctx)
Get the product string of the connected X52 device.
libx52io_button
X52 Button definitions.
Definition: libx52io.h:124
int libx52io_init(libx52io_context **ctx)
Initialize the IO library.
const char * libx52io_strerror(libx52io_error_code code)
Get the string representation of an error code.
const char * libx52io_button_to_str(libx52io_button button)
Get the string representation of a button.
int libx52io_read(libx52io_context *ctx, libx52io_report *report)
Read and parse a HID report.
void libx52io_exit(libx52io_context *ctx)
Exit the library and free up any resources used.
const char * libx52io_get_manufacturer_string(libx52io_context *ctx)
Get the manufacturer string of the connected X52 device.
uint16_t libx52io_get_device_version(libx52io_context *ctx)
Get the device version of the connected X52 device.
libx52io_axis
X52 Axis definitions.
Definition: libx52io.h:84
uint16_t libx52io_get_vendor_id(libx52io_context *ctx)
Get the vendor ID of the connected X52 device.
int libx52io_close(libx52io_context *ctx)
Close an existing connection to a supported joystick.
libx52io_error_code
libx52 IO error codes
Definition: libx52io.h:58
const char * libx52io_axis_to_str(libx52io_axis axis)
Get the string representation of an axis.
int libx52io_read_timeout(libx52io_context *ctx, libx52io_report *report, int timeout)
Read and parse a HID report.
struct libx52io_context libx52io_context
Device context structure used by libx52io.
Definition: libx52io.h:51
int libx52io_get_axis_range(libx52io_context *ctx, libx52io_axis axis, int32_t *min, int32_t *max)
Retrieve the range of an axis.
const char * libx52io_get_serial_number_string(libx52io_context *ctx)
Get the serial number of the connected X52 device.
int libx52io_open(libx52io_context *ctx)
Open a connection to a supported joystick.
@ LIBX52IO_BTN_FIRE
Definition: libx52io.h:132
@ LIBX52IO_BTN_T1_DN
Definition: libx52io.h:156
@ LIBX52IO_BTN_TRIGGER_2
Definition: libx52io.h:129
@ LIBX52IO_BTN_POV_1_S
Definition: libx52io.h:177
@ LIBX52IO_BTN_MODE_1
Definition: libx52io.h:234
@ LIBX52IO_BTN_T3_UP
Definition: libx52io.h:165
@ LIBX52IO_BTN_MOUSE_PRIMARY
Definition: libx52io.h:198
@ LIBX52IO_BTN_A
Definition: libx52io.h:138
@ LIBX52IO_BTN_B
Definition: libx52io.h:141
@ LIBX52IO_BTN_PG_UP
Definition: libx52io.h:219
@ LIBX52IO_BTN_POV_2_S
Definition: libx52io.h:189
@ LIBX52IO_BTN_T2_DN
Definition: libx52io.h:162
@ LIBX52IO_BTN_TRIGGER
Definition: libx52io.h:126
@ LIBX52IO_BTN_MOUSE_SCROLL_UP
Definition: libx52io.h:204
@ LIBX52IO_BTN_POV_2_E
Definition: libx52io.h:186
@ LIBX52IO_BTN_MOUSE_SCROLL_DN
Definition: libx52io.h:207
@ LIBX52IO_BTN_SELECT
Definition: libx52io.h:231
@ LIBX52IO_BTN_E
Definition: libx52io.h:150
@ LIBX52IO_BTN_DN
Definition: libx52io.h:228
@ LIBX52IO_BTN_POV_1_N
Definition: libx52io.h:171
@ LIBX52IO_BTN_POV_2_N
Definition: libx52io.h:183
@ LIBX52IO_BTN_PG_DN
Definition: libx52io.h:222
@ LIBX52IO_BTN_POV_1_E
Definition: libx52io.h:174
@ LIBX52IO_BTN_RESET
Definition: libx52io.h:216
@ LIBX52IO_BTN_POV_2_W
Definition: libx52io.h:192
@ LIBX52IO_BTN_CLUTCH
Definition: libx52io.h:195
@ LIBX52IO_BTN_MODE_2
Definition: libx52io.h:237
@ LIBX52IO_BTN_T1_UP
Definition: libx52io.h:153
@ LIBX52IO_BTN_MODE_3
Definition: libx52io.h:240
@ LIBX52IO_BTN_T3_DN
Definition: libx52io.h:168
@ LIBX52IO_BTN_FUNCTION
Definition: libx52io.h:210
@ LIBX52IO_BTN_PINKY
Definition: libx52io.h:135
@ LIBX52IO_BTN_C
Definition: libx52io.h:144
@ LIBX52IO_BTN_POV_1_W
Definition: libx52io.h:180
@ LIBX52IO_BTN_START_STOP
Definition: libx52io.h:213
@ LIBX52IO_BTN_D
Definition: libx52io.h:147
@ LIBX52IO_BTN_MOUSE_SECONDARY
Definition: libx52io.h:201
@ LIBX52IO_BTN_UP
Definition: libx52io.h:225
@ LIBX52IO_BTN_T2_UP
Definition: libx52io.h:159
@ LIBX52IO_AXIS_X
Definition: libx52io.h:86
@ LIBX52IO_AXIS_THUMBY
Definition: libx52io.h:110
@ LIBX52IO_AXIS_RX
Definition: libx52io.h:98
@ LIBX52IO_AXIS_RZ
Definition: libx52io.h:92
@ LIBX52IO_AXIS_SLIDER
Definition: libx52io.h:104
@ LIBX52IO_AXIS_HATX
Definition: libx52io.h:113
@ LIBX52IO_AXIS_Y
Definition: libx52io.h:89
@ LIBX52IO_AXIS_THUMBX
Definition: libx52io.h:107
@ LIBX52IO_AXIS_Z
Definition: libx52io.h:95
@ LIBX52IO_AXIS_RY
Definition: libx52io.h:101
@ LIBX52IO_AXIS_HATY
Definition: libx52io.h:116
@ LIBX52IO_ERROR_INVALID
Definition: libx52io.h:69
@ LIBX52IO_ERROR_INIT_FAILURE
Definition: libx52io.h:63
@ LIBX52IO_ERROR_CONN
Definition: libx52io.h:72
@ LIBX52IO_ERROR_IO
Definition: libx52io.h:75
@ LIBX52IO_ERROR_NO_DEVICE
Definition: libx52io.h:66
@ LIBX52IO_SUCCESS
Definition: libx52io.h:60
@ LIBX52IO_ERROR_TIMEOUT
Definition: libx52io.h:78
X52 HID Report.
Definition: libx52io.h:250
uint8_t mode
Definition: libx52io.h:258
int32_t axis[LIBX52IO_AXIS_MAX]
Definition: libx52io.h:252
uint8_t hat
Definition: libx52io.h:261
bool button[LIBX52IO_BUTTON_MAX]
Definition: libx52io.h:255