Module Name:    src
Committed By:   mlelstv
Date:           Sun May 17 11:32:51 UTC 2020

Modified Files:
        src/sys/dev/acpi: thinkpad_acpi.c

Log Message:
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.47 -r1.48 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.47 src/sys/dev/acpi/thinkpad_acpi.c:1.48
--- src/sys/dev/acpi/thinkpad_acpi.c:1.47	Mon Aug  5 10:09:35 2019
+++ src/sys/dev/acpi/thinkpad_acpi.c	Sun May 17 11:32:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: thinkpad_acpi.c,v 1.47 2019/08/05 10:09:35 msaitoh Exp $ */
+/* $NetBSD: thinkpad_acpi.c,v 1.48 2020/05/17 11:32:51 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <[email protected]>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.47 2019/08/05 10:09:35 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.48 2020/05/17 11:32:51 mlelstv 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