[RFC] [Patch] Sony APM battery status fix

From: Dave Zarzycki (dave@thor.sbay.org)
Date: Mon Sep 04 2000 - 14:35:12 EST


The following change to the apm_get_power_status function makes my Sony
Vaio SR7K report sane battery life expectations. From surfing the web, I
believe this problem happens on other recent Sony laptops (outside of the
SR series). I'm thinking about making this fix run-time selectable via a
sysctl so that is can be pre-compiled-kernel friendly... Comments?

--- linux-old/arch/i386/kernel/apm.c Mon Sep 4 12:19:33 2000
+++ linux/arch/i386/kernel/apm.c Mon Sep 4 12:22:42 2000
@@ -673,7 +673,13 @@
                 return (eax >> 8) & 0xff;
         *status = ebx;
         *bat = ecx;
+#ifndef SONY_SR_SERIES
         *life = edx;
+#else
+ *life = (edx >> 8) | 0x8000;
+ if (edx & 1)
+ *life += 0xff;
+#endif
         return APM_SUCCESS;
 }
 

davez

-- 
Dave Zarzycki KF6ZSS
http://thor.sbay.org/~dave/
http://www.sbay.net/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Sep 07 2000 - 21:00:19 EST