Prior to this change, there were spurious build failures seen in Github
CI, especially on macOS builds, where one test out of ~2000 would fail
randomly. After adding an option to display the diagnostics, it was
determined that the failure was only in the tests that included the
timestamp. This was because the time call was returning different values
between `test_setup` and `pinelog_log_message`. Even though they may
have been called milliseconds apart, the time skew was enough to have a
1 second difference between the two returned values.
This change overrides the `time` method from libc, and returns a static
value. With this change, CI should work fine regardless of how slow the
tests run.
This change adds the `logging show` and `logging set` commands to the
command processor module. This allows setting the log levels of the
individual modules via the socket.
Prior to this change, if a module had not registered a name, then the
output would display `(null): `, which was not really helpful. This
change eliminates that by checking if the module name is not NULL prior
to calling the print routines.
This commit adds the following changes to pinelog:
- Optional buffer to write the message to prior to writing to the output
stream. This reduces the likelihood of log messages from multiple
threads interleaving due to multiple calls to fputs/fprintf, etc. The
default is to still write directly to the output stream, but the
integrator can add a define of PINELOG_BUFFER_SZ to the CFLAGS, and
this will allow the application to log messages that are shorter than
the above size, including the timestamp, level and backtrace if any.
- Optional module level logging. This allows more fine-grained
debugging, where the application can control the log levels of the
individual modules. By default, when modules are configured, they
default to the global log level, but this can be overridden by the
application.
Prior to this change, it was possible for a malicious client to send a
buffer of 1024 NUL bytes, which would cause the parser to overflow the
argv array and eventually crash the program.
This change makes the length of the argv array the same as the length of
the recv buffer, which means that even an input of all 0 bytes would not
cause any issues. The client would just get a bunch of ERR responses in
return.
The command allows the client to retrieve individual parameters from the
configuration. This follows a similar syntax to the 'config set'
command, with the client supplying the section and key, and if there is
a matching entry in the configuration, it will return the corresponding
value.
This change removes the unnecessary response length field from the
output buffer. It was added to check for possible issues in the
communication between client and server, but is not needed anymore. This
also makes the communication protocol standardized between client and
server.
Prior to this change, the recv call was using the same buflen as that of
the send, which meant that the response would be truncated at by the
client, while the server was sending the entire message. This was
evident by running a Python client which manually called recv with the
maximum buffer size.
This change updates the prototype to take both a bufin (length of the
input buffer), and a bufout (length of the output buffer) argument,
instead of a single buflen. With this change, commands work as expected
in x52ctl.
This change allows setting the configuration from the socket. It behaves
similar to the override, and requires the client to send the section,
key and value, and responds with an OK or error value.
This change adds the generic command parsing logic, as well as the
response for the following commands:
* config load <file>
* config reload
* config save
* config dump <file>
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.
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.
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.
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.
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.