Prior to this change, libx52_init needed a supported joystick to be
plugged in, otherwise it would fail with LIBX52_ERROR_NO_DEVICE. This
change modifies the behavior so that libx52_init would still succeed,
but the application should call libx52_connect to make sure that the
device handle is valid. libx52_init still tries to connect to the
joystick, but absence is no longer treated as a failure.
This change also modifies x52cli to check that the joystick is actually
connected before calling the individual handlers. Because libx52_init no
longer fails if the joystick is absent, we need to rely on the return
code from libx52_connect.
This change allows applications to query if the connected device
supports the requested feature. This is so that applications like
x52test can skip test routines that aren't supported, instead of bailing
out of the loop.
This removes the earlier work done in libx52 to support USB hotplug.
This wasn't adequately tested, and the reason to have hotplug support
was to address perceived deficiencies in the standard API.
However, on recent reflection and experimentation, it seems to be easier
to support adding methods to connect to an X52/X52Pro joystick
dynamically after initializing the library. This approach also lends
itself to adding checks when sending control packets to close the device
handle when it detects device disconnection. Also, one could add a
disconnect method to disconnect from any connected joysticks.
Finally, this commit reverts a series of commits that chronicled my
journey into implementing hotplug support and simulating it in
libusbx52. By coalescing the revert into a single commit, it makes it
easier to revert the revert in the future, if necessary.
This change adds gettext support to libx52 using the Autotools
framework. This should allow translators to translate the error messages
provided by libx52_strerror into their corresponding localized versions.
This disables the include file list and dependency graph in the file
view. In addition, the groups are updated to include `libx52` in their
names, to avoid any potential conflict.
[skip ci]
This change exposes the libx52_hotplug_* functions in libx52.h to allow
other programs to link against them.
This commit also adds Doxygen comments, and groups the declarations by
their function, for later use in Doxygen integration.
This allows the caller to register a callback and forget about it. This
is useful in cases where a particular callback needs to be run
everytime, and there is no point in deregistering it until the
application terminates, at which point `libx52_hotplug_exit` will take
care of the cleanup.
Prior to this change, the libusbx52 Makefile was manually specifying the
pthread flags to indicate that the linker needed to link against the
pthread libraries.
This change moves the pthread detection logic out to configure.ac, and
updates the flags in libusbx52 Makefile to use the pthread compiler.
Prior to this change, libx52 would require that the X52/Pro be plugged
in before initialization. This change allows the application to
initialize libx52 even before the device is plugged in.
The stub libusb library used for testing writes the control request to a
dump file. By default, this file is block-buffered, and on a typical
Linux system, it waits until it receives about a page worth of data
before flushing it to disk. This results in a delay in monitoring
packets when running a debug program.
This change makes the file line-buffered instead, which results in the
debug output for every single packet getting flushed to disk without
having to wait for a full page of data.
With the release of libusb 1.0.22, `libusb_set_debug` has been
deprecated and replaced by `libusb_set_option`. This function is a new
generic API to add additional functionality in the future without having
to introduce new functions.
This change checks for `LIBUSB_API_VERSION` of at least `0x01000106`,
which is the version corresponding to 1.0.22, and if it matches, it
replaces the calls to `libusb_set_debug` with equivalent calls to
`libusb_set_option`.
These new error codes correspond to similar ones returned by libusb, but
abstract away the usage of libusb underneath libx52. This lets the
application rely solely on libx52 error codes to perform error handling.
- libx52_init returns the libx52_device in an output parameter and
returns a libx52_error_code
- Make all functions return libx52_error_code
- Update package version to indicate incompatible API change
The raw time and date APIs bypass the timezone calculation and update
the internal data structures with the requested time in hh:mm and date
in dd/mm/yy formats.
This is unlikely to be used often, but it is useful during testing.