Commit Graph
51 Commits
Author SHA1 Message Date
Michal Suchanek 639e040445 sysfs: Allow file symlinks
To test behavior on read error the test file can be linked to something
like /proc/self/mem that does not support read() but currently all
symlinks are skipped. Use fstatat instead of the directory entry type to
determine file type.
2026-05-06 14:19:44 +00:00
Michal Suchanek 66c2951a47 README: Add information on saving sensor data 2026-05-06 14:19:44 +00:00
Michal Suchanek 9ba090310a GitHub tests: Remove debug print 2026-05-06 14:19:44 +00:00
Michal Suchanek 2b8073674e GitHub tests: Add coverage report 2026-04-23 10:54:00 +02:00
Michal Suchanek c297368a0e tests: Do not use config file in json test
Pass -c /dev/null when running tests

Fixes: e06d99df ("tests: Add trivial json formatting test")
2024-02-17 12:50:05 +01:00
Michal Suchanek 2d18c0952a fancontrol: Uplift the --check option
- do not duplicate the load code
 - add description to man page
2024-02-17 12:41:20 +01:00
Michal Suchanek 5f35944bc4 sensors-detect: Try more locations of udevadm
References: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=852558
2024-02-17 12:06:28 +01:00
Michal Suchanek 9e5156cb67 check: Check perl program syntax 2024-02-17 12:06:28 +01:00
Michal Suchanek 1c757b34a7 Fix build with extra libraries
Fixes: c829b4c7 ("Add LDFLAGS handling similar to CFLAGS")
2024-01-27 14:39:51 +01:00
Michal Suchanek 51f74751ae Add more junk files to .gitignore 2024-01-27 14:39:51 +01:00
Michal Suchanek c0c82d0bca Run test as GitHub Action 2024-01-17 22:00:49 +01:00
Michal Suchanek e06d99df7c tests: Add trivial json formatting test 2024-01-17 19:43:50 +01:00
Michal Suchanek 989f387a9a tests: shellcheck the debug progs 2024-01-17 19:41:20 +01:00
Michal Suchanek 06bd510ef7 Install troubleshooting tools 2024-01-17 19:39:46 +01:00
Michal Suchanek 9aa83ee190 sensors-save: New debug tool for saving sensor data from sysfs 2024-01-17 19:39:46 +01:00
Michal Suchanek 905634f182 sensors-find-driver: Convert README to man page 2024-01-17 19:39:46 +01:00
Michal Suchanek 3a5737fe7b Rename find-driver -> sensors-find-driver 2024-01-17 19:39:46 +01:00
Michal Suchanek 0b771017be Append the "+git" post-release marker to LM_VERSION 2024-01-13 17:05:48 +01:00
Michal Suchanek 5c3ba50f80 Release version 3.6.2 2024-01-13 17:03:31 +01:00
Michal Suchanek 4bf8e37e0f Update API description
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2024-01-08 22:21:05 +01:00
Michal Suchanek 89548dab2a Add SENSORS_SYSFS_ROOT environment support
With this the hardcoded /sys location for reading sensor data can be
changed. In particular it makes it possible to tar up the /sys directory
when a problem is encountered, and then reproduce it on another system.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2024-01-07 21:20:39 +01:00
Michal Suchanek 25108fe4a4 More robust reading of labels
When the sysfs file is copied to a plain file it may contain trailing
zeroes which is not handled well by the label reading code.
2024-01-07 21:20:39 +01:00
Michal Suchanek 3bbd975860 quantity: Add enumeration type
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2024-01-06 23:05:07 +01:00
Michal Suchanek 502ce051fe sensors_temperature_type_name: New library function
Decode temperature sensor type to a string.

Add enum for temperature types.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2024-01-06 23:04:46 +01:00
Michal Suchanek 0c097bfca4 parser: Strip trailing whitespace 2024-01-06 20:26:05 +01:00
Michal Suchanek 6b5a19b708 rrd: drop useless cast
Cast of (const char **) to (char **) avoids one warning to introduce
another. Drop it. rrd upstream should not need the cast anymore.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2024-01-06 20:25:40 +01:00
Michal Suchanek 10c6068b3e sensors_parse_chip_name: Initialize path
sensors_parse_chip_name claims to overwrite all of result but path is
not set. This is generally not a problem when using statically allocated
data that is pre-zeroed but the parser uses dynamic allocation and the
chip name may contain garbage depending on the specific code flow
resulting from compiling the parser.
Setting the path was dropped when it was renamed from busname.

