Age | Commit message (Collapse) | Author | Files | Lines |
|
Commit 5ddfe0d (all: Use g_get_real_time() when possible) replaced calls
to g_get_current_time() with g_get_real_time(), however, we also need to
convert the return value from microseconds to seconds.
Signed-off-by: Richard Hughes <richard@hughsie.com>
|
|
Instead of a call to g_get_current_time().
|
|
This has 2 effects:
- we never stop polling (we used to stop polling when the
battery was marked as fully-charged, but that can happen when
the battery is discharging too)
- when in an unknown state, we will poll through the daemon,
and through our unknown poll. This isn't a problem as there'll
another 115 seconds of wait until we get to poll through the
daemon again.
|
|
Next up is doing this for batteries, which need to switch between
a normal/slow poll to a faster one when the battery state is unknown.
|
|
Matching the work done in glib, gtk+, etc.
This also differentiates the unknown and normal timeouts in
the Linux power supply driver.
|
|
For system integrators. If your firmware is helpful to user space
and automatically sends out uevent when the battery level changes
(rather than just the battery state) as on most machines,
you can enable "NoPollBatteries" in the configuration option,
and reduce power consumption from UPower and its listeners.
|
|
In up_device_supply_refresh().
|
|
|
|
We cannot ever set the refresh timeout when we have a power line
device, so don't try and remove it there.
|
|
5 times, with 1 second timeouts, instead of 30 times, with
2 seconds timeouts.
|
|
It was never actually setup, as the fallback state was used
to check whether we should use poll or not.
|
|
Some batteries report energy > energy_full and a percentage ("capacity"
attribute) > 100%. Clamp these within 0 and 100% for both plausibility as well
as to avoid setting an out-of-range property which would then become 0%.
https://launchpad.net/bugs/1240673
|
|
|
|
|
|
When switching off Bluetooth devices, and before they timeout,
we won't be able to read the battery percentage, so don't
overwrite the previous value with "0%", but set the state to
unknown instead.
https://bugs.freedesktop.org/show_bug.cgi?id=70325
|
|
In up_device_supply_get_state()
|
|
When refreshing the state of device batteries, no need
to get data that won't be there anyway, such as voltage, temperature,
or consumption rate.
This avoids warnings about voltage being unknown for devices, and
cuts down on the properties churn.
|
|
We're going to be reusing this elsewhere.
|
|
We already have enough information on the device battery.
This avoids having a device for the wacom AC which we won't use.
|
|
Not all "UpDeviceSupply" actually supply power to the computer.
|
|
And remove ifdef's.
|
|
With "warning-level" property.
|
|
It's already done by GObject.
|
|
The recalls for that broken batch of Sony batteries dates back from
2006. All the batteries that could have been recalled have now
been recalled, and somebody particularly interested in supporting
them can match the batteries using the old rules file, in a
user session or a separate daemon.
|
|
This is the case for some devices like the Wacom wireless (Bluetooth)
tablets, and shouldn't produce a warning.
|
|
If the device state is unknown, don't guess based on the laptop's
power supplies (battery/power line) as it might not be charging
from there.
https://bugs.freedesktop.org/show_bug.cgi?id=70321#c1
|
|
Check the input subdevices of the bluetooth parent device of a battery, if
present. If there is mouse* input child device, is a mouse battery; otherwise,
it is a keyboard battery. This also fixes the PowerSupply attribute for these
to be false, as the batteries of wireless input devices don't power the system.
https://launchpad.net/bugs/1153488
Signed-Off-By: Martin Pitt <martin.pitt@ubuntu.com>
|
|
Signed-Off-By: Martin Pitt <martin.pitt@ubuntu.com>
|
|
Avoid filling the logs with repeated warning saying that no correct
voltage value was found for a power device. Improves the situation with
bugs https://bugzilla.redhat.com/show_bug.cgi?id=847874 and
https://bugzilla.redhat.com/show_bug.cgi?id=863524
Signed-off-by: Timothée Ravier <tim@siosm.fr>
Signed-off-by: Martin Pitt <martinpitt@gnome.org>
|
|
Add device full path in warning if retrieving design voltage fails in
up_device_supply_get_design_voltage(). Also helps diagnose bugs
https://bugzilla.redhat.com/show_bug.cgi?id=847874 and
https://bugzilla.redhat.com/show_bug.cgi?id=863524
Signed-off-by: Martin Pitt <martinpitt@gnome.org>
|
|
This avoids filling the logs with the unnecessary warning line:
GLib-CRITICAL **: g_ascii_strcasecmp: assertion `s1 != NULL' failed
as seen in https://bugzilla.redhat.com/show_bug.cgi?id=847874 and
https://bugzilla.redhat.com/show_bug.cgi?id=863524
Signed-off-by: Martin Pitt <martinpitt@gnome.org>
|
|
Linux's power_supply class supports a temperature attribute, which is
supported by many battery drivers. Add a new property to export this
information and support this property in Linux.
https://bugs.freedesktop.org/show_bug.cgi?id=68338
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Martin Pitt <martinpitt@gnome.org>
|
|
Many Android devices only export charge_full and capacity, but not charge_now
or energy_now. In that case, directly read the percentage (from the capacity
attribute) and calculate current energy from that.
Thanks to Seth Forshee for the original patch!
https://bugs.freedesktop.org/show_bug.cgi?id=68337
|
|
In the days of low-power ARM devices and large laptop batteries, imposing a 20
hour plausibility limit on "time to full" is not appropriate any more. Bump it
to 240 hours to still keep a plausibility check against "factor 1000" errors.
https://bugs.freedesktop.org/show_bug.cgi?id=60110
|
|
The condition should be for energy_full, not energy, since we aim to find some
way of finding energy_full and energy_full_design irrespective of the way we
find energy.
https://bugs.freedesktop.org/show_bug.cgi?id=60104
Signed-off-by: Alex Hornung <alex@alexhornung.com>
|
|
up_device_supply_get_design_voltage(): up_device_supply_get_string() returns a
newly allocated copy.
up_history_finalize(): Forgot to free history->priv->dir
https://bugs.freedesktop.org/show_bug.cgi?id=60019
|
|
Signed-off-by: Richard Hughes <richard@hughsie.com>
|
|
Signed-off-by: Richard Hughes <richard@hughsie.com>
|
|
Fix NULL pointer comparison in up_device_supply_coldplug(). This caused
(lt-upowerd:5754): GLib-CRITICAL **: g_ascii_strcasecmp: assertion `s1 != NULL' failed
when a device does not have a "scope" sysfs attribute, and erroneously
considering that device to not power the system.
https://launchpad.net/bugs/1012578
|
|
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=826215
|
|
Signed-off-by: Richard Hughes <richard@hughsie.com>
|
|
Some HID devices with batteries (like bluetooth keyboards) have been creating
power supply devices in sysfs since Linux 3.3.
UPower thinks that they are system devices and shuts down the system if they
get low. This is bad.
This is fixed in Linux 3.4, where there is a new 'scope' file that defines if
the device is powering the system.
Helpfully ACPI batteries don't populate the scope value, but soon will.
Add support for the scope attribute now, and default to system devices if it's
missing. Note, you need to be running a 3.4 kernel or a 3.3 with the patch
backported for this to work.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=806295
|
|
According to Anton Vorontsov (Linux power supply maintainer) power
supplies should not export a present property when they are not
hotpluggable and users of the properties should handle supplies
without present-property as always present.
This patch implements this feature using an additional
sysfs_file_exists call before sysfs_get_bool.
Signed-off-by: Richard Hughes <richard@hughsie.com>
|
|
|
|
|
|
|
|
|
|
percentage
|
|
For hardware that has no rate data we use the differences in charge over a time
period to work out the effective rate. Using linear regression this estimation
is much more realistic.
To do this, introduce a simple circular buffer and use an index to calculate
the rate on each update.
Signed-off-by: Richard Hughes <richard@hughsie.com>
|
|
We'll switch to a kernel property when the power_supply interface is fixed.
|