libx52  0.3.2
Saitek X52/X52Pro drivers for Linux/Unix
Functions
Device Handling

Functions

int libx52_connect (libx52_device *dev)
 Connect to the X52 device. More...
 
int libx52_disconnect (libx52_device *dev)
 Disconnect from the X52 device. More...
 
bool libx52_is_connected (libx52_device *dev)
 Check if joystick is connected. More...
 

Detailed Description

Handle connections to the device.

These functions allow the application to dynamically connect and disconnect from a supported device.

Function Documentation

◆ libx52_connect()

int libx52_connect ( libx52_device dev)

Connect to the X52 device.

Attempt to connect to a supported X52/X52Pro joystick. If no supported joysticks are found, it will return LIBX52_ERROR_NO_DEVICE. If any errors are encountered during device enumeration, it will return an appropriate libx52_error_code.

If this function is called after it has already connected to a joystick, then it will re-enumerate the bus and ensure that it is still connected.

Parameters
[in]devPointer to the device context
Returns
libx52_error_code indicating status

◆ libx52_disconnect()

int libx52_disconnect ( libx52_device dev)

Disconnect from the X52 device.

This function disconnects any active connections to supported joysticks. Applications must reconnect to the joystick using libx52_connect prior to calling libx52_update.

Parameters
[in]devPointer to the device context
Returns
libx52_error_code indicating status

◆ libx52_is_connected()

bool libx52_is_connected ( libx52_device dev)

Check if joystick is connected.

This function reports if it is possible to try to communicate with a supported joystick. The application can communicate with the joystick, only if the following conditions are met.

  1. The joystick is plugged in and powered up.
  2. The application has called libx52_connect to connect to the joystick.

This function, however, does not check if the joystick is physically connected. A call to libx52_update or libx52_vendor_command will return an error of LIBX52_ERROR_NO_DEVICE if the joystick has either been disconnected, or libx52_connect was never called.

Parameters
[in]devPointer to the device context
Returns
Boolean indicating if the internal device handle is valid.