libx52 0.3.0
Saitek X52/X52Pro drivers for Linux/Unix
|
Data Structures | |
struct | libx52io_report |
X52 HID Report. More... | |
Typedefs | |
typedef struct libx52io_context | libx52io_context |
Device context structure used by libx52io. | |
Functions | |
int | libx52io_init (libx52io_context **ctx) |
Initialize the IO library. | |
void | libx52io_exit (libx52io_context *ctx) |
Exit the library and free up any resources used. | |
int | libx52io_open (libx52io_context *ctx) |
Open a connection to a supported joystick. | |
int | libx52io_close (libx52io_context *ctx) |
Close an existing connection to a supported joystick. | |
int | libx52io_read_timeout (libx52io_context *ctx, libx52io_report *report, int timeout) |
Read and parse a HID report. | |
int | libx52io_read (libx52io_context *ctx, libx52io_report *report) |
Read and parse a HID report. | |
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_strerror (libx52io_error_code code) |
Get the string representation of an error code. | |
const char * | libx52io_axis_to_str (libx52io_axis axis) |
Get the string representation of an axis. | |
const char * | libx52io_button_to_str (libx52io_button button) |
Get the string representation of a button. | |
uint16_t | libx52io_get_vendor_id (libx52io_context *ctx) |
Get the vendor ID of the connected X52 device. | |
uint16_t | libx52io_get_product_id (libx52io_context *ctx) |
Get the product ID of the connected X52 device. | |
uint16_t | libx52io_get_device_version (libx52io_context *ctx) |
Get the device version of the connected X52 device. | |
const char * | libx52io_get_manufacturer_string (libx52io_context *ctx) |
Get the manufacturer string of the connected X52 device. | |
const char * | libx52io_get_product_string (libx52io_context *ctx) |
Get the product string of the connected X52 device. | |
const char * | libx52io_get_serial_number_string (libx52io_context *ctx) |
Get the serial number of the connected X52 device. | |
These functions allow an application to connect to a supported X52/X52Pro joystick and read the state of the buttons and axes.
typedef struct libx52io_context libx52io_context |
Device context structure used by libx52io.
All libx52io API functions require the application to pass in a pointer to a valid device context structure. A pointer can be obtained by calling libx52io_init
enum libx52io_axis |
X52 Axis definitions.
enum libx52io_button |
X52 Button definitions.
enum libx52io_error_code |
libx52 IO error codes
Error codes returned by libx52io
const char * libx52io_axis_to_str | ( | libx52io_axis | axis | ) |
Get the string representation of an axis.
[in] | axis | Axis ID - see libx52io_axis |
const char * libx52io_button_to_str | ( | libx52io_button | button | ) |
Get the string representation of a button.
[in] | button | Button ID - see libx52io_button |
int libx52io_close | ( | libx52io_context * | ctx | ) |
Close an existing connection to a supported joystick.
This function closes any existing connection to a joystick. It is acceptable to call this function if no connection exists.
[in] | ctx | Pointer to the device context |
void libx52io_exit | ( | libx52io_context * | ctx | ) |
Exit the library and free up any resources used.
This function releases any resources allocated by libx52io_init and terminates the library. Using the freed device now is invalid and can cause errors.
[in] | ctx | Pointer to the device context |
int libx52io_get_axis_range | ( | libx52io_context * | ctx, |
libx52io_axis | axis, | ||
int32_t * | min, | ||
int32_t * | max | ||
) |
Retrieve the range of an axis.
This saves the minimum and maximum values of the requested axis in the output parameters. This will only be valid if the device is connected.
[in] | ctx | Pointer to the device context |
[in] | axis | Axis identifier - see libx52io_axis |
[out] | min | Pointer to save the axis minimum value |
[out] | max | Pointer to save the axis maximum value |
uint16_t libx52io_get_device_version | ( | libx52io_context * | ctx | ) |
Get the device version of the connected X52 device.
[in] | ctx | Pointer to the device context |
const char * libx52io_get_manufacturer_string | ( | libx52io_context * | ctx | ) |
Get the manufacturer string of the connected X52 device.
Returns a pointer to a string which can be passed to printf
or puts
. This pointer must not be freed.
[in] | ctx | Pointer to the device context |
uint16_t libx52io_get_product_id | ( | libx52io_context * | ctx | ) |
Get the product ID of the connected X52 device.
[in] | ctx | Pointer to the device context |
const char * libx52io_get_product_string | ( | libx52io_context * | ctx | ) |
Get the product string of the connected X52 device.
Returns a pointer to a string which can be passed to printf
or puts
. This pointer must not be freed.
[in] | ctx | Pointer to the device context |
const char * libx52io_get_serial_number_string | ( | libx52io_context * | ctx | ) |
Get the serial number of the connected X52 device.
Returns a pointer to a string which can be passed to printf
or puts
. This pointer must not be freed.
[in] | ctx | Pointer to the device context |
uint16_t libx52io_get_vendor_id | ( | libx52io_context * | ctx | ) |
Get the vendor ID of the connected X52 device.
[in] | ctx | Pointer to the device context |
int libx52io_init | ( | libx52io_context ** | ctx | ) |
Initialize the IO library.
This function initializes the libx52io library, sets up any internal data structures to access the joystick, and returns a libx52io_context pointer in the output parameter. All calls to libx52io use the returned pointer to control the device.
[out] | ctx | Pointer to a libx52io_context *. This function will allocate a device context and return the pointer to the context in this variable. |
libx52io_error_code
indicating status int libx52io_open | ( | libx52io_context * | ctx | ) |
Open a connection to a supported joystick.
This function scans for and opens a connection to a supported X52/X52Pro joystick. If no supported joystick is found, it will return LIBX52IO_ERROR_NO_DEVICE.
[in] | ctx | Pointer to the device context |
int libx52io_read | ( | libx52io_context * | ctx, |
libx52io_report * | report | ||
) |
Read and parse a HID report.
This behaves the same as libx52io_read_timeout with a timeout of -1
. This function will block until some data is available from the joystick.
[in] | ctx | Pointer to the device context |
[out] | report | Pointer to save the decoded HID report |
int libx52io_read_timeout | ( | libx52io_context * | ctx, |
libx52io_report * | report, | ||
int | timeout | ||
) |
Read and parse a HID report.
This function reads and parses a HID report from a connected joystick. This function will block until some data is available from the joystick, or the timeout is hit, whichever is first.
[in] | ctx | Pointer to the device context |
[out] | report | Pointer to save the decoded HID report |
[in] | timeout | Timeout value in milliseconds |
const char * libx52io_strerror | ( | libx52io_error_code | code | ) |
Get the string representation of an error code.
[in] | code | Return code from one of the libx52io APIs |