libx52  0.3.2
Saitek X52/X52Pro drivers for Linux/Unix
Typedefs | Functions
Library Initialization and Deinitialization

Typedefs

typedef struct libx52_device libx52_device
 Device context structure used by libx52. More...
 

Functions

int libx52_init (libx52_device **dev)
 Initialize the X52 library. More...
 
void libx52_exit (libx52_device *dev)
 Exit the library and free up any resources used. More...
 

Detailed Description

These functions are used at application entry and exit.

Typedef Documentation

◆ libx52_device

typedef struct libx52_device libx52_device

Device context structure used by libx52.

All libx52 API functions require the application to pass in a pointer to a valid device context structure. A pointer can be obtained by calling libx52_init

Function Documentation

◆ libx52_exit()

void libx52_exit ( libx52_device dev)

Exit the library and free up any resources used.

This function releases any resources allocated by libx52_init and terminates the library. Using the freed device now is invalid and can cause errors.

Parameters
[in]devPointer to the device context
Returns
None

◆ libx52_init()

int libx52_init ( libx52_device **  dev)

Initialize the X52 library.

This function initializes the libx52 library, sets up any internal data structures to access the joystick, and returns a libx52_device pointer in the output parameter. All calls to libx52 use the returned pointer to control the device.

Example
int rc;
rc = libx52_init(&dev);
if (rc != LIBX52_SUCCESS) {
// Error handling omitted for brevity
}
// Save dev for use later
struct libx52_device libx52_device
Device context structure used by libx52.
Definition: libx52.h:46
int libx52_init(libx52_device **dev)
Initialize the X52 library.
@ LIBX52_SUCCESS
Definition: libx52.h:165
Since
0.2.1 - This function attempts to connect to the joystick upon initialization. However, if no device is connected, then the library initialization does not fail, but the application must call libx52_connect prior to any calls to libx52_update
Deprecated:
Connection to a supported joystick is no longer a goal of this function. It will continue to attempt to connect to the joystick during initialization so that existing clients don't break, but it is highly recommended that all clients use libx52_connect to explicitly connect to the joystick.

A future release will remove the automatic connection.
Parameters
[out]devPointer to a libx52_device *. This function will allocate a device context and return the pointer to the device context in this variable.
Returns
libx52_error_code indicating status