summaryrefslogtreecommitdiff
path: root/src/openbsd/up-backend.c
AgeCommit message (Collapse)AuthorFilesLines
2014-11-26daemon: release resources at shutdownPeter Wu1-0/+16
This makes it easier to find real memory leaks with valgrind. After calling the up_backend_unplug functions, you cannot restart it with up_backend_coldplug since the lists are cleared. Tested with Linux only (not on *BSD; dummy compiles). https://bugs.freedesktop.org/show_bug.cgi?id=82659
2014-10-08all: convert value from g_get_real_time() to secondsEvangelos Foutras1-2/+2
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>
2014-09-24all: Use g_get_real_time() when possibleBastien Nocera1-9/+6
Instead of a call to g_get_current_time().
2014-06-30openbsd: Expose "capacity" and "energy-full-design" propertiesFabian Raetz1-3/+17
https://bugs.freedesktop.org/show_bug.cgi?id=80707
2014-04-22Update lid status when updating ac status.Jasper Lievisse Adriaanse1-2/+68
Signed-off-by: Richard Hughes <richard@hughsie.com>
2013-10-17all: Add GetCriticalAction daemon methodBastien Nocera1-0/+13
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-14daemon: Add CriticalPowerActionBastien Nocera1-0/+11
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: Replace "on-low-battery" propertyBastien Nocera1-25/+0
With "warning-level" property.
2013-10-14daemon: Remove unneeded reset of priv struct membersBastien Nocera1-4/+0
It's already done by GObject.
2013-10-14daemon: Remove obsolete featuresBastien Nocera1-70/+0
2013-10-14daemon: Simplify _new() functionsBastien Nocera1-3/+1
2013-10-14openbsd: Use g_thread_try_new()Landry Breuil1-1/+1
Instead of deprecated g_thread_create() https://bugs.freedesktop.org/show_bug.cgi?id=70071
2013-10-14openbsd: recognize when battery is absent or fully chargedJasper Lievisse Adriaanse1-2/+36
https://bugs.freedesktop.org/show_bug.cgi?id=70064
2013-09-18openbsd: Do not call g_thread_init()Richard Hughes1-1/+0
2012-07-11Use systemd for suspend and hibernateMatthias Clasen1-0/+6
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-06-27openbsd: Properly initialize update-time when creating devicesLandry Breuil1-0/+4
Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-01-06openbsd: set powersave command to apm -C/-ALandry Breuil1-1/+5
Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-01-06openbsd: no need to pass the fd aroundLandry Breuil1-9/+6
better access it where needed through the singleton. Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-01-06openbsd: handle case where minutes_left might be negativeLandry Breuil1-2/+2
might not be useful since apm_fd is accessed through the singleton.. Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-01-06openbsd: improve logic wrt sensor typeLandry Breuil1-15/+5
in case some sensors are in AMPHOUR/AMPS and others in WATTHOUR/WATTS, don't assume they are all the same type. As a benefit, shrinks the code a bit. Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-01-06openbsd: fix energy-rate calculationLandry Breuil1-3/+5
since acpibat.c r1.59, bst_rate type is SENSOR_AMPS or SENSOR_WATTS and value has been corrected. Tweak accordingly. Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-01-06openbsd: use a singleton pattern to access /dev/apmLandry Breuil1-15/+4
up_apm_get_fd() opens /dev/apm only if it's not already opened. Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-01-06openbsd: Fix history by not trying to refresh if /dev/apm wasn't opened yetLandry Breuil1-2/+5
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-05-31Silence some openbsd warnings about unused vars and bad return valuesLandry Breuil1-5/+5
2011-03-21openbsd: fix warning, and set lid-present to noLandry Breuil1-2/+3
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: Add licence headers..Landry Breuil1-0/+21
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: handle case when power is reported directly as WhLandry Breuil1-10/+25
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: Add up_apm_device_refresh callback to device classLandry Breuil1-22/+69
- move apm_fd to a global var atm, needs to be passed to a private native class - propagate more error codes through some booleans - history now works! Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: wip on acpibat_state, need to sort wh/ah unitsLandry Breuil1-1/+25
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: add up_backend_update_acpibat_state() and call it if acpibat0 ↵Landry Breuil1-0/+28
device is found Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: assign callbacks to ac/batt device classLandry Breuil1-3/+6
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: rip of get_on_battery/get_low_battery/get_online from freebsd backendLandry Breuil1-1/+80
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21trivial: fix indentLandry Breuil1-1/+1
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: time-to-empty is in secondsLandry Breuil1-1/+1
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21trivial: silence warningsLandry Breuil1-4/+4
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21trivial: return NULL, shouldnt be reached anywayLandry Breuil1-0/+1
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: Declare prototypes for get_power_info/get_battery_state_valueLandry Breuil1-10/+11
Pass struct apm_power_info ptr as argument instead of returning it Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: cast NULL to void* to silence missing sentinel gcc warningsLandry Breuil1-6/+6
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: dont initialize props we wont likely set atmLandry Breuil1-10/+2
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: Update battery properties only if they really changedLandry Breuil1-4/+26
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: update ac state only if state really changedLandry Breuil1-3/+9
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: use g_debug instead of g_message, also log minutes_leftLandry Breuil1-3/+2
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: move batt/ac properties update to their own separate functionsLandry Breuil1-12/+26
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: No need for a delayed callback coldplugging devicesLandry Breuil1-21/+15
Coldplug them directly in up_backend_coldplug (only if is_laptop is true) Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: add is_laptop boolean and only add ac/batt devices if trueLandry Breuil1-35/+44
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: set has-history & has-statistics to TRUELandry Breuil1-2/+2
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: Move os-specific headers inclusion to up-apm-native.hLandry Breuil1-10/+0
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: update ac online status tooLandry Breuil1-6/+10
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: cast battery_life to gdoubleLandry Breuil1-3/+1
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21openbsd: Don't update percentage, probably missing a castLandry Breuil1-14/+19
Fix some return codes, and give sane defaults to ac/batt devices Signed-off-by: Richard Hughes <richard@hughsie.com>