Commit Graph

570 Commits (cpp)

Author SHA1 Message Date
nirenjan eb98804607 Make x52ctl send commands as individual args
This change makes the protocol more strict, in that the buffer sent to
the daemon must be a series of NUL separated arguments. This makes it a
little easier to handle the strings, especially those that may have
embedded whitespace.
2021-11-04 22:37:43 -07:00
nirenjan d8a5a2c3b8 Add daemon command handler loop
This change adds the logic to read a packet from the socket, accept
connections from clients, and close connections from clients that have
hung up. This commit does not yet have support for parsing and handling
the commands, and simply echoes the request back to the client.
2021-11-04 18:32:18 -07:00
nirenjan 5a78492140 Make X52 daemon listen on a Unix socket
This change makes X52 daemon listen on a Unix socket. This is in
preparation for changes that will read from the socket and allow clients
to communicate with and control the daemon.
2021-11-04 13:48:18 -07:00
nirenjan abc74d6e37 Fix linking with libintl on macOS 2021-11-04 11:05:52 -07:00
nirenjan 3225d37e6e Add translations for x52ctl.c 2021-11-04 10:52:14 -07:00
nirenjan 931f945133 Add x52ctl daemon communication program 2021-11-04 10:50:10 -07:00
nirenjan 18c0c72c74 Add client communication library
This change adds a library to connect to the X52 daemon and send
commands and receive responses. The library is a thin wrapper around the
POSIX sockets API. While a client could implement the functions
themselves, the library makes it a little bit easier, as well as
allowing for third-party clients to connect to and communicate with the
daemon.
2021-11-04 10:48:59 -07:00
nirenjan 293ba0a99d Remove duplicate check for default PID file 2021-11-03 11:44:24 -07:00
nirenjan 52429e8dc3 Add translations for x52d_config_dump.c 2021-11-03 11:39:19 -07:00
nirenjan 6c3efa44f5 Simplify configuration dumping
Prior to this change, there was a lot of duplicated code within the dump
routines, which would call out to a common `print_section` routine that
had global state. This causes problems from a multi-threaded perspective
in that multiple calls to `x52d_config_save_file` were not MT-safe.

In addition, the dump logic was written such that it could only be used
in the config dump. It is desired that we add functionality to return
the formatted config value as a string in a different part of the code
as well.

This change brings in the shared state into a stack variable, and
changes the dump functions to return a const char *, thereby allowing
for greater reuse, as well as getting rid of the shared state. However,
there is still a little bit of shared state in the `int_dumper` routine.
This can be ignored for now, but we should possibly figure out how to
get rid of the shared state altogether.
2021-11-02 23:25:55 -07:00
nirenjan 6d78ab1940 Add noreturn attribute to tap_bailout
This change is necessary since clang warns on a missing noreturn
attribute.
2021-10-25 12:56:41 -07:00
nirenjan 3c006d0929 Merge commit '6c17e73284fbe49a6bc7890d3e221b95db29d56f' 2021-10-25 12:51:04 -07:00
nirenjan 6c17e73284 Squashed 'lib/pinelog/' changes from 0256807..349b2d6
349b2d6 Use an in-memory pipe for tests

git-subtree-dir: lib/pinelog
git-subtree-split: 349b2d6e8610ca6c62cfc9211c50ded52ebe38ed
2021-10-25 12:51:04 -07:00
nirenjan 581d2c0bbd Replace macos-latest with macos-10.15
This is necessary since Github will soon change macos-latest to point
to macos-11
2021-10-12 12:15:27 -07:00
nirenjan 8d38c4d16b Fix Makefile to build on alternative make implementations
On some systems (notably FreeBSD), the make implementation makes a
distinction between $(builddir)/<path> and <path>, even when builddir is
`.`. This commit removes $(builddir) from all references to generated
files, so that these implementations don't fail. Keeping $(builddir)
causes older versions automake (1.15 and older) to generate a broken
Makefile.
2021-10-12 12:10:36 -07:00
nirenjan 41be44cc94 Add documentation for x52bugreport 2021-10-11 09:54:27 -07:00
nirenjan 2cc3cc5bfe Update bug issue template to use x52bugreport output 2021-10-11 07:22:29 -07:00
nirenjan 8fd16d544a Add bugreport utility
This change adds a utility that generates some output that can be used
to figure out what the user system is, specifically, the versions of the
following:

