This change is an initial step to adding support for profiles in x52d.
This will allow the user to create a keyboard layout in an easy to
read/write text based format, and have it compiled into a flat layout
that's easy for the daemon to parse and load into memory. This layout
can then be used to map a user's action key to the actual input usage
needed. This is necessary, because keyboards don't actually send the
character that is typed, but just the position on the keyboard. For
example, on a French AZERTY keyboard, the A key would actually send the
usage for `Keyboard_q_and_Q`. The OS would translate that into the
letter 'a' (or 'A' if Shift key is held) and pass that to the active
window.
This commit adds the full logic necessary for the layout loading,
validation and compiling, as well as tests for the compiler and loader.
Prior to this change, pinelog would always strip the directory prefix
from __FILE__, displaying only the basename.
This change adds the ability to check the full path passed to the
compiler, which may still be only a basename, but that's still fine.
As part of the refactor, have the sources include the public headers via
the libx52 prefix, instead of relying on the include directories
approach in meson.build
Modern libraries do not handhold the user into just calling the header,
instead they namespace it, e.g. libevdev/libevdev.h. Because we already
install our headers under the libx52/ directory, having the pkg-config
files specify `-Ilibx52/` is a legacy from the old days, and should no
longer be used.
This commit also adds pkg-config files for x52dcomm and vkm, installing
them in their proper locations.
The autotools build infrastructure was deprecated back in 0.3.3, and any
bugs in the Meson build infrastructure have been fixed now. This
eliminates the legacy build scripts which were hard to maintain.
This change add APIs to convert the string forms of the axis and button
names back to their corresponding enum identifiers. This is effectively
built such that a roundtrip of _to_str and _from_str will return the
same input. The _nocase variants handle case insensitive matching of the
names by folding of the ASCII alphabets A-Z and a-z only, so it doesn't
depend on localization.
This change allows us to create manual key maps in the future, allowing
users with different keyboard layoutss to share a profile without having
to rewrite it for their keyboard layout.
Prior to this change, the mouse speed was controlled by an opaque
numeric value, that controlled both the speed and the delay between
updates. This caused a lot of choppy behavior with lower speeds, and the
really low speeds had as little as 1% speed difference between them in
the practical pixels/second speed, while there was effectively a 50%
jump in the speed between speed settings 11 and 12, due to the
hyperbolic relationship between steps. Post that, it was an even 25%
increase in sensitivity for every step.
This change modifies it so that the old Speed option is deprecated, it
is now replaced by the Sensitivity option, which is a direct percentage
scale from 10% to 500%. In addition, there is a CurveFactor option to
let it have fine control when there is little deflection, and move
faster when further away from the center. This also adds an
IsometricMode option which computes the speed as a function of the
cartesian distance from the center (`sqrt(dx^2 + dy^2)`). The default
behavior uses the existing linear speed which controls the speed of the
X and Y axes independently, but now uses the sensitivity and curve
factors to get better behavior. Also, the mouse events are consistently
reported every 10ms. This should make it a lot smoother.
Finally, this change also adds a Deadzone factor, which allows the user
to ignore small changes near the center of the joystick that can cause
mouse drift. This deadzone uses the total distance, so if just the X or
Y axis has moved, it will still allow suppressing any play in the thumb
stick.
Issue: #44
Prior to this change, there is a potential bug where if the left and
right mouse buttons and/or wheel are reported in the same HID report,
the first one to have a change would block any subsequent items. This is
due to the shortcut execution of the `||` operator. By switching the
order in which we evaluate the operands, we can ensure that the report_*
functions are always called.
SonarQube flagged the use of bitwise operators with boolean variables.
This is changed to use the correct logical operators instead of their
bitwise equivalents.
Previously, x52d had conditional compilation flags linking to libevdev
on Linux. However, I wanted to change this so that we use an abstraction
layer that will link to the appropriate backend (evdev on Linux only for
now). The idea is that we get rid of all conditional compilation blocks
and deal with the backend through the vkm library.
This new library handles the mouse scrolling, clicking, as well as
adding the ability to include keyboard events so that we can support the
profiles feature in a future commit.
Previously, the build workflow was restricted to running only on Ubuntu
22.04, Ubuntu 24.04 and macOS, which are the only available native
runners on Github Actions. However, the Ubuntu runner does allow us to
run the build inside a container. Therefore, this commit adds the
ability to pull a prebuilt container with all the necessary dependencies
and build libx52 inside of that container. This commit also adds support
scripts to build the containers and run the CI build against those
prebuilt containers locally for testing, without having to rely
exclusively on Github Actions.
This change also adds support for testing libx52 against Alpine Linux,
in order to verify the portability, given that Alpine uses musl instead
of glibc. The limitation is that we need to mount the `/dev/bus/usb`
device tree inside the container, otherwise libusb inside the Alpine
image fails with LIBUSB_ERROR_OTHER. This is not a concern on the other
distributions, but due to limitations in the Github actions environment,
there is no `/dev/bus/usb` tree to export. For this reason, Alpine is
not a part of the CI build, but is available for testing locally.
Also, because a default bare container would need several minutes of
package installation just to get to a point where we could run
build-and-test.sh, this includes a prebuild workflow which generates the
container images and pushes them to ghcr.io, and the build workflow
pulls from there. There is also logic to ensure that we only keep the
latest image, since there is no value in retaining older images.
This change removes the old autotools based documentation and switches
to using Meson exclusively. In addition, the build action will build
using meson compile and meson test instead of ninja/ninja test.
The previous commit to address #63 added a number of extra unwanted man
pages. This commit addresses that and scopes down the actual installed
man pages to only x52cli and x52bugreport.
GH-Issue: #63
GH-Issue-URL: https://github.com/nirenjan/libx52/issues/63
The change to build using Meson broke the install target, causing x52ctl
and x52d to fail with a missing libx52dcomm library. This was fixed by
setting `install: true` in the library call.
In addition, several features were used that were leftover from my
earlier attempts to migrate to Meson, but targeted older Meson versions.
Some of these features were deprecated in newer Meson versions, and
therefore, cause warnings to show up during meson setup.
GH-Issue: #63
GH-Issue-URL: https://github.com/nirenjan/libx52/issues/63
When enabling --warnlevel=3 during Meson setup, the build threw up
several warnings, mostly related to either unused parameters, or
sometimes an integer type mismatch. This commit addresses all of those
changes and ensures that the build does not contain any unnecessary
warnings.
With a recent enough version, the compiler reports a number of unused
parameter warnings when Meson is configured with `--warnlevel=3`. This
commit addresses those warnings.
Doxygen in Ubuntu 24.04 has removed several features, and introduced a
few new ones. This commit updates the Doxyfile.in template to use the
current syntax.
CI: [skip ci]
Prior to this change, the pinelog benchmark suite was running as a
regular test, however, this is not ideal since it can result in timing
issues and giving false data to the runners.
This change explicitly marks them as benchmarks, so they can run using
`meson test --benchmark`
In order to continue to support Automake builds, we need to update the
source to comply with C90 standards, as well as ignoring the warnings in
the test binary.
Prior to this change, the libx52util_convert_utf8_string function had a
limited set of characters that it would convert to the MFD character
map, these characters were derived from the x52_char_map.cfg file.
However, this is a tiny subset of the actual supported characters in the
Basic Multilingual Plane (BMP), since many characters in the BMP can be
normalized to a different character (or character sequence) that has a
corresponding glyph on the X52 MFD.
One example of this is the half-width Katakana characters which are
mapped in the display, however the corresponding full-width characters
were not explicitly mapped. With this commit, the generator script now
automatically detects that the half-width characters can be normalized
to the corresponding full width forms, and maps the full width forms
back to the correct characters on the MFD.
A second benefit of this change is that the MFD can now show characters
that would otherwise never be seen, for example, the 3/4 symbol or 5/8
symbol have no corresponding glyph in the MFD, but they can be
translated to the sequence `3` `/` `4`, giving us much more flexibility
on the characters that can actually be displayed.
Finally, with this change, the function also maps missing or unsupported
characters to the box character (0xDB in the display), making it clearer
that there was something there that could not be displayed. Earlier, it
would have simply skipped that character.
Because several bugs were found in the Meson build infrastructure since
the release of v0.3.3, I've had to keep the existing Autotools
infrastructure running for a bit longer while I address the bugs. As of
this commit, Autotools is still the preferred way to build libx52,
though it is technically deprecated and will be replaced with Meson as
the source of truth.
CI: [skip ci] [skip doxy]
Prior to this change, running meson test without running meson compile
first would cause the daemon communication tests to fail since it
wouldn't find the x52ctl binary. While I could rewrite the test runner
to directly talk to the daemon, it's faster to just ensure the
dependencies are setup correctly.
Prior to this change, the check was for an explicit -Dnls=enabled,
however, if the option was never set, it defaulted to disabled. With
this change, unless explicitly disabled, the Meson build system will
automatically build with NLS support.