Commit graph

712 commits

Author SHA1 Message Date
Javier Jardón
75894ebb2e Use upstream gettext instead the glib one 2011-07-19 12:16:30 +01:00
Javier Jardón
aabd6fb9e3 autogen.sh: Use autoreconf instead custom script 2011-07-19 11:57:50 +01:00
Javier Jardón
5bf494a9d3 configure.ac: Modernize autotools config
Require automake 1.11 as Its needed to generate xz tarballs
Remove unneded macros
2011-07-19 11:57:48 +01:00
Javier Jardón
9e32af9ef6 Avoid warnings about missing annotations
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-07-19 11:55:34 +01:00
Richard Hughes
37bc9a6f8b trivial: post release version bump 2011-07-04 16:47:16 +01:00
Richard Hughes
e3194730b8 Released UPower 0.9.12 2011-07-04 16:46:19 +01:00
Richard Hughes
1f05a6e9b0 Switch to using .xz tarballs 2011-07-04 16:46:00 +01:00
Richard Hughes
2d8358ae4e Fix how we estimate the device rate for batteries that do not provide this data
Based on a patch from Andy Eyre <andrew.eyre@medschool.ox.ac.uk>, many thanks.
2011-07-01 17:14:58 +01:00
Landry Breuil
fed9c33910 Add openbsd missing includes for close() and strcmp() 2011-05-31 11:07:52 +01:00
Landry Breuil
e495d53661 Silence some openbsd warnings about unused vars and bad return values 2011-05-31 11:07:21 +01:00
Landry Breuil
9d40aa4a2d Add AC_PROG_LIBTOOL as advised by autotools 2011-05-31 11:06:31 +01:00
Richard Hughes
390d295b5b trivial: post release version bump 2011-05-25 12:51:33 +01:00
Richard Hughes
d27dd5f4bb Released UPower 0.9.11 2011-05-25 12:50:31 +01:00
Richard Hughes
2b42890480 Only include glib-unix.h if the GLib version is >= 2.29.4
Many thanks to Takahiro HASHIMOTO for debugging the problem. Fixes fdo#37489
2011-05-23 09:42:38 +01:00
Richard Hughes
abfb19d472 Ensure up-apm-native.h gets shipped in the tarball 2011-05-17 08:23:55 +01:00
Martin Pitt
a1fe30811d Linux integration tests: check energy vs. charge
So far the test cases only covered drivers which reported energy (µWh). Add
checks that the Energy* properties are correct, and add a test case for drivers
which report charge (µAh).
2011-05-14 14:39:16 +02:00
Richard Hughes
0fd304c3f3 Add new NotifySleep() and NotifyResume() signals that include the sleep type
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-05-04 17:57:13 +01:00
Martin Pitt
62024c49c8 Respect $PYTHON for running the test suite
On systems which have an older (< 2.7) Python by default, this allows you to
run make check under PYTHON=python2.7.
2011-05-04 13:46:39 +02:00
Martin Pitt
958bb53105 up-self-test: Run subset of tests when system D-BUS is not available
In restricted environments such as package builds we do not have a system D-BUS
running. In that case, don't just fail, but use the recently introduced
up_daemon_set_bus_type() to run tests on the session D-BUS instead. Run
up-self-tests under dbus-launch for this if available.

Skip tests which need polkit if there is no system D-BUS, as we can't sensibly
run this on the session bus.
2011-05-04 13:42:49 +02:00
Richard Hughes
bdddb74723 trivial: post release version bump 2011-05-03 18:12:48 +01:00
Richard Hughes
5dedd34fe2 Released UPower 0.9.10 2011-05-03 18:11:41 +01:00
Richard Hughes
e9e965590b Use the new threadsafe signal handling support in GLib
If the version of Glib is too old, we continue to use the old non-threadsafe version.
2011-04-28 09:50:51 +01:00
Martin Pitt
5c37df249b trivial: Fix Linux integration test dependency on upowerd
With nested Makefiles we can't depend on a generated file in a different
directory (breaks "make clean && make check"). Thus move the call of the Linux
integration test suite into src/Makefile.am, and only run it if we build the
Linux backend.
2011-04-26 14:31:00 +02:00
Martin Pitt
37fdb2c959 trivial: Fix Linux integration-test for distcheck
distcheck uses a separate build tree, thus call the script from the right
directory. Also actually ship it in release tarballs.
2011-04-26 12:48:23 +02:00
Martin Pitt
065c597b88 Respect $UPOWER_CONF_FILE_NAME in up_config_init()
The daemon test in up-self-test instantiates an UpDaemon object, which creates
an UpConfig object. Unlike UpDaemon itself, up_config_new() did not check for
$UPOWER_CONF_FILE_NAME to find the configuration file name.

This had the effect that a make check/distcheck run would always try to use the
system wide configuration file, and fail if --sysconfdir wasn't specified
appropriately.
2011-04-26 12:44:21 +02:00
Martin Pitt
5cb1f4a9a3 Consider a discharging UPS as "on battery"
Implement get_{on,low}_battery() methods on HID devices for Linux. This will
treat discharging UPSes like batteries and set the "on-battery" and
"on-low-battery" properties accordingly.

