Commit Graph

590 Commits (e08c46f6c423b6760964c32fcfb3f76e237dba0d)

Author SHA1 Message Date
nirenjan e08c46f6c4 Update for release 0.3.0 2022-12-25 21:57:28 -08:00
nirenjan 708ace20be Fix builds on macOS 2022-09-23 21:15:19 -07:00
nirenjan 4b411d6767 Add notifications when device is connected/disconnected 2022-09-23 15:15:49 -07:00
nirenjan 8b2c0e4a2f Add test cases to verify libx52 identifier to string conversion 2022-09-23 14:28:19 -07:00
nirenjan b810c457f9 Use x52ctl to test daemon communication
This allows us to test x52ctl as well as the daemon communication
infrastructure.
2022-09-23 10:02:17 -07:00
nirenjan ccabb5c953 Add test case for setting unknown configuration value 2022-09-22 22:14:44 -07:00
nirenjan b2f292bf58 Cleanup config dump routine 2022-09-22 21:31:49 -07:00
nirenjan 7f59984357 Ensure notification socket is bound when starting daemon 2022-09-22 21:28:20 -07:00
nirenjan c2c2e91089 Update translation files 2022-09-22 14:45:31 -07:00
nirenjan d60ab7e1e4 Add logging test cases to EXTRA_DIST 2022-09-22 14:45:15 -07:00
nirenjan 2b7c643537 Add test cases for logging command 2022-09-22 14:23:30 -07:00
nirenjan d96b86a817 Return module name in "logging show" command 2022-09-22 14:23:13 -07:00
nirenjan fea095dc50 Add notify module to logging list
The notify module controls the logging settings for the notify socket
code. While missing this doesn't cause any impact to the notify code, an
invalid module name sent on the command socket could cause the daemon to
crash with a NULL pointer access.
2022-09-22 14:21:14 -07:00
nirenjan 1dcadb9428 Rename test cases and add them to EXTRA_DIST 2022-09-22 11:21:53 -07:00
nirenjan ecfb865c58 Fix pattern for daemon tests and sort by filename 2022-09-22 09:39:30 -07:00
nirenjan b1c7a16eac Update daemon documentation to include notify socket
[skip ci]
2022-09-21 20:08:58 -07:00
nirenjan b38a75462d Update translations for new files 2022-09-21 09:31:53 -07:00
nirenjan 619d516ccc Add notify API
This change adds a notification API to libx52dcomm. It also pulls in the
logic to join multiple arguments into a single buffer for later use.
2022-09-06 23:19:03 -07:00
nirenjan 88159d4fc5 Disable deprecated Github-hosted runners 2022-09-02 23:03:53 -07:00
nirenjan c3a4fea139 Update int_parser to reject invalid input 2022-09-01 20:50:36 -07:00
nirenjan 1d1e5781c2 Merge branch 'fix-hotplug' 2022-08-07 09:15:04 -07:00
nirenjan 1a02ad22d9 Handle libusb events when checking if device is connected
libusb requires the application to call one of the
`libusb_handle_events` functions in order for hotplug events to actually
get dispatched. We don't need to wait for any timeout, so we use a
default timeout of 0, which should process any pending events, and then
return immediately.

A test of repeatedly disconnecting and reconnecting a virtual device
using USBIP was done, and no crashes of the daemon were observed.

Github-Issue: https://github.com/nirenjan/libx52/issues/43
2022-08-06 16:49:28 -07:00
nirenjan b822d3aed8 Move command processing into separate thread
This will help in moving a lot of the functionality out of the main
thread, and limit the main thread to just signal handling.
2022-07-27 12:47:53 -07:00
nirenjan dfa78ff2a9 Remove deprecated macos-10.15 runner
See: actions/virtual-environments#5583

References:
- https://github.com/actions/virtual-environments/issues/5583
2022-07-27 11:40:48 -07:00
nirenjan d3d32cf278 Block signals on child threads
This change adds logic to block signals on child threads. This is done
so that we can migrate signal handling to the main thread, even if we
add additional threads in the future.
2022-07-27 11:33:44 -07:00
nirenjan b0f9006594 Update Changelog.md
[skip ci] [skip doxy]
2022-07-24 21:55:38 -07:00
nirenjan 35f5da6b50 Upgrade CodeQL actions to v2
See: https://github.blog/changelog/2022-04-27-code-scanning-deprecation-of-codeql-action-v1/
2022-07-03 21:59:00 -07:00
nirenjan 41812e3c1e Add unit tests for mouse reverse scroll 2022-07-03 16:00:13 -07:00
nirenjan 95a10b5ac9 Add option to reverse mouse scroll direction
This change adds a ReverseScroll parameter to the configuration, which
if set, will change the direction of the scroll wheel of the virtual
mouse.

