~xavi-garcia-mena/ubuntu/vivid/upower/percentages-power-off

« back to all changes in this revision

Viewing changes to debian/patches/0001-linux-Don-t-guess-discharging-state-for-devices.patch

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2013-10-14 11:41:36 UTC
  • Revision ID: package-import@ubuntu.com-20131014114136-fyh80f8bw06jq7wf
Tags: 0.9.22-1ubuntu1
* Cherry-pick two fixes from upstream:
  - up-client: Really don't overwrite retval with prop values. Properties
    and property notification via libupower-glib got broken in 0.9.22.
    Incorrect values were being returned, meaning anything relying on these
    might do the wrong thing, such as in LP: #1238663
  - lib: Fix crasher calling _about_to_sleep_sync(). Crash fix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From f3898db4d3a340e5a4245bb86c3291d109ae0349 Mon Sep 17 00:00:00 2001
 
2
From: Bastien Nocera <hadess@hadess.net>
 
3
Date: Sat, 12 Oct 2013 15:29:18 +0200
 
4
Subject: [PATCH] linux: Don't guess discharging state for devices
 
5
 
 
6
If the device state is unknown, don't guess based on the laptop's
 
7
power supplies (battery/power line) as it might not be charging
 
8
from there.
 
9
 
 
10
https://bugs.freedesktop.org/show_bug.cgi?id=70321#c1
 
11
---
 
12
 src/linux/up-device-supply.c | 2 +-
 
13
 1 file changed, 1 insertion(+), 1 deletion(-)
 
14
 
 
15
diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c
 
16
index 4a4b431..ef40e06 100644
 
17
--- a/src/linux/up-device-supply.c
 
18
+++ b/src/linux/up-device-supply.c
 
19
@@ -720,7 +720,7 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply)
 
20
 
 
21
        /* the battery isn't charging or discharging, it's just
 
22
         * sitting there half full doing nothing: try to guess a state */
 
23
-       if (state == UP_DEVICE_STATE_UNKNOWN) {
 
24
+       if (state == UP_DEVICE_STATE_UNKNOWN && supply->priv->is_power_supply) {
 
25
                daemon = up_device_get_daemon (device);
 
26
 
 
27
                /* If we have any online AC, assume charging, otherwise
 
28
-- 
 
29
1.8.3.2
 
30