From 2d2a163728283108eb78c11d7b02bf5c54d88ea4 Mon Sep 17 00:00:00 2001 From: lance colton Date: Mon, 23 May 2011 17:04:49 -0600 Subject: [PATCH] fixes for power kernel 47 breaking temperature and voltage readings --- debian/changelog | 18 ++++++++++++++---- src/linux.c | 16 +++++++++------- src/text_object.c | 2 +- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/debian/changelog b/debian/changelog index bf1c4df..c93f0b5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,19 @@ -conky (1.9.6-1) unstable; urgency=low +conky (1.9.7-1) unstable; urgency=low * New maemo release: - - i'm too lazy to fill this in for now - - did i mention lazy? - + whatever + - fixes for power kernel v47 + + temperature and voltage are reported differently by this kernel and needed to be adjusted + + temperature is now reported to the tenth of the degree and your conf file may need to be adjusted to account for this additional digit + + -- Lance Colton Mon, 23 May 2011 16:00:00 -0700 + +conky (1.9.6-2) unstable; urgency=low + + * New maemo release: + - too many changes to list + - equivalent to 1.8.2 on master conky branch with lots of n900 fixes + + see http://talk.maemo.org/showthread.php?t=64434 + + the deb posted there is actually better as it supports lua, autobuilder can't work with that -- Lance Colton Thu, 21 Oct 2010 12:00:00 -0700 diff --git a/src/linux.c b/src/linux.c index c2755c7..e394879 100644 --- a/src/linux.c +++ b/src/linux.c @@ -1592,8 +1592,8 @@ static unsigned char last_cell_radio_percent; //eg 'full' 'on' 'off' static char last_batt_charge_status[16]; -//eg 35 -static int last_battery_temp[MAX_BATTERY_COUNT]; +//eg 35.5 +static float last_battery_temp[MAX_BATTERY_COUNT]; /* e.g. "charging 75%" */ static char last_battery_str[MAX_BATTERY_COUNT][64]; @@ -1927,10 +1927,12 @@ void get_battery_stuff(char *buffer, unsigned int n, const char *bat, int item) } fclose(sysfs_bat_fp[idx]); sysfs_bat_fp[idx] = NULL; - - last_battery_volts[idx] = voltage; - last_battery_temp[idx] = temp; - + if (voltage > 10000) voltage = voltage / 1000; //fix for n900 power kernel 47 + last_battery_volts[idx] = voltage; + if (temp < 100) + last_battery_temp[idx] = temp; + else //fix for n900 power kernel 47 + last_battery_temp[idx] = (float) temp / 10; /* charging */ if (present_rate <= 0) { /* e.g. charging 75% */ @@ -1980,7 +1982,7 @@ void set_return_value(char *buffer, unsigned int n, int item, int idx) snprintf(buffer, n, "%i", last_battery_volts[idx]); // voltage break; case BATTERY_TEMP: - snprintf(buffer, n, "%i", last_battery_temp[idx]); // temperature + snprintf(buffer, n, "%3.1f", last_battery_temp[idx]); // temperature break; default: fprintf (stderr, "invalid item type in set_return_value"); diff --git a/src/text_object.c b/src/text_object.c index 7bc625b..a34f74a 100644 --- a/src/text_object.c +++ b/src/text_object.c @@ -55,7 +55,7 @@ int append_object(struct text_object *root, struct text_object *obj) if (end) { if (end->next) - CRIT_ERR(NULL, NULL, "huston, we have a lift-off"); + CRIT_ERR(NULL, NULL, "houston, we have a lift-off"); end->next = obj; } else { root->next = obj; -- 1.7.9.5