libinput/tools
Peter Hutterer c8c1c07a2a tools: fix swapped fread arguments causing DMI modalias to always be "unknown"
fread(buf, sizeof(buf), 1, dmi) reads one block of 2048 bytes,
returning the number of complete blocks (0 or 1). Since DMI modalias
files are always shorter than 2048 bytes, fread returns 0 even when
data was successfully read into buf. The 'if (n > 0)' check then
always fails and the DMI string stays as "unknown".

Swap the size and nmemb arguments so fread returns the number of
bytes read instead.

Fixes: 0ecd08c134 ("tools: use __attribute__(cleanup)")

Co-Authored-by: Claude Code <noreply@anthropic.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1444>
2026-03-17 00:46:46 +00:00
..
libinput-analyze-buttons.man tools: add libinput analyze buttons for button state analysis 2024-06-18 07:43:02 +00:00
libinput-analyze-buttons.py tools: add libinput analyze buttons for button state analysis 2024-06-18 07:43:02 +00:00
libinput-analyze-per-slot-delta.man tools/per-slot-delta: optionally show the distance to the original point 2025-01-09 02:12:10 +00:00
libinput-analyze-per-slot-delta.py tools: per-slot-delta initialize the pressure thresholds to zero 2025-06-24 02:57:31 +00:00
libinput-analyze-recording.man tools: add a tool to print a libinput recording as a table 2021-02-23 13:46:00 +10:00
libinput-analyze-recording.py pre-commit: bump to latest ruff-format 2025-07-09 00:13:00 +00:00
libinput-analyze-touch-down-state.man tools: add a tool to analyze the finger count from a recording 2021-01-29 08:06:53 +10:00
libinput-analyze-touch-down-state.py tools: add a tool to analyze the finger count from a recording 2021-01-29 08:06:53 +10:00
libinput-analyze.c Run clang-format over the code 2025-07-01 16:42:44 +10:00
libinput-analyze.man tools: add libinput analyze buttons for button state analysis 2024-06-18 07:43:02 +00:00
libinput-debug-events.c Add a public plugin system to libinput 2025-08-01 15:38:39 +10:00
libinput-debug-events.man tools: add --compress-motion-events to the man page and zsh completion 2026-03-11 14:22:40 +10:00
libinput-debug-gui.c Add a public plugin system to libinput 2025-08-01 15:38:39 +10:00
libinput-debug-gui.man tablet: add API for relative dials 2024-02-20 02:49:05 +00:00
libinput-debug-tablet-pad.c Add a public plugin system to libinput 2025-08-01 15:38:39 +10:00
libinput-debug-tablet-pad.man tools: add a debug-tablet-pad tool 2025-07-28 23:40:33 +00:00
libinput-debug-tablet.c Add libinput_tablet_tool_get_name() for the tool's specific name 2026-01-14 16:44:01 +10:00
libinput-debug-tablet.man tools: add a tablet debugging tool 2019-11-19 09:56:14 +10:00
libinput-list-devices.c Add a public plugin system to libinput 2025-08-01 15:38:39 +10:00
libinput-list-devices.man tools/list-devices: reword the man page a bit 2025-02-17 07:59:05 +00:00
libinput-list-kernel-devices.man tools: add a --hid toggle to libinput-list-kernel-devices 2022-12-08 10:08:44 +10:00
libinput-list-kernel-devices.py tools: add a --hid toggle to libinput-list-kernel-devices 2022-12-08 10:08:44 +10:00
libinput-measure-fuzz.man touchpad: add a tool to measure the touchpad fuzz 2018-05-15 13:51:33 +10:00
libinput-measure-fuzz.py Use python black for all pyhon file formatting 2021-01-28 21:02:45 +00:00
libinput-measure-touch-size.man tools: touch-size: update to use the device quirks 2018-06-21 11:48:41 +10:00
libinput-measure-touch-size.py tools: only warn once about our lack of support for multiple fingers 2024-12-18 08:49:34 +00:00
libinput-measure-touchpad-pressure.man Fix links to point to the current doc pages 2025-05-16 05:45:51 +00:00
libinput-measure-touchpad-pressure.py tools: make the touchpad-pressure thresholds interactive 2026-01-09 02:21:13 +00:00
libinput-measure-touchpad-size.man Remove trailing whitespaces in the tree 2022-11-25 10:08:20 +10:00
libinput-measure-touchpad-size.py Use python black for all pyhon file formatting 2021-01-28 21:02:45 +00:00
libinput-measure-touchpad-tap.man treewide: fix typos 2020-12-16 22:08:23 +01:00
libinput-measure-touchpad-tap.py pre-commit: bump to latest ruff-format 2025-07-09 00:13:00 +00:00
libinput-measure.c Run clang-format over the code 2025-07-01 16:42:44 +10:00
libinput-measure.man tools: add a measure touchpad-size tool 2020-03-30 15:14:45 +10:00
libinput-quirks.c Run clang-format over the code 2025-07-01 16:42:44 +10:00
libinput-quirks.man tools: rename list-quirks to the more generic "quirks list" 2018-07-03 15:16:59 +10:00
libinput-record-verify-yaml.py pre-commit: drop black, use ruff-format instead 2024-10-29 13:48:31 +10:00
libinput-record.c tools: fix swapped fread arguments causing DMI modalias to always be "unknown" 2026-03-17 00:46:46 +00:00
libinput-record.man tools/record: add support for hidraw recording 2021-05-05 03:59:34 +00:00
libinput-replay.man tools: add --replay-after and --once to libinput replay 2023-02-06 18:02:58 +00:00
libinput-replay.py tools/replay: rmdir, not unlink for directories 2025-10-20 02:01:23 +00:00
libinput-test.c meson.build: change from config.set10() and #if to config.set() and #ifdef 2025-07-28 12:04:09 +10:00
libinput-test.man tools: fix the man page for the libinput-test command 2026-01-05 01:53:41 +00:00
libinput-tool.c meson.build: change from config.set10() and #if to config.set() and #ifdef 2025-07-28 12:04:09 +10:00
libinput.man man: hide debug-gui from the libinput.man page if disabled 2023-06-09 13:00:08 +10:00
make-ptraccel-graphs.sh tools: make-ptraccel-graphs: drop an unnecessary outfile 2018-07-11 16:04:59 +10:00
ptraccel-debug.c Use a newtype usec_t for timestamps for better type-safety 2025-12-12 04:15:15 +00:00
razer-quirks-lister.py tools: add a tool to update our Razer quirks for internal keyboards 2023-04-11 14:48:41 +10:00
shared.c tools: fix swapped strstartswith arguments in find_device() 2026-03-17 00:46:45 +00:00
shared.h Add a public plugin system to libinput 2025-08-01 15:38:39 +10:00
test_tool_option_parsing.py meson.build: explicitly convert a boolean to string 2026-03-13 12:15:21 +10:00