Commit Graph

662 Commits (ae077dbed88a7cb23794dc560676b16d769e8c75)

Author SHA1 Message Date
nirenjan ae077dbed8 fix: Add library version for libx52dcomm
This change adds the library version for libx52dcomm, so that it can be
versioned if necessary.
2026-03-17 16:43:54 -07:00
nirenjan d29be6213f doc: Add badges for SonarQube and CodeCov
CI: [skip ci] [skip doxy]
2026-03-16 23:22:23 -07:00
nirenjan 273ed22f8e refactor(x52ctl): Break out interactive mode
SonarQube keeps complaining about issues with cognitive complexity and
bad practices, this commit addresses those commits.
2026-03-16 23:07:39 -07:00
nirenjan cdb00739ca fix(x52ctl): Remove unnecessary goto statements
The `goto cleanup` statements are not really needed, and can be safely
replaced with `break` statements in x52ctl.
2026-03-16 22:50:11 -07:00
nirenjan 08a6b0a736 build: Add coverage support with codecov.io
This change adds code coverage to the Meson builds, and reports them to
codecov.io, to help keep the code coverage high.
2026-03-16 22:39:12 -07:00
nirenjan 45d561e0d8 test: Fix SMP test in libx52util
The SMP test was incorrectly calculating the codepoints, resulting in a
test of the codepoints inside the BMP, instead of the individual SMPs.
2026-03-16 22:23:00 -07:00
nirenjan b626a9367f fix(pinelog): Mark benchmark tests as such in Meson
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`
2026-03-16 15:56:38 -07:00
nirenjan a1098bc134 feat: Add benchmarking for libx52util-bmp-test 2026-03-16 11:16:41 -07:00
nirenjan 569902be76 fix: Add support for Automake tests
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.
2026-03-16 10:45:02 -07:00
nirenjan 0cb137bbe0 feat: Handle the entire BMP in libx52util
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.
2026-03-16 10:18:16 -07:00
nirenjan 899ea57bf7 doc: Update ChangeLog.md to list Meson bugs
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]
2026-03-13 09:54:23 -07:00
nirenjan e1e020a4f5 fix: Handle test dependency on x52ctl
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.
2026-03-13 09:27:51 -07:00
nirenjan 7cbf091dc7 fix: Ensure man pages and docs are installed via Meson 2026-03-12 16:19:49 -07:00
nirenjan 9d180531b9 fix: Treat NLS=auto as enabled
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.
2026-03-12 15:53:30 -07:00
nirenjan 74229b391d fix: Update pkgconfig to use correct details 2026-03-12 15:35:11 -07:00
nirenjan 5f8177f16b fix: Use correct paths for local,sysconf,localstate dirs 2026-03-12 15:17:00 -07:00
nirenjan c5ec15231f feat: Add meson support for configuring udev rules dir 2026-03-12 14:45:08 -07:00
nirenjan 33bbafe970 fix: Fix systemd service installation in Meson
The Meson build change broke the systemd service file installation. This
commit fixes that, while retaining Autotools support.
2026-03-12 13:21:59 -07:00
nirenjan e9a806a6a2 fix: Update meson.build to handle localization
The previous version of the Meson build files did not handle the po
directory correctly, and lost a lot of information. As part of the
migration away from Autotools, this is one more item that needs to be
checked off.

CI: [ci skip] [doxy skip]
2026-03-12 12:48:23 -07:00
nirenjan ad30bfff7b fix: Typo in release changelog generation 2026-03-12 12:10:26 -07:00
nirenjan cccb561020 feat: Add Changelog generation script for releases
This change automates the release workflow and reduces manual touch.
2026-03-12 12:06:24 -07:00
nirenjan 6743c60dfd doc: Update for version 0.3.3 2026-03-12 11:34:54 -07:00
nirenjan b4ec8d4629 build: Migrate to meson build
Meson is a far more robust build framework, compared to autotools. This
greatly simplifies adding new features, since it's far easier to
maintain a set of meson.build files vs the autotools mishmash.

DEPRECATION NOTICE: Autotools based build is deprecated and will be
removed in the future.
2026-03-12 10:20:01 -07:00
nirenjan 3fb0d72124
Merge pull request #62 from nirenjan/remove-inih-dependency
build!: Update build to use system inih
2026-03-12 09:57:44 -07:00
nirenjan 74fe559f4a build!: Update build to use system inih
When the x52d daemon was originally implemented, the inih library was
not bundled with any major distribution, and had to be compiled from
source everytime. However, with recent distributions (starting with
Ubuntu 22.04 LTS), this is no longer an issue, and inih is available in
the distro package manager. As a result, there is no longer a need to
vendor the inih sources with thiis repository.

However, as a result of this change, third party packaging scripts such
as those on the AUR or other similar registries that directly query the
git repository will fail unless they update the dependencies.

BREAKING CHANGE: Packaging scripts (AUR, etc.) need dependency update
2026-03-12 09:50:58 -07:00
nirenjan b6e61fc54e fix: Avoid backward jumps using goto
SonarQube cloud identified a maintainability issue based on MISRA C
guidelines that prohibit backward jumps. While not a mandatory fix, it
helps to clean up the codebase and improves readability.

Ref. MISRA C:2012, 15.2 - The goto statement shall jump to a label
declared later in the same function.
2026-03-12 08:34:58 -07:00
nirenjan e479e338a2
Merge pull request #61 from nirenjan/dependabot/github_actions/actions/upload-pages-artifact-4
build(deps): bump actions/upload-pages-artifact from 3 to 4
2026-03-10 08:47:54 -07:00
dependabot[bot] 69ae9626c7
build(deps): bump actions/upload-pages-artifact from 3 to 4
Bumps [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-pages-artifact/releases)
- [Commits](https://github.com/actions/upload-pages-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-pages-artifact
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-10 08:18:25 +00:00
nirenjan e9f4e1b3a8 test: Add test cases for libx52util
This change adds a test suite for libx52util, testing all the positive
cases where a character is added to the lookup table. For now, this test
suite only verifies single character mappings, not double character
mappings. A future commit will add test cases for characters not in the
map.
2026-03-09 14:43:33 -07:00
nirenjan f43ba6b902
Merge pull request #60 from nirenjan/add-action-permissions
ci: Add permissions blocks to action definitions
2026-03-09 10:39:41 -07:00
nirenjan 378cbbd931 ci: Add permissions blocks to action definitions
CodeQL identified a medium severity security issue with the action
definitions not including a permissions block as required by modern
security practices. This change ensures that the majority of the actions
force the token to be read-only and not accidentally write content back
into the repository.
2026-03-09 10:34:40 -07:00
nirenjan 47da6e22d1 ci: Fix doxygen.yml to include enviroment 2026-03-09 10:30:00 -07:00
nirenjan e98b8b4bc3 ci: Update doxygen build flow to use modern pages deployment
This change adds the new permissions structure to the action definition,
and migrates away from the 3rd party action to an official action. This
was identified as a possible security vulnerability by CodeQL
2026-03-09 10:24:25 -07:00
nirenjan 7b7065f8f0 po: Update translation files to fix build 2026-03-09 00:47:29 -07:00
nirenjan 2fa9f52ddb build: Fix the GCC pragma to only apply for GCC > 13
The -Wanalyzer-fd-leak flag was introduced in GCC 13, so this pragma
fails to build on older GCC versions.
2026-03-09 00:26:06 -07:00
nirenjan a17312dcbc fix: Fix potential error scenarios
Configuring the build with CFLAGS="-O2 -g -fanalyzer", we ran into some
build errors, which we address in this commit.

First off, GCC identified a false positive file descriptor leak in
x52d_client.c, this instance is suppressed to avoid breaking the build.

There was a bug in x52d_clock.c, where if the original timezone could
not have a copy due to malloc failure, it would fail when resetting the
TZ environment. This is fixed by ensuring the copy is valid.

Finally, there was a potential NULL pointer dereference if the pinelog
module messes up the log levels, and the lmap_get_string method ends up
returning a NULL which was passed to the DATA macro. This is fixed by
checking for NULL and handling it in case of failure.
2026-03-09 00:13:19 -07:00
nirenjan 2be7792024 build: Fix libx52util SOLIB version
Because of the fix in 2378ba7dc4, the
library revision should have been updated.
2026-03-08 23:16:40 -07:00
nirenjan f51b777ca0 fix: Handle NULL pointer dereferencing in libx52
libx52_exit dereferences the device pointer to deinitialize libusb.
However, a user could pass NULL to this function, resulting in a null
pointer dereference.
2026-03-08 23:13:16 -07:00
nirenjan b3dff7182b fix: Handle possible double-free in pinelog
The pinelog_init function frees the module_level and module_name
pointers at the start of the function, but doesn't reset them back to
NULL. If a subsequent malloc fails, then it would attempt to free the
pointer again, resulting in a double-free situation.

However, this is only hit if the pinelog_init function is called more
than once. While this is not likely (given that I'm the only known user
of pinelog at this time), it's still good coding practice.
2026-03-08 23:08:05 -07:00
nirenjan 0356a2d610
Merge pull request #59 from nirenjan/dependabot/github_actions/actions/checkout-6
Bump actions/checkout from 4 to 6
2026-03-08 20:57:04 -07:00
dependabot[bot] c1e3c85738
Bump actions/checkout from 4 to 6
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-09 03:53:36 +00:00
nirenjan accd2a1f4e ci: Add dependabot to keep Github Actions up to date 2026-03-08 20:52:55 -07:00
nirenjan e8208e97cb
Merge pull request #58 from nirenjan/fix/update-codeql-action-version
build: Update CodeQL action to v4
2026-03-08 20:49:41 -07:00
nirenjan 421e2964b3 build: Update CodeQL action to v4
Signed-off-by: nirenjan <nirenjan@gmail.com>
2026-03-08 20:45:11 -07:00
nirenjan 2378ba7dc4 fix: Fix boundary check error in libx52util
Prior to this change, if the input string terminates exactly when `len`
characters have been output, the libx52util_convert_utf8_string function
returns an error of `-E2BIG`, even though the buffer is sufficiently
large. Because the output buffer is not expected to be NUL terminated,
this additional character can be safely placed in the output buffer
without overrun.

This change checks for a non-NUL character when the index matches or
exceeds the output buffer length, and only then will it return -E2BIG.
2026-03-08 20:30:03 -07:00
nirenjan 762a3468b2 fix: Handle negative index in libx52-string-test
The test case uses a negative value to force a test of the ID to string
functions in the abnormal case. However, this ends up with accessing the
expected array with a negative index. This is technically undefined
behavior, and may cause failures in some systems. This change ensures
that the negative values will be mapped directly to the unknown
string, without having to perform a negative index.
2026-03-08 20:25:29 -07:00
nirenjan ef4cbee127 fix: Handle malformed UTF-8 input in libx52util
The libx52util_convert_utf8_string function manually converts the UTF-8
string into the character map supported by the X52/X52Pro MFD. However,
there was a bug when handling malformed UTF-8 input. If the state
machine thinks it is at the start of a word and receives malformed UTF-8
input (between 0x80 and 0xC0), it will ignore the characters, but it
will not reset the entry to the map_root location, thereby causing
subsequent characters to be dropped.

This change ensures that the entry is reset to map_root[*input] after
skipping over an invalid UTF-8 sequence.
2026-03-08 20:25:29 -07:00
nirenjan c63b924705
doc: Add security policy and reporting guidelines 2026-03-06 15:29:31 -08:00
nirenjan 1b00bf4a69 build: Force build timestamp to be in UTC time
As part of improving the privacy around the software, even though time
zone is not considered PII, it's still coarse location data that we
don't need at all. By using UTC, we can eliminate even this last bit of
identifying information from the bug reports.
2026-03-06 13:56:08 -08:00
nirenjan a40546bda3 doc: Fix bullets in PRIVACY.md 2026-03-03 18:00:03 -08:00