JSInit(3)

NAME

JSInit - Joystick device initialization

SYNTAX

#include <jsw.h>

int JSInit(
        js_data_struct *jsd,
        const char *device,
        const char *calibration,
        unsigned int flags
)

ARGUMENTS

jsd Specifies the pointer to the joystick data structure.

device
    Specifies the joystick device.

calibration
    Specifies the joystick calibration file. If calibration is set to NULL, then the default calibration file defined by JSDefaultCalibration will be used (note that the environment variable HOME will be prefixed to it).

flags
    Can be any or'ed combination of the following values; JSFlagNonBlocking, JSFlagForceFeedback

DESCRIPTION

The JSInit function initializes the joystick specified by device and stores the new initialized value in the specified jsd structure.

If the device is not specified (set to NULL), then it will be defaulted to JSDefaultDevice.

If the calibration file is not specified (set to NULL), then it will be defaulted to JSDefaultCalibration. The HOME environment value will be used as the prefix to the path of JSDefaultCalibration. The calibration file does not have to exist, but if it does then it will be loaded and its values applied to the joystick's axises and buttons after initialization. The calling function does not have to load the calibration file.

Available inputs for flags are any of the or'ed following:

JSFlagNonBlocking
    Open joystick in non-blocking mode.

JSFlagForceFeedback
    Open joystick in read/write mode (for force feedback writing). Otherwise the joystick is just opened in read only mode.

The set up jsd structure must be at some point closed when it is no longer needed by calling JSClose(3).

RETURN VALUE

The JSInit function returns JSSuccess on success or any of the following on error; JSBadValue, JSNoAccess, or JSNoBuffers.

SEE ALSO

JSIntro(3) JSUpdate(3) JSClose(3) JSGetAttributesList(3) JSLoadCalibrationUNIX(3) JSLoadDeviceNamesUNIX(3) JSDriverQueryVersion(3) JSDriverVersion(3)