Github-Issue: #45
2022-06-14 09:36:13 -07:00
nirenjan d0f0232dae Add beta versions of runners to CI build
This change adds support for the public beta of Ubuntu 22.04 and
macOS 12. As this is a beta, this change also updates the
continue-on-error field to indicate that a build failure on the 22.04
runner should not cause the rest of the build to fail.

[skip doxy]
2022-06-13 01:58:46 -07:00
nirenjan ba9348b888 Include locale.h in gettext.h
When building with coverage enabled, the compiler complains about
missing definitions for setlocale and LC_ALL. These can be found in
locale.h, and by including it in gettext.h, we can ensure that we won't
see any more such issues.
2022-06-13 01:45:34 -07:00
nirenjan 0ac3a3d0c4 Add additional tests for x52cli
This change adds additional tests to verify the parser behavior, as well
as the handling of any error conditions from libx52 itself.
2022-06-12 03:37:21 -07:00
nirenjan 552e638b27 Remove obsolete check for invalid handler
Since the introduction of X macros to the CLI handling code, there will
never be a condition where the handler will be NULL. This is a legacy
check from when the code had individual maps that were maintained by
hand.
2022-06-12 03:34:53 -07:00
nirenjan 44fba0c6cd Always return 1 from x52cli for any failure
Prior to this change, on failure condition, x52cli would exit with a
code that mapped directly to the return code of the function. This was
inconsistent with the behaviour if the initialization or connect steps
failed for any reason.
2022-06-12 03:32:25 -07:00
nirenjan a119fe2c60 Fix translation objects 2022-05-16 10:48:07 -07:00
nirenjan 8c8f261c80 Disable use of PID file when running in foreground
When running in foreground, it is likely that it is running within
systemd. In this case, a stale PID file is likely to have a PID that
corresponds to a different process, which can still be kill'ed by the
root user. This results in a false positive that the process is still
running and causes the daemon to abort prematurely.

Fixes #42
2022-05-16 10:33:04 -07:00
nirenjan 6a8dff0a17 Fix mouse test linker failure on macOS 2022-04-28 02:18:13 -07:00
nirenjan 8f9ab9cefd Add tests for mouse configuration
This change adds a test suite for validating mouse configuration. This
only tests the logic for mouse thread enable/disable and mouse speed
calculations.
2022-04-28 01:54:09 -07:00
nirenjan 3168061c99 Add output of x52bugreport to CI run 2022-04-27 00:10:27 -07:00
nirenjan 24ce9bc97b Generate Git version info at call to make
Prior to this change, the Git version was only getting generated when
the call was made to autoreconf. This was resulting in stale version
info.

This change, by contrast, generates the build info at the call to make.
While this doesn't completely eliminate the stale version issue, it's
easier to work around, by simply running `make clean`, `make`.
2022-04-27 00:05:02 -07:00
nirenjan 251ccfde0d Close command socket in test harness before terminating daemon 2022-04-08 22:59:37 -07:00
nirenjan 611bc9d965 Add mouse speed test cases 2022-04-08 17:30:34 -07:00
nirenjan 69426c62d8 Add tests for LED parser 2022-04-08 17:00:45 -07:00
nirenjan 054df1ab7a Cleanup libx52io init/open calls 2022-04-08 16:47:46 -07:00
nirenjan 527d4d5a1e Run daemon communication tests only on Linux
For some reason, the CI runs on Github Actions block the macOS runners,
and they take forever to run the tests. The tests are really needed only
on Linux, and the errno values that it uses are only verified to work on
Linux.
2022-04-08 00:26:44 -07:00
nirenjan c87c7caa68 Add test cases for clock configuration 2022-04-08 00:16:57 -07:00
nirenjan 0f7cd3fdb3 Add test cases for config get/set with wrong argc 2022-04-08 00:16:39 -07:00
nirenjan 33e940606c Add daemon communication test cases
This change adds an automated test harness that will spin up an instance
of the X52 daemon, connect to its command socket, send commands and
validate the responses. This first set of test cases simply validates
the basic configuration file handling. Subsequent commits will enhance
the tests to improve code coverage.
2022-04-07 23:24:24 -07:00
nirenjan f0ad185421 Fix formatted responses to include the trailing NUL 2022-04-02 08:23:55 -07:00
nirenjan 98822190ed Add a callback to apply one configuration item immediately
The configuration processing works as follows - the configuration
parameters are set in memory, and an apply function applies all the
changes directly to the device. While this works during startup and
reload, it adds a needless overhead when processing config set commands
from the command socket.

This change makes it such that a `config set` command would update the
configuration for that particular key, and then immediately call the
callback function for that key. This has the effect that individual
configuration changes are visible immediately, without having to reapply
every other configuration that hasn't changed.

This commit also removes the `config apply` command, since it is no
longer needed. The `config load` and `config reload` already handle
applying the configuration after reading it.
2022-02-11 13:30:17 -08:00