Commit Graph

476 Commits (53957d08135fbf0b73c64df7f3600778c417bf9c)

Author SHA1 Message Date
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
nirenjan 016851478a Add framework for virtual mouse driver
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.
2021-09-14 10:02:21 -07:00
nirenjan 8874a282aa Add configure check for libevdev
This change is the first in a series of commits to support a virtual
mouse controlled by means of the thumbstick on the throttle unit.
2021-09-14 09:34:11 -07:00
nirenjan 3a81acf828 Fix build with newer version of libusb 2021-09-14 09:28:00 -07:00
nirenjan fa1d54f9da Add CI support for macos-11 2021-09-14 09:21:55 -07:00
nirenjan 7d757dd40f Disable device check routine in daemon
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
2021-09-14 09:10:52 -07:00
nirenjan 627c1fb004 Use libusb hotplug API to automatically detect disconnection
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.
2021-09-14 09:03:23 -07:00
nirenjan f2884c57b7 Print integer representation of LED state when setting it 2021-09-13 15:49:20 -07:00
nirenjan 5fcac86999 Fix gitignore to ignore generated files
[skip ci]
2021-09-03 12:25:41 -07:00
nirenjan a3cc0adb84 Update for release 0.2.2 2021-09-03 11:31:48 -07:00
nirenjan f34f84a3ee Add routine to check device connectivity
Prior to this change, if the clock thread is disabled, then
disconnecting and reconnecting the X52 device would cause the daemon to
not detect the transition. As a result, the daemon would stay in a state
where it thinks the device is still connected, and therefore, not
actually apply any of the saved configuration, until it received a
SIGHUP to refresh the configuration.

This change adds a routine that sends a dummy vendor command. This
vendor command does nothing on my X52 Pro (VID 06a3, PID 0762), but
serves as a check to see if the daemon can send vendor commands to the
device. If the device is indeed disconnected, then that is a sufficient
indicator to disable the update thread and re-enable the acquisition
thread.
2021-08-30 12:33:52 -07:00
nirenjan 0f83cd5a95 Ignore changes to clock settings if clock is disabled 2021-08-30 12:01:41 -07:00
nirenjan 2290900da6 Call tzset before computing timezone offset
POSIX.1-2004 requires that localtime() is required to behave as if
tzset() was called, but there is no such requirement imposed upon
localtime_r(). Therefore, we need to call tzset ourselves to ensure that
the timezone fields are updated.
2021-08-30 11:53:35 -07:00
nirenjan 91f378c4fc Apply configuration immediately when device is connected 2021-08-30 10:41:21 -07:00
nirenjan e0f6813028 Update translations 2021-08-30 10:33:20 -07:00
nirenjan 0899df60c2 Add signal handler to dump configuration to disk on SIGUSR1 2021-08-30 10:28:29 -07:00
nirenjan 76b1b99717 Make sure config file is closed after dumping configuration 2021-08-30 10:28:26 -07:00
nirenjan 38dfc7d7b0 Update translations to include new messages 2021-08-26 22:26:06 -07:00
nirenjan 1174f7f1c4 Bail out if there are changes after make distcheck 2021-08-26 22:22:39 -07:00
nirenjan a39945f461 Import inih library into source tree
Prior to this change, the user needed to install inih as a dependency,
either from the distribution repositories, or from source. On some
platforms (notably macOS), inih is not available prepackaged, and must
be installed by the user. This tends to cause needless friction.

This change imports the ini.c and ini.h files from the upstream inih
repository into the X52 source tree. This will allow us to build the
repository on any system with the original set of dependencies, and not
have to force the user to install packages themselves.
2021-08-26 22:16:38 -07:00
nirenjan 52d6920352 Merge commit '4c9ef85223ec6e638976eb279b82b9e9ea676b35' 2021-08-25 14:22:04 -07:00
nirenjan 4c9ef85223 Squashed 'lib/pinelog/' changes from 27a5eab..0256807
0256807 Use strrchr only if the compiler supports __builtin_strrchr
204aade Use __builtin_strrchr to get file base name
aa0a554 Remove the use of config.h
8983bf8 Ignore test and benchmark programs

git-subtree-dir: lib/pinelog
git-subtree-split: 02568074170f0725196de4e52450db024cc39895
2021-08-25 14:22:04 -07:00
nirenjan 5be91b6e50 Fix stringification of libx52_led_state
A missing comma at the end of the STRINGIFY line was causing builds with
clang to have segfaults with the default configuration. It turned out
that due to the missing comma, the N_("Unknown LED state %d") and
N_("off") parameters were getting merged into a single parameter by
clang, but interestingly, not by GCC.