This also fixes the test_ups_ac() case in the Linux integration tests.
2011-04-26 11:50:36 +02:00
Martin Pitt
a786d2fd16 Fix "unknown" battery status guessing to not be recursive
Stop querying the global "on-battery" property when trying to guess the status
of a battery which reports as "unknown", as "on-battery" is itself defined in
terms of the states of the individual batteries. Instead, guess the state based
on whether we have any AC available; if so, we can reasonably assume
charging/discharging based on whether any AC is online. If no AC is present,
assume discharging (as we did before), but only if we have only one battery.

Stop guessing for the case where we don't have any AC device, "unknown" battery
state, and multiple batteries, as then we can't know which battery is currently
discharging.

https://bugs.freedesktop.org/show_bug.cgi?id=24371
2011-04-26 11:50:36 +02:00
Martin Pitt
7c617ba6f1 Run Linux integration tests in "make check"
If possible, run the tests under dbus-launch to ensure that there is a private
D-BUS session bus. This allows the tests to work in e. g. a clean package build
environment, and also avoids messing with the real user session bus.
2011-04-26 11:50:36 +02:00
Martin Pitt
e1f4aa38de Add integration test suite for Linux
Add src/linux/integration-test: This is a Python unittest based test suite
which provides methods for building a sandbox sysfs tree, runs upowerd
in it, and checks for correct properties.

As it is really hard to provide fake uevents, this currently only works for
properties which do not depend on dynamic system changes, i. e. you can
currently only check the status after coldplugging.

However, this already provides enough possibilities for functionality and
regression testing, and exposes some bugs with determining the "OnBattery"
property under certain conditions like the ones described in
<https://bugs.freedesktop.org/show_bug.cgi?id=24371>.

If any of the tests fails, the daemon log will be printed to stderr for easier
debugging.

With the previous commit that adds "upowerd --test", we can also run
the integration tests as non-root. If they are called as root, start upowerd
normally on the system bus, otherwise on the session bus with --test.
2011-04-26 11:50:36 +02:00
Martin Pitt
eddcf0ef3d Add option to run daemon on the session bus for testing
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-04-26 11:50:36 +02:00
Martin Pitt
f65aa4dbf2 Support virtual UPS devices for testing
If a HID device is marked with the UPOWER_FAKE_DEVICE udev property, don't send
ioctl commands to it, but instead read status and percentage from udev
properties as well (UPOWER_FAKE_HID_CHARGING and UPOWER_FAKE_HID_PERCENTAGE).

This allows developers or a test suite to test the behaviour of UPSes without
actually having one.
2011-04-26 11:28:32 +02:00
Martin Pitt
c25079b652 src/.gitignore: Fix file name
"dkp-self-test" is now called "up-self-test".
2011-04-15 18:06:45 +02:00
Martin Pitt
8a9d9a47bd selftest: Globally set configuration path
Set $UPOWER_CONF_FILE_NAME before calling the tests, so that other tests can
also initialize the daemon.
2011-04-13 11:32:32 +02:00
Martin Pitt
0716e21a33 fix up-self-test build
It uses up_config_*() functions, so we need to build it against up-config.{h,c}

Fixes build failure:

up_self_test-up-daemon.o: In function `up_daemon_init':
/home/martin/upstream/upower/src/up-daemon.c:1047: undefined reference to `up_config_new'
[...]
2011-04-13 11:19:44 +02:00
Tobias Mueller
2cec4b7878 Do not overwrite aclocal flags in autogen, fixes b.fd.o #35261
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-31 19:45:24 +01:00
Richard Hughes
b458ef8250 trivial: fix whitespace issue with the last patch 2011-03-30 19:23:35 +01:00
Benson Leung
95ecdb25b2 Support batteries that report both energy and charge.
More cleanly support batteries that report both energy and charge,
but do not report power_now. One battery driver in drivers/power
(bq20z75) supports reporting energy and charge natively from the
fuel gauge, but does not report power_now. The previous legacy behavior
would ignore the existence of charge and treat current_now as
being in units of power.

Signed-off-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-30 14:16:21 +01:00
Richard Hughes
c98ca6f8f5 Add a config option 'IgnoreLid' so users with broken / inverted lid switches don't suspend at session start 2011-03-28 16:41:02 +01:00
Landry Breuil
3787531096 openbsd: fix warning, and set lid-present to no
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:40:25 +00:00
Landry Breuil
883da76819 openbsd: Add licence headers..
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:40:23 +00:00
Landry Breuil
08227a6416 openbsd: handle case when power is reported directly as Wh
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:40:21 +00:00
Landry Breuil
83e1e56938 openbsd: Add up_apm_device_refresh callback to device class
- 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-21 18:40:19 +00:00
Landry Breuil
53ba669490 openbsd: wip on acpibat_state, need to sort wh/ah units
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:40:16 +00:00
Landry Breuil
6dd2e35d6f openbsd: add up_backend_update_acpibat_state() and call it if acpibat0 device is found
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:40:15 +00:00
Landry Breuil
a65fdfc156 trivial: move #includes
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:40:13 +00:00
Landry Breuil
20a3759ab9 openbsd: rename get_sensor() to get_sensordev() for the sake of clarity
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:40:12 +00:00
Landry Breuil
1017f7399b openbsd: rename has_sensor() to get_sensor() and use it to grab the sensordev struct
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:40:09 +00:00
Landry Breuil
5e69186399 openbsd: add up_native_has_sensor() and use it in is_laptop()
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:40:07 +00:00
Landry Breuil
0580fed09a trivial: ignore libupshared too
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:40:05 +00:00
Landry Breuil
7dda4cd660 -Wuninitialized needs -O
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:40:00 +00:00