N900 Software BME
This page is to bring together efforts and links for those working on understanding BME - the battery managment entity.
This is required to implement user friendly Host Mode
BME is divided into three parts.
- Kernel driver that handles all of the low-level interaction with the hardware.
- hald-addon-bme - an add-on process for HAL that reports status.
- bme_RX-51 - Process started early in boot, with watchdogs to reboot the device if it malfunctions.
The kernel driver is split over several files.
http://mxr.maemo.org/fremantle/source/kernel/include/linux/i2c/twl4030-madc.h This handles reading various ADCs to readout voltages and currents.
Unsorted adds:
Then there's also /usr/lib/hal/hald-addon-bme, which seems not to be completely out of order (according to lshal) even when bme_RX-51 is stopped.
Mer 'replacement hald-addon-bme': http://gitorious.org/mer-toggles/hald-addon-bme/blobs/master/hald-addon-bme.c http://wiki.maemo.org/Mer/Documentation/BME_Protocol (N810!)
lsof -p `pidof bme_RX-51` gives an idea about what BME is actually interfering/interfacing with, and a strace will show it talks to dsme_lib probably to implement the watchdog timers.
BME process/file is called /usr/sbin/bme_RX-51 killing or sigstop'ing it will cause immediate or delayed reboot it's easily suspended though thru upstart process management by
- ~>stop bme
and resumed any time by
- ~>start bme
A nice little experiment to investigate the bq24150 USB Battery Charger chip's abilities is to
- plug in Nokia wallwart charger
- ->stop bme
- wait max 32s until bq24150 internal watchdog timer expires (due to bme not resetting it), which will cause bq24150 to reset to defaults, which are a mostly sane, safe charging without any software support. You can tell this by bq24150 firing up the hardwired steady yellow indicator LED
I'm about to write a first draft little script to somewhat replace bme's basic functions, eventually turning this into a real project Just-Replaces-BME aka jrbme (some say it's "JRBME replaces BME", according to an age old tradition of linux self referencing ETLA [like GNU=="GNU Not Unix", KDE=="KDE Desktop Environment"])