* libusb
* hidapi (if available)
* kernel
* device info

These parameters can be used to determine if the user is running some
non-standard environment, and make it easier to track down bugs.
2021-10-11 07:22:21 -07:00
nirenjan 1c0d98c474 Fix link to AUR package
Fixes #39
[skip ci] [skip doxy]
2021-10-10 08:35:57 -07:00
nirenjan ad178d3f6d Make doxygen CI build use release parameters.
The previous commit used the value of `sysconfdir` to store the location
of the daemon configuration file inside the generated documentation.
However, the automatically generated documentation was using the default
values, which meant that the config file was located at
`/usr/local/etc/x52d/x52d.conf`, instead of just `/etc/x52d/x52d.conf`.
Updating the arguments to `./configure` to match that of the release
ensures that it will always stay up to date.
2021-10-07 01:14:05 -07:00
nirenjan d9eed14e0d Include default location of x52d.conf in documentation
This change adds the default location of x52d.conf in the release builds
to the public documentation.
2021-10-06 23:44:16 -07:00
nirenjan fec67b5994 Revert "Enable verbose logging in systemd service"
This reverts commit 53957d0813. It was
supposed to be a temporary commit, but it was forgotten about. Reverting
this will restore the old behavior of only logging INFO and higher
priority logs.

Fixes #38.
2021-10-05 22:38:34 -07:00
nirenjan 247e98c5dc Add kernel driver for Saitek X65F joystick
This commit adds the kernel driver for the Saitek X65F joystick. This is
necessary, since it has the same limitation with the thumbstick not
getting recognized on older kernels. The quirks fix has been pushed to
newer stable kernels, and therefore do not require this driver.
2021-09-29 12:59:34 -07:00
nirenjan 9a39e971f1 Disable Ubuntu 16.04 builds in kernel workflow
[skip ci]
2021-09-29 00:35:51 -07:00
nirenjan e7d91fd3a4 Replace all references to x52pro-linux with libx52 2021-09-29 00:30:55 -07:00
nirenjan f51985dd20 Update main documentation page to reflect use as driver
This change de-emphasizes the use of libx52 as a library, and emphasizes
it as a driver for users to be able to utilize the full capabilities of
the X52 joystick.
2021-09-28 21:26:40 -07:00
nirenjan b45dc59ae0 Add link to AUR
[skip ci] [skip doxy]
2021-09-23 09:47:57 -07:00
nirenjan aef1b6fade Remove rsync dependency and add Fedora packages
This change eliminates the dependency on rsync to copy the Doxygen
generated files, and instead falls back to using `cp -R -P`. Since the
generated HTML needs no special permissions, `cp` is more than
sufficient, and it's already installed on all Unix systems as a core
utility.
2021-09-22 23:37:05 -07:00
nirenjan 794b09e766 Rename package to libx52
Prior to this change, all the generated HTML documentation and locale
files were using the `x52pro-linux` name. That name is no longer
reflective of the project, since it works on macOS and with the non-Pro
X52 as well.

This change is also reflective of the patch used in the released PPA,
which takes care of this anyway, but is being added to the sources to
better integrate with PKGBUILD/AUR/MPR.
2021-09-22 02:46:13 -07:00
nirenjan ba936df6f8 Add Version file and associated scripts
When building from source, it is desired that we embed the version
string into the resulting binaries so that we can determine exactly what
version of the sources were used.

This change adds a Version file, which always holds the latest release
version, and a configure.version script, which tries to get the version
information from Git, before falling back to using the version embedded
in the above file. The generated configure script will then have the
version embedded within it, which will then create the BUILD_VERSION
definition in config.h. Applications can then use this definition as
needed.
2021-09-22 01:37:57 -07:00
nirenjan 5f21ccd2e9 Update for release 0.2.3 2021-09-20 13:24:14 -07:00
nirenjan 3374bb98dc Add instructions to install from PPA
[skip ci] [skip doxy]
2021-09-20 10:16:17 -07:00
nirenjan 00ed62b72e Update translation templates to reflect new version 2021-09-19 16:46:26 -07:00
nirenjan a5a25c307c Update version in configure.ac 2021-09-19 16:41:35 -07:00
nirenjan fe54730447 Update bug template and contributing guidelines
[skip ci]
2021-09-19 16:39:49 -07:00
nirenjan 4d2736e03c Indicate profiles are not yet supported.
See discussion in #37.

