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.
The previous commit to restore the test order in x52test did not fix the
order in the PO files, which got automatically modified when `make
update-po` ran. This commit restores those changes.
This change cleans up a few of the dummy translations in xx_PL using the
open source [Poedit](https://www.poedit.net) editor. Since the editor
also generates the corresponding .mo file, it makes sense to add .mo as
an ignored extension.
[skip ci]
This commit uses the new `libx52_check_feature` API to check if the
device supports LED control. If not, it prints an error message and
exits the LED tests gracefully.
This also reverts commit 45f009ac90, which
had moved the LED tests to the end. Since this is no longer necessary,
it is moved back to avoid any issues with anything that may have relied
on the old order.
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 updates x52test to use the gettext APIs. This also adds a
fake message catalogue to verify that the code is converted correctly
and the translations are displayed.
The fake message catalogue translates the English strings into Pig
Latin, which makes it easy enough for a maintainer to verify that the
changes have been made correctly.
Finally, this also adds some documentation to tell the maintainer or
translator how to make the relevant changes.
The previous commit made a call to `brew upgrade`, but this tends to take
a very long time. More often than not, the default version in the OSX VM
image is sufficient, so we just need to call `brew install`.
This change adds the necessary packages to install the autopoint binary
on both Ubuntu and OSX. This is necessary since the build needs the
gettext utilities.
Also remove the installation for realpath, since we are no longer
building for Trusty.
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.
x52test doesn't perform any checks to see if the connected device
supports setting individual LEDs. Therefore, if an X52 (non-Pro) was
connected when running x52test, it would fail when running the LED
tests, and not perform any of the subsequent tests.
By moving the LED tests to the end, this allows the other tests to run
on a non-Pro X52. Although the tests would still fail, it won't actually
break anything.
Addresses #19.
x52test used to assume that a positive return code indicated a signal
was received and a negative return code indicated an error in libx52.
However, libx52 was changed a while back to return only a positive error
code of type `libx52_error_code`.
This commit changes that assumption, so that:
* The first check is always against `LIBX52_SUCCESS`, to ensure that any
change in the enumeration won't break the rest of the code.
* Tests terminated by a signal return the negated value of the signal,
i.e. -15 is SIGTERM and -2 is SIGINT.
* Tests that fail within libx52 return a standard `libx52_error_code`.
* Error printing uses `libx52_strerror`.
Addresses #19.
Prior to this change, x52cli assumed that the return code from the
handler was a standard error code, but negated. This is an incorrect
assumption as the libx52 API returns a `libx52_error_code` enum, which
is a positive integer.
This change fixes the printing of the error message to call
`libx52_strerror`, which translates it correctly. It also adds error
printing to any failure of `libx52_init`, as well as explicitly
specifying `LIBX52_SUCCESS` instead of `0`.
Addresses #19.
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.
Ubuntu Trusty doesn't ship with a new enough pkg-config, which causes
the PKG_INSTALLDIR macro to fail on those systems. Since Trusty is EOL
anyway, simply disable the CI build on it.
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.
This commit adds OSX to the build matrix, as well as building on Trusty,
Xenial and Bionic, both with GCC and CLang on all distributions. For
now, the OSX build uses the default image provided by Travis CI, but we
may decide to add more images in the future.
Also move realpath installation out of addons::apt::packages, since on
Xenial and newer distributions, realpath is included in the coreutils
package and doesn't need to be explicitly installed. However, we still
need it on Trusty, so add a line to manually install it.
x52test by default expects to run with an attached X52 unit. Since the
primary goal of the program is to test the hardware, it has embedded
delays to allow the user to verify the individual LEDs, MFD, brightness,
etc.
However, the complete test takes about 6 minutes. When using the stub
libusb library, the goal is to capture the requests, not verify it
against the hardware. In this case, the delays serve no useful purpose.
This change adds a nodelay flag, which is controlled by the presence of
a `NO_DELAY` environment variable, or the `LD_PRELOAD` environment
variable. As long as either of these variables are present in the
environment block, there will be no delays in the test execution.
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`.