Jump to content


Photo

New battery kernel module


  • Please log in to reply
No replies to this topic

#1 ffxx68

ffxx68

    Advanced Member

  • Jr. Member
  • PipPipPip
  • 353 posts

Posted 10 October 2011 - 03:35 AM

Just is case someone didn't see the main post (very likely, as it's in an Italian community forum).

I'm using since a while now (along with a few other guys) a modifed version of the battery kernel module, which makes use of an A/D conversion in software to make the voltage readings. This applies to some of those netbooks and tablets missing a dedicated A/D hardware, like mine... I'm on PADMAN's "UnGoogle" Android 1.6.

My wmt-battery.ko is attached where I first posted it, in my message on 20/04/2011 13:57 here:

gyplace.altervista.org/viewtopic.php?f=22&t=184&start=10

(I can't attach zip files here).

It includes source code, so if you need to debug it you can compare kernel messages with the code.

Sorry if it's Italian there. I'm providing below the procedure about how to use it. This is made for real beginners, to enlarge the audience of course, but to avoid misunderstandings with experts too.

Copy onto an SD card (FAT32 formatted) my wmt-battery.ko. Then with the charger plugged in, insert the SD card, reboot your netbook and follow the steps below.

Commands are given in a terminal emulator (e.g. "Better Terminal Emulator Magic" , which is found by default in the UnGoogle mod).

Also note I wasn't able to make the module realize whether the charger is plugged in or not. For this, the charging red light makes the job...

1) Replace the battery module on the netbook with mine, which you previously put on the SD card:

su
busybox cp /init.rc /init.rc.orig
busybox cp /init.rc /sdcard/init.rc
busybox cp /.driver/wmt_battery.ko /.driver/wmt_battery.ko.orig
busybox cp /sdcard/wmt_battery.ko /.driver/wmt_battery.ko
exit
exit


2) Extract the SD card and edit on your PC the init.rc now found on it, to enable the battery module

Look for "wm9715-api" in the file and remove the comment sign '#' (if present):

...
# insmod /.driver/wm9715-api.ko
# insmod /.driver/wmt_battery.ko
...


will be changed to:

...
insmod /.driver/wm9715-api.ko
insmod /.driver/wmt_battery.ko
...


NOTE - This step is critical. If you corrupt the init.rc you may be forced to reinstall the firmware from scratch!

5) Insert the SD card again in the netbook and reboot it (keep it plugged to the charger)

Set some environment variablesa and replace the init.rc:

su
busybox cp /sdcard/init.rc /init.rc
setenv audioic vt1613
setenv battgpio 4
setenv chargetest true
setenv gpiostate 1
setenv battmax 300
setenv battmin 200
reboot


NOTE - battmax and battmin are just guesses. They work well with mine, but I know of other that needed to set them to 300/500. Possibly different batteries, or circuitry. A calibration is required then. See below.

6) Calibrate battmin and battmax

su
cat /proc/kmsg | busybox grep "wmt-battery"


Keep looking for the value X given in the message "wmt-battery - bat cnt test value : X"

I suggest to average among a few of them. The average would be our battmin. An estimate for battmax would be battmin*2. Set them with:

setenv battmin < measured battmin >
setenv battmax < estimated battmax >


Now unplug the charger, and leave the device discharge for a while. Check new values of X every other 10 minutes. X should increse in time.
In case the message box "Charge < 15%" appears, just press OK and keep on taking note of these values. The very last values before the device actually shuts down would be "battmax".
Reboot with the charged and then set battmax:

setenv battmax < measured battmax >

7) Final reboot to take this latest value set
ffxx68
----
Renesas Dual-A9 w/3G Android 2.3 *20111220 build*
WM8505 netbook Android 1.6 *UnGoogle*
----
I'm now using Wuala storage - if you join we both get extra space !
http://www.wuala.com...7C6MMMHGNMPGP7K