Fix PWM values scaling #1
28
pwm-fix-bad-scaling-due-to-use-of-integer-type.patch
Normal file
28
pwm-fix-bad-scaling-due-to-use-of-integer-type.patch
Normal file
@@ -0,0 +1,28 @@
|
||||
From: xaizek <xaizek@posteo.net>
|
||||
Date: Sat, 7 Jun 2025 13:33:11 +0300
|
||||
Subject: pwm: fix bad scaling due to use of integer type
|
||||
References: boo#1255928
|
||||
Patch-mainline: No, pending PR https://github.com/hramrach/lm-sensors/pull/12
|
||||
|
||||
This fixes commit c1a1f4ff206c0e6959c3e4d6b19ba27963076d5e ("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.
|
||||
---
|
||||
lib/sysfs.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/sysfs.c b/lib/sysfs.c
|
||||
index 39644f114..6e93b95cc 100644
|
||||
--- a/lib/sysfs.c
|
||||
+++ b/lib/sysfs.c
|
||||
@@ -139,7 +139,7 @@ static int sysfs_foreach_busdev(const char *bus_type,
|
||||
const char *sensors_sysfs_mount = "/sys";
|
||||
|
||||
static
|
||||
-int get_type_scaling(sensors_subfeature_type type)
|
||||
+double get_type_scaling(sensors_subfeature_type type)
|
||||
{
|
||||
/* Multipliers for second class subfeatures
|
||||
that need their own multiplier */
|
||||
@@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 7 17:33:42 UTC 2026 - Jean Delvare <jdelvare@suse.com>
|
||||
|
||||
- Add pwm-fix-bad-scaling-due-to-use-of-integer-type.patch which
|
||||
fixes PWM values being scaled to 0-128% instead of 0-100%
|
||||
(boo#1255928).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Oct 2 12:52:41 UTC 2025 - Andreas Schwab <schwab@suse.de>
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ Patch1: lm_sensors-3.1.1-build.patch
|
||||
Patch2: lm_sensors-3.0.0-sensord-separate.patch
|
||||
Patch3: lm_sensors-3.0.0-sysconfig_metadata.patch
|
||||
Patch4: lm_sensors-3.0.3-hint-at-kernel-extra-package.patch
|
||||
Patch5: pwm-fix-bad-scaling-due-to-use-of-integer-type.patch
|
||||
Patch8: lm_sensors-3.5.0-libsensors-fix-soname.patch
|
||||
BuildRequires: bison
|
||||
BuildRequires: flex
|
||||
|
||||
Reference in New Issue
Block a user