As a result, when building with clang, the array is "on", "red",
"amber", "green" - note the missing "off" at the beginning of the array.
This causes clang generated builds to segfault when attemping to log a
trace message when configuring LED A (which defaults to green, and the
index of LIBX52_LED_STATE_GREEN exceeds the array bounds).
2021-08-25 14:09:28 -07:00
nirenjan ff10525028 Make inih a mandatory package.
AC_CHECK_HEADERS and AC_SEARCH_LIBS do not abort when the header or
library respectively are not found. Since inih is a hard requirement,
make sure that the action-if-not-found fields call AC_MSG_ERROR.

Fixes #32
2021-08-11 22:22:50 -07:00
nirenjan 874c46705a Add config save routines 2021-08-09 22:16:30 -07:00
nirenjan 3d15da385f Change the config macro definitions to use a type
This change changes the parser element in the CFG macros to be a "type"
element instead. This is handled in the config parser source, where the
macro definition appends `_parser` to the type field. This allows us to
(in the future) add a `_dump` function to dump the configuration to a
file.
2021-08-09 21:25:06 -07:00
nirenjan 2b664513a7 Add Install section to service file to allow enabling the service 2021-08-05 11:46:44 -07:00
nirenjan a09a8bee84 Enable INFO log level in systemd unit file 2021-08-05 10:43:13 -07:00
nirenjan e7af5df69b Use automake rules to install man pages 2021-08-05 10:35:31 -07:00
nirenjan 86960e7e20 Create the log and run directories for daemon to store files 2021-08-05 10:25:45 -07:00
nirenjan 0cf6f247be Add systemd unit file to start X52 daemon 2021-08-05 10:21:28 -07:00
nirenjan 7f5b5a2eaf Disable -Wpacked compiler flag
See issue #31. In systems with a newer version of libusb (1.0.24
onwards), GCC raises a warning that the packed attribute is unnecessary
for `libusb_control_setup`. This is not really a problem for libx52,
since it doesn't call libusb_control_setup directly, but since the
libx52 build framework treats all warnings as errors by default, it will
prevent the build from working.

This change removes the -Wpacked flag from AX_COMPILER_FLAGS, and this
should let the build pass without any issues.
2021-08-05 07:54:53 -07:00
nirenjan 65f4ec9659 Add PID file argument to documentation 2021-08-05 05:47:44 -07:00
nirenjan 0fae24b5d0 Allow x52d to daemonize
Prior to this change, x52d could only run in the foreground, regardless
of the value of the foreground flag. This change adds the standard
double-fork routine to daemonize the program.

This change also adds a PID file argument to x52d, which is used to
ensure that only one instance of the x52d daemon is running at any time.
2021-08-04 13:13:12 -07:00
nirenjan f5331cdef3 Use localtime_r instead of localtime 2021-08-03 13:04:46 -07:00
nirenjan e968656672 Fix Cflags and add libx52util.pc 2021-08-03 12:53:26 -07:00
nirenjan 446fec3b9f Add libx52io pkgconfig file 2021-08-03 12:50:09 -07:00
nirenjan f6cfc59cb6 Fix libx52 pkgconfig file 2021-08-03 12:42:15 -07:00
nirenjan dc72e43f1e Squashed 'lib/pinelog/' changes from bdee493..27a5eab
27a5eab Use localtime_r instead of localtime

git-subtree-dir: lib/pinelog
git-subtree-split: 27a5eab8b75c18d13ec0b69c01deaa82c996cf57
2021-08-03 11:26:06 -07:00
nirenjan d9c1c80163 Merge commit 'dc72e43f1e43a0149c48a684d3b5fd40441ef83c' 2021-08-03 11:26:06 -07:00
nirenjan 699f663df3 Use TEST_DEF as a function macro, instead of #if/#endif blocks 2021-08-02 10:35:37 -07:00
nirenjan 3efdce5abe Fix make distcheck 2021-08-01 23:56:37 -07:00
nirenjan 38917ed6e5 Add documentation for x52d 2021-08-01 23:47:24 -07:00
nirenjan 78e4f3334f Merge branch 'daemon' 2021-08-01 03:01:24 -07:00
nirenjan e358aa9688 Update ChangeLog.md 2021-08-01 03:00:21 -07:00