[skip ci]
2021-09-19 16:39:49 -07:00
nirenjan 4f427b2ebe Update build instructions
[skip ci]
2021-09-19 16:39:49 -07:00
nirenjan e8abbd0374 Allow for a greater range in mouse speeds
Prior to this change, the virtual mouse update was restricted to
updating once every `mouse_delay` microseconds, and the allowed values
were a small fixed set. Some users reported that even at the highest
speed, the speed was slower than they were used to (with a high DPI
mouse).

This change modifies the speed calculation algorithm as follows. It
keeps the slowest speed to refresh the mouse every 70 ms. As the speed
increases, the refresh rate drops by 5 ms for every increment in speed,
until the refresh rate caps at once every 10 ms. Beyond that, a
multiplicative factor begins to take effect, with each speed increase
adding 0.25 to the factor. That is, speed 13 would multiply the axis
components by 1.25 _and_ refresh every 10 ms. Speed 14 would bump the
factor to 1.50, speed 15 to 1.75, and so on, until the factor tops out
at 6.0.
2021-09-19 16:39:49 -07:00
nirenjan d8fc859e44 Change mouse speed parameters
Prior to this change, the mouse delays were between 50 ms to 250 ms,
with a difference of 50 ms between steps. Unfortunately, this was too
slow at lower speeds, therefore, the delays have been changed to vary
from 30 ms to 70 ms with a difference of 10 ms between steps. This gives
a much smoother mouse response.
2021-09-15 09:25:26 -07:00
nirenjan 4365e86f2a Fix logging indicating mouse speed range 2021-09-15 09:17:15 -07:00
nirenjan 16e53b897f Use $(localstatedir)/run instead of $(runstatedir)
`runstatedir` is only available in Autoconf 2.70, but unless the
distribution is a bleeding edge system, it most likely uses Autoconf
2.69. That said, several major distributions have backported runstatedir
support to the older versions, hiding the issue. See #35.

This change replaces all references to runstatedir to use
$localstatedir/run instead, which is what is recommended by the autoconf
manual.

This also updates the build instructions to add --localstatedir and
--sysconfdir. This is because the lack of the options would have them
default to `$(prefix)/var` and `$(prefix)/etc` respectively, and with
prefix set to `/usr`, these would be the bogus directories `/usr/var`
and `/usr/etc`.
2021-09-15 09:06:31 -07:00
nirenjan 8deb6a1513 Merge device acquisition and update threads 2021-09-15 00:17:20 -07:00
nirenjan c56f715155 Fix use of libx52io return codes
Prior to this change, we were treating ERROR_NO_DEVICE as if the hidapi
library itself would return such a code. However, that is not the case,
and we should be treating any error condition as a critical issue and
treat it as if the device was disconnected. The worst case scenario is
that it would have to re-enumerate the HID device list and reopen the
joystick.
2021-09-15 00:06:43 -07:00
nirenjan 025a06351a Apply mouse button events immediately
Prior to this change, the button change events were only happening on
periodic intervals corresponding to the change in the mouse REL_X and
REL_Y values. However, this has the issue that it tends to miss a few
events, especially those related to the scroll wheel.

This change reports button and wheel events immediately when receiving
the report, but it leaves the motion to be updated by the thread.
2021-09-14 23:35:05 -07:00
nirenjan 53957d0813 Enable verbose logging in systemd service 2021-09-14 17:34:20 -07:00
nirenjan 2a8ca8424e Reset reports on thread create and device disconnection
This ensures that if the device gets disconnected while the axis is held
outside of the default position, the axis will get reset.
2021-09-14 17:34:07 -07:00
nirenjan 276b512478 Update dependencies and changelog 2021-09-14 17:18:46 -07:00
nirenjan 7f29f5f5fe Add mouse update thread
This change adds a thread to translate thumbstick events to a virtual
mouse.
2021-09-14 17:08:01 -07:00
nirenjan 42850bc4cd Create I/O thread to read and process events
This change adds a separate thread to initialize and read reports from
the supported X52 device. This will then process and raise input events
for a virtual device.
2021-09-14 13:33:36 -07:00
nirenjan b9e5f34aa4 Add support for building on macOS
Prior to this change, the build would fail on macOS systems because the
evdev sources were only included on Linux systems, and macOS does not
have evdev/libevdev. By separating out the configuration and update
threads, this should build on macOS, but the configuration would be
ignored.
2021-09-14 10:40:48 -07:00