Commit Graph

16 Commits (945ddc63a35f89214ff3efa9cb319bc869c52247)

Author SHA1 Message Date
nirenjan 09eb7d31e8 x52test: Clean up compiler warnings 2020-06-11 23:39:28 -07:00
nirenjan 37162510ac Enable additional compiler warnings
This change adds additional compiler warnings as detected by the
autoconf archive. Because the code is susceptible to these additional
warnings, disable treating warnings as errors for now, until we can fix
the warnings.
2020-06-11 23:38:44 -07:00
nirenjan 88f02bc5da Add _GNU_SOURCE to all files
If configured with CFLAGS=-std=c99, then quite a few warnings are
raised, as well as a couple of errors. By forcing the system to use
_GNU_SOURCE, we can allow the compilation to succeed even if using a
user defined C standard.
2020-06-05 16:37:20 -07:00
nirenjan 543aec85b1 Add config header to all C files 2020-06-05 15:19:56 -07:00
nirenjan 8e77d6f09b Correct type of loop variable
If `-Wpedantic` is given as part of CFLAGS, this flags a warning stating
that `int` and `size_t` are of different sizes. This simply changes the
type of `i` to `size_t` to match the output of `strlen`.
2020-06-04 15:48:57 -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 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 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 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 dc80a0f2f1 Add option to run test without delay
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.
2020-04-12 16:48:29 -07:00
nirenjan 1d51429f10 Make x52test use X macros 2018-07-17 17:21:21 -07:00
nirenjan 7dcd3049ec Add SPDX license identifiers in all files 2018-04-18 12:19:29 -07:00
nirenjan f3270def9d API change for libx52
- 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
2017-08-23 19:30:35 -07:00
nirenjan f0a0a7dcaf Reorganize source layout 2017-07-27 17:56:51 -07:00