mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-19 08:28:12 +02:00
linux: Refresh for 5 seconds after plug/unplug on MacBooks
Pull the 2 previous changes together to refresh the battery status for a couple of seconds after receiving an event on the power line. This fixes charge status being inaccurate for up to 120 seconds (the normal poll timeout on MacBooks). https://gitlab.freedesktop.org/upower/upower/issues/56
This commit is contained in:
parent
6ab61bac9d
commit
7188cc0417
1 changed files with 3 additions and 2 deletions
|
|
@ -38,6 +38,7 @@
|
|||
#include "up-types.h"
|
||||
#include "up-constants.h"
|
||||
#include "up-device-supply.h"
|
||||
#include "up-backend-linux-private.h"
|
||||
|
||||
#define UP_DEVICE_SUPPLY_CHARGED_THRESHOLD 90.0f /* % */
|
||||
|
||||
|
|
@ -1146,8 +1147,8 @@ up_device_supply_setup_unknown_poll (UpDevice *device,
|
|||
return;
|
||||
|
||||
/* if it's unknown, poll faster than we would normally */
|
||||
if (state == UP_DEVICE_STATE_UNKNOWN &&
|
||||
supply->priv->unknown_retries < UP_DAEMON_UNKNOWN_RETRIES) {
|
||||
if (supply->priv->unknown_retries < UP_DAEMON_UNKNOWN_RETRIES &&
|
||||
(state == UP_DEVICE_STATE_UNKNOWN || up_backend_needs_poll_after_uevent ())) {
|
||||
gint64 now;
|
||||
supply->priv->poll_timer_id =
|
||||
g_timeout_add_seconds (UP_DAEMON_UNKNOWN_TIMEOUT,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue