Commit Graph
5467 Commits
Author SHA1 Message Date
Michael Lettrich 01359701a2 [FIX] ISA sysfs address parsing allow dashes
The ISA sensor chip address is obtained by parsing the hwmon
 `/sysfs` device path. The regular expression extracting the
device address will fail if the device name contains dashes and
sets the address to 0. If  multiple instances of the same
board are plugged into the same system, cards can no longer be
distinguished, because their addresses will be set to 0 incorrectly.

This fix changes the address-parsing regular expression to recognize
device names with dashes.
2026-04-21 13:34:11 +02:00
graysky 68bda21952 Fix iconv linking detection for glibc-based builds
The current iconv detection checks if libiconv.so exists via ldconfig,
but fails on glibc systems where iconv is built into libc and doesn't
require separate linking. This causes build failures:

  ld: cannot find -liconv: No such file or directory

Replace the ldconfig check with a compile test that actually verifies
if iconv functions are available without additional libraries. This
correctly detects glibc's built-in iconv while still linking -liconv
on musl/uclibc systems that need it.

Fixes build on glibc-based systems including OpenWrt glibc targets.
2026-04-21 13:32:57 +02:00
xaizek 62a9553191 pwm: fix bad scaling due to use of integer type
This fixes commit c1a1f4ff20 ("pwm: Move
scaling factor from sensors prog to library") which didn't account for
return type of `get_type_scaling()` being `int` rather than `double` or
`float`, so the scaling was done by a factor of 2 instead of 2.55, thus
making the result off by quite a lot.

ms: adjust test
2026-04-21 13:24:21 +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
Aurelien Jarno c2df8a4183 fancontrol: Add --check option to only check configuration syntax
References: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=582979
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
Micah Gersten 71fb47f1b5 sensors-detect: Recognize 2 digit kernel version
References: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=630508
2024-02-17 12:06:28 +01:00
Aurelien Jarno b7b10c0065 sensors-detect: Recognize more chips
References: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=588355

ADT7466 -> lm85
SCH5524-NS -> none
2024-02-17 12:06:28 +01:00
Aurelien Jarno 0be39ad911 sensors-conf-convert: Convert voltage formulas correctly
References: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=456774
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 V3-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
Johannes Segitz f9ccac7d71 harden_sensord.service 2023-12-26 13:51:51 +01:00