Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:joshkress:PackageKit
hal
hal-fix-util_compute_time_remaining_warning_hig...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File hal-fix-util_compute_time_remaining_warning_highTime.diff of Package hal
--- hal-0.5.8_git20060822/hald/util_pm.c +++ hal-0.5.8_git20060822/hald/util_pm.c @@ -39,6 +39,7 @@ typedef struct { int last_level; int last_chargeRate; + int high_time_warn_count; time_t last_time; } batteryInfo; @@ -157,7 +158,8 @@ battery_info->last_level = chargeLevel; battery_info->last_time = cur_time; battery_info->last_chargeRate = 0; - return -1; + battery_info->high_time_warn_count = 0; + return -1; } } @@ -180,12 +182,28 @@ /* This shouldn't happen, but check for completeness */ if (remaining_time < 0) { - HAL_WARNING (("remaining_time %i, returning -1", remaining_time)); + HAL_WARNING (("remaining_time %i, returning -1dd", remaining_time)); remaining_time = -1; } /* Battery life cannot be above 60 hours */ else if (remaining_time > 60*60*60) { - HAL_WARNING (("remaining_time *very* high, returning -1")); + batteryInfo *battery_info; + + if (!(battery_info = g_hash_table_lookup(saved_battery_info, id))) { + battery_info = g_new0(batteryInfo, 1); + g_hash_table_insert(saved_battery_info, (char*) id, battery_info); + battery_info->last_level = -1; + battery_info->last_time = -1; + battery_info->last_chargeRate = -1; + battery_info->high_time_warn_count = 0; + } + + /* display the warning only 10 times and then ever 100 calls , should avoid to flood syslog */ + if (battery_info->high_time_warn_count < 10 || !(battery_info->high_time_warn_count % 100)) { + HAL_WARNING (("remaining_time *very* high, returning -1")); + battery_info->high_time_warn_count += 1; + } + remaining_time = -1; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor