Commit graph

441 commits

Author SHA1 Message Date
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
d51953c305 openbsd: assign callbacks to ac/batt device class
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:57 +00:00
Landry Breuil
8e84a6dbb4 openbsd: rip of get_on_battery/get_low_battery/get_online from freebsd backend
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:55 +00:00
Landry Breuil
08d46e4b90 trivial: fix indent
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:51 +00:00
Landry Breuil
164ac63f8d openbsd: time-to-empty is in seconds
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:49 +00:00
Landry Breuil
0d7b9fe1d5 trivial: silence warnings
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:48 +00:00
Landry Breuil
55408490d0 trivial: return NULL, shouldnt be reached anyway
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:26 +00:00
Landry Breuil
b03290f11d openbsd: Declare prototypes for get_power_info/get_battery_state_value
Pass struct apm_power_info ptr as argument instead of returning it

Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:24 +00:00
Landry Breuil
564d1c47ad openbsd: cast NULL to void* to silence missing sentinel gcc warnings
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:23 +00:00
Landry Breuil
2533e75e77 openbsd: dont initialize props we wont likely set atm
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:22 +00:00
Landry Breuil
631869fdd5 openbsd: Update battery properties only if they really changed
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:20 +00:00
Landry Breuil
89c929d442 openbsd: update ac state only if state really changed
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:19 +00:00
Landry Breuil
c11e803058 openbsd: use g_debug instead of g_message, also log minutes_left
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:17 +00:00
Landry Breuil
d5b1d6d49f openbsd: move batt/ac properties update to their own separate functions
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:15 +00:00
Landry Breuil
8d2844c51c openbsd: No need for a delayed callback coldplugging devices
Coldplug them directly in up_backend_coldplug (only if is_laptop is true)

Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:14 +00:00
Landry Breuil
afdef9d298 openbsd: add is_laptop boolean and only add ac/batt devices if true
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:12 +00:00
Landry Breuil
7b4c52bfb9 openbsd: set has-history & has-statistics to TRUE
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:11 +00:00
Landry Breuil
f001a92ec5 openbsd: add up_native_is_laptop()
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:09 +00:00
Landry Breuil
07100772ab openbsd: Move os-specific headers inclusion to up-apm-native.h
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:08 +00:00
Landry Breuil
527019ea82 openbsd: update ac online status too
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:07 +00:00
Landry Breuil
4ba9516b6a openbsd: cast battery_life to gdouble
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:05 +00:00
Landry Breuil
543159173a openbsd: Don't update percentage, probably missing a cast
Fix some return codes, and give sane defaults to ac/batt devices

Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:04 +00:00
Landry Breuil
c9296f51ba openbsd: Use separate 'static' devices for ac and battery
Move UpApmNative object to its own header for use by UpBackend

Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:02 +00:00
Landry Breuil
a5e0d246e0 openbsd: add dumb ApmNative gobject
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:39:01 +00:00
Landry Breuil
ba3ffa0052 openbsd: fetch batt info from APM_IOC_GETPOWER ioctl()
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:38:57 +00:00
Landry Breuil
6b32cea9c3 openbsd: do a delayed add for device coldplugging, and emit device-added signal
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:38:56 +00:00
Landry Breuil
5e36534edf trivial: actually return a string
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:38:54 +00:00
Landry Breuil
23948aed38 trivial: return FALSE in callback
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:38:53 +00:00
Landry Breuil
41e678a8f4 openbsd: Add GObject stuff + wip on apm_thread/apm_event_cb
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:38:51 +00:00
Landry Breuil
4746c7df50 openbsd: add skeleton code
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:38:50 +00:00
Landry Breuil
d81b7ebee4 openbsd: add openbsd backend SUBDIR
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-21 18:38:46 +00:00
Richard Hughes
e4574b70ac Correct the DBus-glib property name for LidForceSleep 2011-03-14 11:25:06 +00:00
Richard Hughes
b0bbb29df1 Add a config option 'EnableWattsUpPro' to disable the Watts Up Pro device
Annoyingly, the device used in the Watts Up Pro device seems to be a generic
USB->serial adaptor, which means it doesn't have a unique vendor and product
ID. If we try to probe for the WUP device, we can actually upset other devices
that are not expecing to be probed. This fixes #33846 although we actually
still need to be more strict in detecting a true WUP device.
2011-03-14 11:01:12 +00:00
Michael Biebl
d1e5f6a4da Depend on stable GUdev API
The GUdev API was declared stable in udev release 147.
Bump the version in the configure check and drop the
G_UDEV_API_IS_SUBJECT_TO_CHANGE defines.

Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-09 11:03:44 +00:00
Arnaud Patard
8b9ee53133 up-input.c: fix bitmap check
In up_input_coldplug(), some checks are done on the input device found in order
to detect if it's a lid switch or not.

The following one is problematic :

         /* convert to a bitmask */
         num_bits = up_input_str_to_bitmask (contents, bitmask, sizeof (bitmask));
         if (num_bits != 1) {
                 g_debug ("not one bitmask entry for %s", native_path);
                 ret = FALSE;
                 goto out;
         }

Checking if there's only 1 bit set is wrong. It's nice if you have a x86 with
acpi using 1 input device for the lid switch but it's not always nice.
One can create input devices with gpios-keys like this:

 static struct gpio_keys_button keys[] = {
         {
                 .code = SW_LID,
                 .gpio = ...,
                 .type = EV_SW,
                 .desc = "Lid Switch",
         },
         {
                 .code = SW_RFKILL_ALL,
                 .gpio = ...,
                 .type = EV_SW,
                 .desc = "rfkill",
         },
 };

The resulting SW bitmap will be 9 and thus there are 2 bits sets and due to the
mentionned check, the device is ignored by upower.

As a fix, I'm checking if the number of bits is between 0 and SW_CNT
bits.

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-04 17:29:44 +00:00
Richard Hughes
38199e44ff Add an option for polling dock devices in UPower.conf, defaulting to false 2011-03-03 14:02:27 +00:00
Michael Biebl
11301ae3d6 Drop devkit and devkit-power-daemon symlinks
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-02-23 16:18:53 +00:00
Richard Hughes
b31de44eee Add a LidForceSleep property to ensure that we don't melt any laptops
We still need to add the DMI quirks, but I'm waiting for the
community to supply them now.
2011-02-02 13:44:09 +00:00
Richard Hughes
17b7aef701 linux: use the number of active DRM devices to determine the system docked status
Not ideal, but better than relying on ACPI.
2011-01-04 18:05:09 +00:00
Richard Hughes
c507b516d4 Add an IsDocked binary property to the main interface 2011-01-04 17:01:59 +00:00
Richard Hughes
2af7a6e091 Support the power_now sysfs attribute to get time remaining on new kernels
The kernel has removed the insanity of providing current_now in either
(and unspecified) units of uVh or uWh and instead provides power_now
for the power rate value.

Related commits:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=b137b9942a07843c64a934cfdb7d43155e507e13
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=7faa144a518c456e2057918f030f50100144ccc6

Thanks to Florian Eitel for the initial patch.
2011-01-04 09:30:22 +00:00
Martin Pitt
83f1a6394b Testsuite: Reduce race condition in history purging check
Previously we set the "max age" to seconds and then waited for exactly 2
seconds until we wrote the history data back to files. In a lot of cases this
actually took a tad more than 2 seconds, which caused the second-last history
entry to disappear as well.

Reduce the waiting to 1.1 seconds, which will now give us 900 ms to write back
the history file. Still not ideal, but the best we can do in the test suite.
2010-11-05 09:56:47 -04:00