Commit Graph

182 Commits (1c822f9d6bf8c478aea422319f0cc4caf1d5f291)

Author SHA1 Message Date
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
nirenjan d45b1f7bfd Disable trusty builds on Travis
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.
2020-04-17 00:11:19 -07:00
nirenjan 116f7b3a57 Install libx52.pc during make install 2020-04-17 00:04:09 -07:00
nirenjan 06fa56bb9f Add missing documentation to distribution tarball 2020-04-17 00:00:46 -07:00
nirenjan 848d70fcf2 Generate pkg-config file for libx52 2020-04-16 22:10:48 -07:00
nirenjan e49261c8d6 Move pthread build logic to configure.ac
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.
2020-04-15 17:31:46 -07:00
nirenjan 9dc92eb52e Force the use of STDC when building 2020-04-14 23:45:35 -07:00
nirenjan 42f416af1d Update version and changelog for hotplug support 2020-04-14 18:38:12 -07:00
nirenjan aa259bf343 Add hotplug support to libusbx52 2020-04-14 18:36:44 -07:00
nirenjan 946916f456 Add hotplug support to libx52
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.
2020-04-14 18:36:44 -07:00
nirenjan 152a3e7932 Update for release 0.2.0 2020-04-14 18:30:16 -07:00
nirenjan f9639a9a00 Update ChangeLog
[skip ci]
2020-04-13 00:44:33 -07:00
nirenjan 243b0330af Update build status in README
[skip ci]
2020-04-12 22:23:47 -07:00
nirenjan a5b69124a4 Update build matrix to include OSX, Xenial and Bionic
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.
2020-04-12 22:04:43 -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 a7caba19df Set debug output to be line buffered
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.
2020-04-12 16:29:22 -07:00
nirenjan 40b2e9bdac Remove debugs from MFD test script 2020-03-31 23:22:04 -07:00
nirenjan 40c14fed24 Update calls to libusb_set_debug
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`.
2019-02-01 21:31:57 -08:00
nirenjan 1d51429f10 Make x52test use X macros 2018-07-17 17:21:21 -07:00
nirenjan 9e581bf051 Let libx52_init also translate libusb error codes 2018-07-17 16:00:19 -07:00
nirenjan b1139806f5 Use X-macros for x52cli commands 2018-07-17 15:46:54 -07:00
nirenjan 7dcd3049ec Add SPDX license identifiers in all files 2018-04-18 12:19:29 -07:00
nirenjan e31f1e442b Move license text to LICENSE file 2018-04-18 12:16:48 -07:00
nirenjan 0913212ecc Always return translated error code
LIBUSB_SUCCESS is also handled by libx52_translate_libusb_error.
2017-10-27 14:20:19 -07:00
nirenjan 02c24cc964 Fix timezone offset calculations for large negative offsets 2017-10-27 14:19:38 -07:00
nirenjan 46cba64e6b Update build requirements in README
[skip ci]
2017-10-12 21:35:58 -07:00
nirenjan 86642e5b16 Use pkg-config for libusb 2017-09-10 17:13:38 -07:00
nirenjan 3845c81229 Add libx52_strerror API 2017-08-28 22:54:46 -07:00
nirenjan 6f3f8d7c46 Add more error codes and translation from libusb
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.
2017-08-28 19:10:41 -07:00
nirenjan d4afbd6de2 Build libusbx52 only for tests 2017-08-25 06:39:04 -07:00
nirenjan e5ea621899 Fix libtool version info for libx52
Also update package version to indicate it is in pre-release stage.
2017-08-25 06:04:36 -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 fb222dda89 Add Changelog 2017-08-19 15:59:57 -07:00
nirenjan 82fa0cea28 Bump version number 2017-08-18 07:50:12 -07:00
nirenjan 21d6b503a7 travis-ci: Enable parallel make 2017-08-18 07:32:50 -07:00
nirenjan d54e02be5a Add test cases for raw time and date APIs 2017-08-18 07:28:23 -07:00
nirenjan acdcebc52e Add CLI commands to access raw date and time APIs 2017-08-18 07:26:50 -07:00
nirenjan 52abd335ab Add raw time and date APIs to libx52
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.
2017-08-18 07:23:49 -07:00
nirenjan 6b89a9d7f9 Clarify Doxygen comments for libx52 2017-08-16 23:38:19 -07:00
nirenjan 533a472b10 Fix formatting for x52cli manual 2017-08-16 00:05:05 -07:00
nirenjan 780447122c Reduce number of included headers for libx52util.h 2017-08-16 00:04:10 -07:00