Module Name:    src
Committed By:   martin
Date:           Wed Aug  3 15:44:24 UTC 2022

Modified Files:
        src/sys/dev/acpi [netbsd-9]: thinkpad_acpi.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1490):

        sys/dev/acpi/thinkpad_acpi.c: revision 1.48

With the recent change of the EC address space handler, we no longer get
an ACPI_INTEGER in host byte order but a byte sized buffer with little
endian data.

Extract only the low 8 bits from buffer to get the fan speed again.


To generate a diff of this commit:
cvs rdiff -u -r1.46.24.1 -r1.46.24.2 src/sys/dev/acpi/thinkpad_acpi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/thinkpad_acpi.c
diff -u src/sys/dev/acpi/thinkpad_acpi.c:1.46.24.1 src/sys/dev/acpi/thinkpad_acpi.c:1.46.24.2
--- src/sys/dev/acpi/thinkpad_acpi.c:1.46.24.1	Fri Jan 31 11:17:32 2020
+++ src/sys/dev/acpi/thinkpad_acpi.c	Wed Aug  3 15:44:24 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: thinkpad_acpi.c,v 1.46.24.1 2020/01/31 11:17:32 martin Exp $ */
+/* $NetBSD: thinkpad_acpi.c,v 1.46.24.2 2022/08/03 15:44:24 martin Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcne...@invisible.ca>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.46.24.1 2020/01/31 11:17:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.46.24.2 2022/08/03 15:44:24 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -702,6 +702,13 @@ thinkpad_fan_refresh(struct sysmon_envsy
 		edata->state = ENVSYS_SINVALID;
 		return;
 	}
+
+	/*
+	 * Extract the low bytes from buffers
+	 */
+	lo = ((uint8_t *)&lo)[0];
+	hi = ((uint8_t *)&hi)[0];
+
 	rpm = ((((int)hi) << 8) | ((int)lo));
 	if (rpm < 0) {
 		edata->state = ENVSYS_SINVALID;

Reply via email to