Commit Graph

222 Commits (a7d5b7e34dd16a916cb2e4e5ac35c9b3cfd22c81)

Author SHA1 Message Date
nirenjan a7d5b7e34d Update issue templates 2020-06-02 17:12:45 -07:00
nirenjan cb96d297ab Create INSTALL.md
[skip ci]
2020-06-02 16:36:01 -07:00
nirenjan c2c852cee1 Add faketime to Travis packages list
This change adds the faketime package when building on Linux. faketime
is needed for the timezone tests.
2020-06-02 15:03:26 -07:00
nirenjan 79bd8466c1 Add test suite for timezone tests
Previously, when testing the clock command of x52cli, we had forced the
system timezone to UTC. As a result, the offset calculations for clocks
2 and 3 were never computed and always resulted in 0, which hid the bug
when the local time and local standard time did not match (#20).

This commit adds a test case that uses faketime to test setting the
clock to local (Pacific Time) and verifying that the offsets are
computed correctly. Given that the bug is still present as of this
commit, add the test suite to XFAIL_TESTS as well, so that it doesn't
break the CI build.
2020-06-02 14:48:46 -07:00
nirenjan 7ae5cad0cc Clear warning when linking x52test_log_actions
Prior to this change, we were linking the log_actions program against
the stub library, since we needed to use the logging capabilities in the
stub library to save the expected values to a file for the test harness
to use. However, doing so gives us the following warning:

*** Warning: Linking the executable x52test_log_actions against the loadable module
*** libusbx52.so is not portable!

Since we don't really need to have dynamic linking in this case, simply
including the stub library source into the log_actions program sources
list is sufficient, and bypasses this warning.
2020-06-02 07:50:51 -07:00
nirenjan a43cbc83a5 Add libx52_set_clock bug (#20) to documentation 2020-06-01 17:45:33 -07:00
nirenjan 57f7758dd1 x52test: Check device type during reset
Prior to this change, x52test would always assume that the device was an
X52Pro when resetting the device state. This change fixes that
assumption by checking the feature flags, since only the X52Pro has LED
support.

This change also updates the translation files due to the automatic
update because of line numbers being changed.
2020-06-01 00:10:01 -07:00
nirenjan e7d14d7b53 x52test: Cleanup if successful or cancelled
Commit be1f7e0 fixed the error handling, but missed this line. The
original behavior was to restore the X52 LED and MFD state after
completing all the tests, or if the user cancelled the tests using
Ctrl-C.

This commit fixes that regression, so that it will preserve the state
only if it encountered an error during the test, not if it was
cancelled.
2020-05-31 23:57:03 -07:00
nirenjan a16b1822aa Delete obsolete man pages
Prior to this change, a separate copy of the man pages for the libx52
functions was being maintained since I couldn't get Doxygen to work
properly at the time (I don't remember, it's been over 5 years).

The man pages are out of date and don't match up with the current
version of libx52, and haven't been for some time. Now that we have
functional documentation generated via Doxygen, it is time to get rid of
the obsolete stuff.

This change deletes the entire man folder, and doesn't change anything
else, since it was self-contained.

[skip ci]
2020-05-31 15:50:59 -07:00
nirenjan 127ab10995 Update Doxygen documentation
This change cleans up the documentation and adds examples for some
functions.
2020-05-31 08:45:34 -07:00
nirenjan 2db24e8759 Add udev rules to distribution
Prior to this change, a user had to manually install their own udev
rules on Linux if they wanted to access the joystick without having to
run as root. The most common usecase was on systems based on Debian,
where the user would be a member of the plugdev group, and they would
create their own rule to allow members of the group to write to the
joystick.

This change adds a validated udev rule to the distribution, so if the
user compiles from source and does a make install, the rule to allow
plugdev group members to access the joystick is installed.
2020-05-30 16:38:58 -07:00
nirenjan e5ce827d7e Update installation instructions in README 2020-05-30 16:38:27 -07:00
nirenjan b0a07fe364 Ensure that doxygen docs are removed on uninstall 2020-05-30 16:36:55 -07:00
nirenjan a711f0a882 Remove consolidated API documentation page
This change ensures that there is a separate link to all libx52.h
documentation. As a result, there is no longer a need to manually
maintain a list of functions, structs, enums, etc. This also updates
the main page to link directly to the documented files, rather than
to the API page.
2020-05-28 16:27:44 -07:00
nirenjan 7889124217 Update readme [skip ci] 2020-05-28 15:40:46 -07:00
nirenjan f9be0b3172 Move x52cli documentation into Doxygen
Prior to this change, the x52cli man page was a manually created file
that was out of date with the source. Rather than update that file, and
maintain a separate document for the HTML sources, it makes sense to
consolidate both the HTML and manpage documentation to a Doxygen page
block within the source and update the Doxyfile to generate man pages as
well.

This change also removes the obsolete manually maintained manpage, and
falls back to Doxygen to build and install the manpage.
2020-05-28 15:31:08 -07:00
nirenjan 374fd94fcd Update gitignore list with additional generated files [skip ci] 2020-05-26 16:33:58 -07:00
nirenjan c86e3f027a Add install rule for Doxygen generated docs 2020-05-26 16:16:54 -07:00
nirenjan 973348e537 Add Stale bot integration
This change enables the Probot stale issues bot to automatically close
inactive issues.

[skip ci]
2020-05-25 23:39:10 -07:00
nirenjan 491e5dffeb Format silent rules for doxygen generation
This change changes the silent rule for doxygen docs to show `DXGEN`
instead of just `GEN`.
2020-05-25 01:25:53 -07:00
nirenjan aff5576106 Disable doxygen MAN generation 2020-05-25 01:25:45 -07:00
nirenjan d9ae8d4b79 Add connect/disconnect methods to libx52
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.
2020-05-23 02:18:40 -07:00
nirenjan 93f1091b95 Ignore additional generated files
[skip ci]
2020-05-22 23:32:17 -07:00
nirenjan 6dc5d51461 Commit automatic changes to PO files
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.
2020-05-22 23:26:48 -07:00
nirenjan dfdf6468bc Update Doxygen documentation
This updates the Doxygen documentation so that the generated
documentation is more readable and accessible to users of libx52
2020-05-22 18:05:07 -07:00
nirenjan fd6afde59c Update libx52 soname to 2.2.0 2020-05-22 16:02:59 -07:00
nirenjan 132b72f562 Ignore generated .mo files
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]
2020-05-22 13:36:53 -07:00
nirenjan d89cce807b Add check for LED support in x52test
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.
2020-05-22 11:15:27 -07:00
nirenjan 482943e7a3 Add feature check method to libx52
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.
2020-05-22 10:39:47 -07:00
nirenjan 0b6bc8f074 Clear the structure memory on exiting libx52 2020-05-22 10:33:33 -07:00
nirenjan cc8d6e9344 Revert hotplug support in libx52
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.
2020-05-22 00:42:01 -07:00
nirenjan 97743d4ebd Add internationalization support for x52test
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.
2020-05-20 14:36:40 -07:00
nirenjan db8629a6a9 Add automatically generated objects to gitignore 2020-05-20 13:15:04 -07:00
nirenjan 84a7e0fe30 Speed up OSX Travis builds
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`.
2020-05-20 01:57:50 -07:00
nirenjan 94a262f13a Force OSX Travis builds to install libusb and gettext 2020-05-20 01:51:42 -07:00
nirenjan 2ea6dcd748 [skip ci] Update README 2020-05-19 16:05:15 -07:00
nirenjan 254bf6baaa Allow builds on OSX to fail without affecting the overall build 2020-05-19 14:20:18 -07:00
nirenjan 1b6736c0f8 Add autopoint to packages list
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.
2020-05-19 12:45:00 -07:00
nirenjan ec9443dcdd Add gettext support to libx52
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.
2020-05-19 08:07:10 -07:00
nirenjan 3949550b65 Update ChangeLog.md
[skip ci]
2020-05-18 15:08:54 -07:00
nirenjan 1c822f9d6b Update ChangeLog.md 2020-05-18 15:06:19 -07:00
nirenjan 45f009ac90 Move LED tests in x52test to the end
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.
2020-05-18 14:59:24 -07:00
nirenjan be1f7e0d5a Fix error handling in x52test
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.
2020-05-18 14:58:31 -07:00
nirenjan 16b4ad693b Fix error reporting in x52cli
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.
2020-05-18 14:38:49 -07:00
nirenjan 665dba187d Add build directory to gitignore 2020-05-18 14:23:08 -07:00
nirenjan 74b828a790 Update Doxygen comments
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]
2020-04-18 02:21:12 -07:00
nirenjan 0204103ccd Add Doxygen support
This change adds Doxygen support in the configure/make step. Doxygen is
optional, and the absence of Doxygen should not break the build.
2020-04-18 01:35:57 -07:00
nirenjan 34dc1b8a32 Declare hotplug functions in libx52.h
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.
2020-04-18 01:30:53 -07:00
nirenjan cb050f2c30 Allow NULL cb_handle in libx52_hotplug_register_callback
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.
2020-04-18 01:28:12 -07:00
nirenjan 79b1f930b8 Change return type of libx52_hotplug_exit
There is really no need for a return code, if the service pointer is
NULL, or any of the parameters are NULL, then simply return.
2020-04-18 01:23:41 -07:00