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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
`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`.
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.
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.
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.
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.
This change adds the configuration and build related changes for
supporting the virtual mouse. Subsequent commits will add support for
reading the IO interface and translating it to mouse commands.
Prior to this change, the device check was sending a vendor specific
command with wIndex and wValue both set to 0 every 50 ms. On some
systems, this was causing issues with the joystick flapping the state,
and reporting weird values from the stick, and generally sluggish
response.
This change uses the updated libx52 library which uses the hotplug
notification to determine if the device is connected, and should resolve
the issues seen.
Fixes#33
Prior to this commit, the libx52_is_connected API was simply checking if
the device handle was non-NULL. However, this was insufficient, since
the device disconnection would not reset the handle, and was relying on
the daemon to manually disconnect.
The libusb hotplug API provides functionality to register a callback on
device insertion/removal. libx52 only registers for removal, and will
automatically disconnect the device on receiving the callback. This also
modifies libx52_is_connected to fallback to checking if the kernel
driver is active if the linked libusb does not support hotplug (unlikely).
Finally, this commit adds support for the new hotplug related functions
to the libusbx52 preload library. While the preload library doesn't
actually support hotplug, it is sufficient to pretend that it does.