Fixes: 8896ba3b ("Rename sensors_chip_name.busname to path, as this is
		  what we are using it for by now.")
2023-12-30 19:05:13 +01:00
Michal Suchanek e0efe7dc76 Use output filename in flex invocation
With stdout output file name in debuginfo is specified as <stdout>.
2023-12-30 18:58:32 +01:00
Michal Suchanek 39d3145da9 test: Generate dependency files 2023-12-30 18:58:32 +01:00
Michal Suchanek 7a4b9b98c0 Correct dependencies for generated parser
The parser needs to be regenerated when makefile changes
2023-12-30 18:58:32 +01:00
Michal Suchanek c829b4c7fb Add LDFLAGS handling similar to CFLAGS 2023-12-29 15:37:00 +01:00
Michal Suchanek d60d6beebf Correct parser file dependencies
The dependencies for the parser files are not correct.

There is baroque irule adding header prerequisites to the parser but the
parser may still fail to build.

The real dependency is on conf-parse.h

There is no way to tell make that a rule produces two targets, such as
parse.c and parse.h. However, the dependency files are generated by a
separate rule, and not as a byproduct of building the source so they can
themselves have dependencies.

And dependencies they do have: when the header is generated it's in lib
but when the header is missing while generating dependency file it's
searched in top directory, and then the file that depends on it cannot
be built because the header neveer appears there.

When the generated .c file is addded as prerequisite to the dependency
file that should reference the header generated together with the .c
file the dependency file is generated correctly with the header present.

This is not easily reproducible with the current source but adding
conf-lex.h generated with conf-lex.c and including it in conf-parse.c
now makes both conf-lex.ad depend on conf-parse.h and conf-lex.ad on
conf-lex.h making the build 100% fail.
2023-12-29 15:11:49 +01:00
Michal Suchanek 9c66c7b59e Remove special build rules for parser
The parser can be generated warning-free, no need to suppress warnings.
2023-12-29 15:11:49 +01:00
Michal Suchanek f1af9ceae2 Add test makefile target 2023-12-28 20:58:39 +01:00
Michal Suchanek c6c5dfcffd sensors: New json format option
Using -J rather than -j gives JSON with new, hopefully more usable
structure.
2023-12-28 13:04:22 +01:00
Michal Suchanek 3764b44396 json: Drop whitespace
The json can be reformatted with jq or similar tool into desired layout.
2023-12-28 13:04:10 +01:00
Michal Suchanek 0d9ea7f031 Move temperature sensor type translation to library 2023-12-28 13:03:50 +01:00
Michal Suchanek fcf478016d sensors: Use quantity unit to determine when to translate to fahrenheit 2023-12-28 13:02:52 +01:00
Michal Suchanek 297b050d3d sysfs: Add function for determining feature quantity 2023-12-28 13:02:33 +01:00
Michal Suchanek b4ab3652af sensors: json: Fix print of sensors without values
When the sensor does not provide a value something bogus is printed,
print a NaN instead.

Also update the output counting to also print a comman for NaNs.
2023-12-28 13:00:49 +01:00
Michal Suchanek 6fa5cba2e3 sysfs: Do not prescale frequency to MHz
Add autoscaling in the output instead.

Fixes: 54363271 ("libsensors + sensors: Add freq_input support")
2023-12-27 14:57:05 +01:00
Michal Suchanek fceeee0543 sysfs: Multiplier 1 is the default, no need to list it.
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2023-12-27 13:40:53 +01:00
Michal Suchanek c1a1f4ff20 pwm: Move scaling factor from sensors prog to library
Fixes: a6ec549e ("sensors: Add support for pwm sensors")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2023-12-27 13:17:28 +01:00
Michal Suchanek b76cd8a5f6 sysfs: Specific match has to go before generic match
This is not really a problem when the specific scaling factors happen to
be for factors not matched by a generic match but this may not hold in
general over time.

Fixes: 1bd92120 ("Fill the magnitude field of dynamically generated device entries.")
2023-12-27 13:17:16 +01:00
Michal Suchanek aa87b54d43 sensors: Also avoid conversion from double to float for Fahrenheit
Fixes: 868fd8d0 ("Avoid the conversions from double to float.")
2023-12-26 20:56:36 +01:00
Michal Suchanek 43b6101bb0 sysfs: Expand filename buffer to quiet warning
The GCC heurisitc says that the buffer can overflow by 2 bytes, expand
it.
2023-12-26 16:35:46 +01:00
Michal Suchanek 79d7803c41 Append the "+git" post-release marker to LM_VERSION 2023-12-26 13:45:29 +01:00
Michal Suchanek 82ca61b38a sysfs: remove unused variable
Fixes: e5e053bb ("libsensors: Avoid non-symlink sysfs device entries")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2023-12-25 19:34:29 +01:00
Michal Suchanek 54efada033 Release version 3.6.1
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2023-12-24 23:38:23 +01:00
Michal Suchanek dbe3686933 Zotac IONITX-U: add conf extension. 2023-12-24 14:23:22 +01:00
Michal Suchanek c91425c121 Merge branch 'thomab/freq' of ~/gitea/data/gitea-repositories/hramrach/lm-sensors 2023-12-24 12:28:52 +01:00