summaryrefslogtreecommitdiff
path: root/src/up-daemon.c
AgeCommit message (Collapse)AuthorFilesLines
2014-05-07all: Remove IsDocked propertyBastien Nocera1-12/+0
Removes the deprecated (for not very long) property, before we do a 1.0 release. https://bugs.freedesktop.org/show_bug.cgi?id=78380
2014-05-07daemon: Deprecate "IsDocked" propertyBastien Nocera1-16/+1
The IsDocked property has been incorrect for a number of laptops for a while, as it thought that laptops with hybrid graphics cards were always docked. The alternative would have been to use the platform/dock_station devices, but those are only exported for ACPI docking stations. Instead, whether an external display is attached (which isn't really docking) should be checked in the same place where the policy depending on the value should be applied, such as gnome-settings-daemon. https://bugs.freedesktop.org/show_bug.cgi?id=36818
2014-04-23daemon: Fix shutdown on boot on some machinesBastien Nocera1-3/+10
On the Lenovo A600 all-in-one, there's a HCI/HID dual-mode Broadcom device which will try to get the battery level of the supplied mouse and keyboard, but will usually fail to do so. So we have a battery of type "battery" (it's not either a mouse or a keyboard, as it's supposed to handle both) but our display device battery code doesn't check whether those batteries are power supplies or not, using this "empty" (0% after the check timed out) battery in the shutdown policy. Check better for power supply devices, not all the "battery" types are power supply batteries, they might be non-power supply ones from unknown device types.
2013-10-28daemon: Add poll helper functionsBastien Nocera1-0/+136
To be used by all polling backends. This changes the defaults to poll every 120 seconds when a warning level isn't reached, and switch automatically to 30 seconds poll when the battery level is low.
2013-10-26daemon: Better timeout source namingBastien Nocera1-0/+1
Matching the work done in glib, gtk+, etc. This also differentiates the unknown and normal timeouts in the Linux power supply driver.
2013-10-26daemon: Let the backends do the pollingBastien Nocera1-66/+1
When the AC state changes, let the backends poll for battery changes. They know better what's _really_ happening (whether the real state is unknown even if they present a fully-charged battery), etc. This is only possible because we fixed the Linux backend to poll as it should always have.
2013-10-20daemon: Fix time to empty with multiple batteriesBastien Nocera1-2/+2
If one battery is draining and the other one isn't, the time to empty wouldn't be zero, but it would only match the time to empty for the single battery. Instead, ignore the accumulated time to empty/time to full for multiple batteries and recalculate it. https://bugzilla.gnome.org/show_bug.cgi?id=710344
2013-10-18daemon: Differentiate 2 warningsBastien Nocera1-2/+2
No way to know which one was being called otherwise
2013-10-18daemon: Fix WarningLevel for devices with no "time to empty"Bastien Nocera1-1/+3
As can happen with missing metadata, we might not have a time to empty, so rely on the percentage instead.
2013-10-17daemon: Remove dead code from up_daemon_device_changed_cb()Bastien Nocera1-11/+0
2013-10-17all: Remove *changed signalsBastien Nocera1-25/+2
Now that we send out PropertiesChanged signals (on the daemon side) and "notify" signals (on the client side), there's no need for the all encompassing DeviceChanged and Changed signals. They would have woken up any client, even if they were not interested in receiving the signals.
2013-10-17power: Work-around batteries that are slow to notice chargeBastien Nocera1-0/+5
This is a hack that was in gnome-settings-daemon's power plugin. We would check whether we were on AC before saying for certain that batteries had a low-level, and raising the warning-level.
2013-10-17all: Add GetCriticalAction daemon methodBastien Nocera1-0/+11
This allows desktop front-ends to get which action will actually be taken when we hit critical battery. This is not a property as availability of actions might change over the course of the run of the system, and we didn't want to make unnecessary D-Bus calls on startup.
2013-10-17all: Remove WarningLevel from the daemon propertiesBastien Nocera1-15/+1
The WarningLevel property just replicated the warning level on the display device, or at least should have. So we fix the latter to remove the former.
2013-10-17daemon: Indentation in UpDaemon structBastien Nocera1-9/+9
2013-10-16daemon: Minimise WarningLevel signalsBastien Nocera1-0/+4
When it doesn't actually change, don't send out signals.
2013-10-16daemon: Only modify display device when it changesBastien Nocera1-1/+11
When none of the properties of the display device change, do not modify it.
2013-10-16daemon: Add GetDisplayDevice methodBastien Nocera1-0/+33
And export a DisplayDevice object which can be used by desktop shells to show/hide the status icon.
2013-10-16daemon: Set the display device type when on batteryBastien Nocera1-0/+1
When on battery only, we weren't setting the display device type properly.
2013-10-16daemon: Remove spurious linefeedBastien Nocera1-1/+0
2013-10-15daemon: Add support for more types for PropertiesChangedBastien Nocera1-0/+16
Add code to transform strings, doubles, uint64s, and int64s.
2013-10-15daemon: Coalesce PropertiesChanged signals togetherBastien Nocera1-40/+98
Instead of sending one changed signal at a time, coalesce them together to reduce wakeups. We also export up_daemon_emit_properties_changed() for UpDevice to use.
2013-10-15daemon: Calculate global WarningLevel correctlyBastien Nocera1-17/+137
By using the state of all the combined batteries, rather than each one (eg. 2 batteries of the same type at 15% shouldn't trigger the "low" warning level). This introduces code to calculate the state of a "display" device, which is either a UPS, or a combination of all batteries.
2013-10-15daemon: Register on the Bus after coldplugBastien Nocera1-45/+34
Both for the daemon and devices, so as to avoid D-Bus changes storms on startup.
2013-10-14daemon: Don't emit changed signal in coldplugBastien Nocera1-5/+7
We weren't emitting GObject signals in coldplug, no need to send out D-Bus signals either.
2013-10-14daemon: Sort the UpDaemon struct memberBastien Nocera1-4/+7
2013-10-14daemon: Add new WarningLevel "Discharging"Bastien Nocera1-2/+5
When UPSes are discharging, we should have a warning already, as it means that mains power has been lost to the UPS (though not to the computer).
2013-10-14daemon: Move all computations of warning level to daemonBastien Nocera1-5/+9
There's no reason why the state check should be done in the UpDevice implementation, and the state will be needed to add a new warning level for UPSes.
2013-10-14daemon: Require newer GLibBastien Nocera1-2/+0
And remove ifdef's.
2013-10-14daemon: Add CriticalPowerActionBastien Nocera1-0/+28
Paraphrasing from the configuration option: The action to take when "TimeAction" or "PercentageAction" above has been reached for the batteries (UPS or laptop batteries) supplying the computer. This is done 20 seconds after the warning-level variable got set to UP_DEVICE_LEVEL_ACTION has been set, to give the opportunity to front-ends to display a (short) warning. This is only implemented for the Linux backend, using logind.
2013-10-14daemon: Emit the PropertiesChanged signalBastien Nocera1-7/+52
Use raw D-Bus. https://bugs.freedesktop.org/show_bug.cgi?id=43001
2013-10-14daemon: Emit the "Changed" signal without going through notifyBastien Nocera1-25/+25
There's no need to use the "notify" signal to capture when the properties are changed, we're the ones sending the notify signals in the first place.
2013-10-14daemon: Device* signals send out object pathsBastien Nocera1-6/+6
Not strings, so correct the signal definitions to match the XML service definition.
2013-10-14daemon: Add small hack for keyboards and miceBastien Nocera1-4/+18
Imported from gnome-settings-daemon, itself from gnome-power-manager.
2013-10-14daemon: Replace "on-low-battery" propertyBastien Nocera1-39/+50
With "warning-level" property.
2013-10-14daemon: Add WarningLevel device propertyBastien Nocera1-0/+31
2013-10-14daemon: Load level policy configurationBastien Nocera1-0/+55
2013-10-14daemon: Remove unused config file loadingBastien Nocera1-25/+0
We already have UpConfig to handle that.
2013-10-14daemon: Remove unneeded reset of priv struct membersBastien Nocera1-8/+0
It's already done by GObject.
2013-10-14daemon: Remove obsolete featuresBastien Nocera1-622/+1
2013-10-14daemon: Simplify _new() functionsBastien Nocera1-3/+1
2013-10-14daemon: Remove unused _set_propertyBastien Nocera1-14/+0
2013-02-20Revert "Add option to run daemon on the session bus for testing"Martin Pitt1-16/+1
This reverts commit eddcf0ef3d0b8445618e368328d7e110a83b69b3. We don't need the --test option any more now that we always run tests on a (fake) system D-BUS.
2013-02-12Also deprecate running the powersave scriptsRichard Hughes1-3/+9
Over the years we've moved all the quirks to the kernel (and fixed most of the issues properly) so on Fedora we've not actually been shipping any rules in pm-utils for a couple of releaes now. Dropping this functionality allows us to finally drop the pm-utils dep for upower.
2013-02-12Add a --enable-deprecated configure argumentRichard Hughes1-10/+82
This is turned off by default. If this is not set, then any calls to Suspend(), SuspendAllowed(), Hibernate() or HibernateAllowed() will fail with an error. The error mesage tells the user what new method to port to in logind. I'm expecting to set --enable-deprecated for Fedora 17 and 18, but turn it off for Fedora 19, so other distributions probably want to follow suit to find out what other stuff needs to be ported to the new APIs early. GNOME should already be fine, but KDE will need some solid porting as I understand it. See http://lists.freedesktop.org/archives/devkit-devel/2013-January/001339.html for more information on future plans and for rationale.
2012-07-11Use systemd for suspend and hibernateMatthias Clasen1-21/+40
When running under systemd, call into systemd for suspend and hibernate instead of pm-utils. To capture resume events, install a small script that gets executed by systemd after resume and sends a dbus signal back to upower. To make this work, the upower backends gain a new signal, ::resuming, that they can optionally emit to signal that a resume happened. Backends opt in to this by returning TRUE from up_backend_emits_resuming(). In this case, upower doesn't assume the sleep command to block until resume, but instead waits for the ::resuming signal from the backend. The only backend that uses this mechanism is the linux backend when built with systemd support. Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-01-06Add boolean RunPowersaveCommand to UPower.confLandry Breuil1-2/+8
Defaulting to true, it controls whether we want the powersave commands to be run when running on battery/plugging ac. Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-05-04Add new NotifySleep() and NotifyResume() signals that include the sleep typeRichard Hughes1-1/+30
This allows session power managers to do different actions depending on whether the user is suspending or hibernating. This allows the session policy agent to poke other things (for instance, the screensaver) even if another process initiated the sleep. This is based on a patch from Phillip Susi <psusi@cfl.rr.com>, many thanks.
2011-04-26Add option to run daemon on the session bus for testingMartin Pitt1-1/+16
Add a daemon option --test which will run upowerd on the session bus. This allows us to run tests without interfering with the system instance. This also avoids any root privileges entirely, which permits running integration tests as part of a package build.
2011-03-28Add a config option 'IgnoreLid' so users with broken / inverted lid switches ↵Richard Hughes1-0/+18
don't suspend at session start