[maemo-developers] Information on the interface to hald-addon-bme (so it can be replaced with something that bypasses BME and talks to the kernel directly)
From: Jonathan Wilson jfwfreo at tpgi.com.auDate: Tue Jun 28 20:16:32 EEST 2011
- Previous message: maemo.org Extras Bug Jar 2011.26
- Next message: [CSSU] Replacements for closed-source apps in the CSSU, what are the targets?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
The following items are exposed by hald-addon-bme: HAL items exposed under /org/freedesktop/Hal/devices/bme maemo.charger.type (data type is string), valid values are wall charger host 500 mA host 100 mA none unknown error initial value is none maemo.charger.connection_status (data type is string), valid values are connected error disconnected unknown initial value is disconnected maemo.rechargeable.charging_status (data type is string), valid values are error unknown on continue off full initial value is off maemo.rechargeable.positive_rate (data type is bool). Set when the flow into the battery is positive as far as I can tell. initial is false battery.present (data type is bool) Always set to true battery.type (data type is string) Always set to pda battery.is_rechargeable (data type is bool) Always set to true battery.remaining_time (data type is int) set to the remaining battery use time battery.charge_level.capacity_state (data type is string), valid values are low ok full empty unknown initial value is ok battery.charge_level.unit (data type is string) Always set to bars battery.charge_level.design (data type is int) Set to the design charge level, initial value is 0 battery.charge_level.current (data type is int) Set to the current charge level, initial value is 0 battery.charge_level.percentage (data type is int) set to capacity / nominal capacity, initial value is 0 battery.charge_level.last_full (data type is int) set to last full charge level, initial value is 0 battery.rechargeable.is_charging (data type is bool) set when charging, initial value is false battery.rechargeable.is_discharging (data type is bool) set when discharging, initial value is false battery.reporting.unit (data type is string) Always set to mAh battery.reporting.design (data type is int) set to nominal capacity, initial value is 0 battery.reporting.last_full (data type is int) set to last full capacity, initial value is 0 battery.reporting.current (data type is int) set to current capacity, initial value is 0 battery.voltage.unit (data type is string) Always set to mv battery.voltage.design (data type is int) initial value is 0, it will then be set to one of 4100 4200 9999 battery.voltage.current (data type is int) set to current voltage, initial value is 0 battery.remaining_time.calculate_per_time (data type is bool) Always set to false Also, hald-addon-bme exposes the following signals under com.nokia.bme.signal /com/nokia/bme/signal (unless otherwise specified, these signals have no arguments) charger_connected charger_disconnected charger_charging_failed charger_charging_off charger_charging_on battery_full battery_empty battery_low battery_state_changed (arguments for this are 2 uints, dbus type 'u', unknown exactly what they are for) battery_timeleft (arguments for this are 2 uints, dbus type 'u', first one is for idle time, second is for active time) The purpose of these signals should be self-explanatory for the most part. Plus it exposes 2 dbus methods on com.nokia.bme.request. Both take no parameters. The status_info_req method causes a method to be run that will send the appropriate signals from the list above. The timeleft_info_req method also causes the signals to be sent but it also sends a message to BME to retrieve the relavent data for the timeout fields. Also it should be possible to create a dummy libbmeipc that supports the bits needed by dsme-thermalobject-surface and modules-nokia-voice.so (the 2 users of libbmeipc we need to care about), thus allowing a complete replacement of BME without loosing the functioning of the nokia pulseaudio bits. Information that is relavent for said libbmeipc replacement: (all taken from various revisions of the LGPL MeeGo n900_libbme sources and all verified against the N900 Fremantle BME to ensure they match) typedef __uint16_t uint16; typedef __uint32_t uint32; struct emsg_battery_info_req { uint16 type, subtype; uint32 flags; }; struct emsg_battery_info_reply { uint32 zero; uint32 flags; uint16 bat_type; uint16 nominal_capa; uint16 temp; uint16 voltage; uint16 voltage_tx_on; uint16 voltage_tx_off; uint16 voltage_pwm_on; uint16 voltage_pwm_off; uint16 generation; uint16 voltage_sh_chk; }; union emsg_battery_info { struct emsg_battery_info_req request; struct emsg_battery_info_reply reply; }; #define EM_BATTERY_INFO_REQ 0x06 #define EM_BATTERY_TEMP 0x0004 int bme_connect(void); void bme_disconnect(void); int bme_write(const void *msg, int bytes); int bme_read(void *msg, int bytes); Study the source code of dsme-thermalobject-surface to see how it is calling libbmeipc and what its sending to (and receiving from) BME. I can confirm from my analysis that module-nokia-voice is making the exact same libbmeipc calls (and, like dsme-thermalobject-surface, only cares about the temprature) I hope this information is enough to allow someone to replace bme, libbmeipc and hald-addon-bme with new software that talks directly to the hardware whilst still keeping all of the nokia closed source components functioning 100% (and any 3rd party components that talk to hald-addon-bme) Please let me know if you need any more information on this stuff or have any questions, I want to do whatever I can in terms of analysis to enable improvements to battery and power management on the N900.
- Previous message: maemo.org Extras Bug Jar 2011.26
- Next message: [CSSU] Replacements for closed-source apps in the CSSU, what are the targets?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]