summaryrefslogtreecommitdiff
path: root/libupower-glib
Commit message (Collapse)AuthorAgeFilesLines
* device: Only handle Refresh() method if in debug modeBastien Nocera2022-04-191-1/+2
| | | | | | | | | | | | | | | | | The Refresh D-Bus method could be used by clients to force re-reading the state of batteries in the upower backends. This is not needed as all the backends should be sending events when their states changes, removing the need for an explicit refresh. This is also a potential security problem if applications keep on refreshing their data. We now only allow access to the Refresh() method if the daemon was started in debugging mode. This should make it clearer that it is a debug tool. Also remove a mention of the never implemented refresh-power-source polkit authorisation.
* Remove Wakeups APIBenjamin Berg2022-03-247-917/+0
| | | | | | | | | | | | | | | | The API relied on /proc/timer_stats which has been removed from the kernel in 2017. Since then, the API has been non-functional (yet incorrectly reporting support because the support test was buggy). Just remove it completely. The debian codesearch does not uncover any API users. Also, I doubt that any new API (based on tracing scheduler events as perf would do) would map well to what exists now. i.e. if something like this is re-implemented in UPower or elsewhere, then the API should likely look different. And, realistically, if this does need root privileges (i.e. can't be moved to use BPF programs or so on user units), then we can also create a new small daemon that is launched on-demand just for that.
* lib: Fix UpClient reference leakBastien Nocera2022-02-161-1/+1
| | | | | | | The task holds a reference to the UpClient and won't let it go until the task is finalized. See https://gitlab.gnome.org/GNOME/gnome-bluetooth/-/merge_requests/115
* build: Fix version macrosJan Alexander Steffens (heftig)2022-02-051-3/+8
| | | | | The project version is a string. We need to split it into an array of version components.
* lib: Simplify loop using g_autoBastien Nocera2022-01-241-6/+3
|
* lib: Prepare headers for internal g_auto* usageBastien Nocera2022-01-241-2/+1
|
* lib: Remove unnecessary castBastien Nocera2022-01-241-1/+1
|
* lib: Implement up_client_get_devices_async()Bastien Nocera2022-01-232-0/+72
|
* lib: Add internal helper for up_client_get_devices2()Bastien Nocera2022-01-231-21/+33
| | | | Making sure to pass GCancellable and GError arguments.
* lib: Add up_client_new_async()Bastien Nocera2022-01-212-5/+95
| | | | Closes: #121
* lib: Add API to access ChargeCyles D-Bus propertyBastien Nocera2021-09-131-0/+27
|
* build: Remove unused variable assignmentBastien Nocera2021-09-071-9/+0
|
* build: Require GIR to be created to run testsBastien Nocera2021-09-071-3/+1
|
* build: Add missing GLib log domainsBastien Nocera2021-09-071-0/+1
| | | | | | | | The daemon sources and libupower-glib were built without their historic log domains which meant some debug messages did not appear when running upowerd in verbose mode. This fixes the test_no_poll_batteries test.
* build: Remove autotoolsBastien Nocera2021-09-061-90/+0
|
* build: Clean up include_directories usageBastien Nocera2021-09-061-1/+2
|
* build: Support building upower with mesonBenjamin Berg2021-09-021-0/+92
|
* lib: Mark device refresh function as deprecatedBastien Nocera2021-08-191-0/+1
| | | | | | As the daemon API will soon be removed. See https://gitlab.freedesktop.org/upower/upower/-/merge_requests/66
* lib: Mark lid related functions and properties as deprecatedBastien Nocera2021-08-192-2/+4
| | | | | | As we want to eventually remove them. See https://gitlab.freedesktop.org/upower/upower/-/merge_requests/5
* lib: Add UP_DEVICE_KIND_BLUETOOTH_GENERIC typeBastien Nocera2021-06-172-0/+5
| | | | | | This will be useful to show information about Bluetooth devices which don't fit in with the existing types, and for which we don't want to show an unknown kind.
* up-client: Document and handle NULL return when getting devicesBenjamin Berg2021-02-041-3/+4
|
* lib: Add more device kinds for Bluetooth classesMarijn Suijten2021-02-022-0/+65
| | | | | | | | | | | This adds a variety of missing device kinds specific to the Bluetooth classes supported in gnome-bluetooth [1]. In up_device_to_text these types have only been added to the `percentage` class, which is currently the only property exposed by org.bluez.Battery1, where these devices are coming from. [1]: https://gitlab.gnome.org/GNOME/gnome-bluetooth/-/blob/cf4a0ba59dc092f84030349d9933caf00f2640a2/lib/bluetooth-utils.c#L165
* lib: Invert percentage conditional in device_to_textMarijn Suijten2021-02-021-11/+2
| | | | | | | Almost every device kind except line power and invalid (>= last) carry a valid percentage property. By inverting this conditional not every new device needs to be added explicitly to this already long and lacking chain (PDA and MONITOR were already missing).
* lib: Add "Touchpad" device typeBastien Nocera2020-12-163-4/+13
|
* lib: Add "Pen" device typeBastien Nocera2019-10-243-2/+9
| | | | | So we can track the battery information for powered tablet pens, rather than labelling them as tablets.
* Replace use of G_TYPE_INSTANCE_GET_PRIVATEChristian Kellner2019-02-216-18/+6
| | | | | | G_TYPE_INSTANCE_GET_PRIVATE has been deprecated since glib version 2.58 and should be replaced with the xxx_get_instance_private (obj) which is generated by G_ADD_PRIVATE.
* Replace use of deprecated g_type_class_add_privateChristian Kellner2019-02-216-17/+6
| | | | | | | | Use G_DEFINE_TYPE_WITH_CODE (..., G_PRIVATE_ADD (...)) instead of the (deprecated since glib 2.58) function g_type_class_add_private to add a private structure for a type. Bump the minimal required version of glib to 2.38.0, the version where G_PRIVATE_ADD was added.
* build: Fix up-daemon-generated.h not being found on distcheckBastien Nocera2018-10-251-0/+2
|
* build: Fix out-of-tree buildBastien Nocera2018-10-021-1/+1
| | | | | | | | | The generated headers for the dbus service are in the build dir, not the source dir. ../../libupower-glib/up-client.c:39:10: fatal error: up-daemon-generated.h: No such file or directory #include "up-daemon-generated.h" ^~~~~~~~~~~~~~~~~~~~~~~
* lib: UpClient: up_client_get_display_device returns a UpDeviceGuido Günther2018-09-301-1/+1
| | | | It doesn't return a UpClient.
* lib: UpClient: Fix stray '%'Guido Günther2018-09-301-1/+1
|
* lib: Use @see_also instead of "See also"Guido Günther2018-09-308-16/+8
| | | | | | This ensures consistent rendering. See https://developer.gnome.org/gtk-doc-manual/stable/documenting_sections.html.en
* lib: Work-around to fix gtk-doc's type detectionGuido Günther2018-09-305-21/+13
| | | | | | | | | | Without the braces on the same line gtk-doc adds function pointers as functions to the documentation and fails to detect the types as GObjects. This fixes object names in the index and cross refs. See the examples in https://developer.gnome.org/gtk-doc-manual/stable/documenting_symbols.html.en
* lib: Add a new version of up_client_get_devices which unrefs contentsRobert Ancell2018-05-312-3/+25
| | | | | | The existing function didn't set the free function on the GPtrArray. This means a libupower user can easily make a mistake in the reference counting of the array contents.
* lib: Mention that battery level is preferred when present14-lib-add-a-new-version-of-up_client_get_devices-which-unrefs-contentsBastien Nocera2018-04-191-6/+16
| | | | | | And print "should be ignored" next to the percentage. https://bugs.freedesktop.org/show_bug.cgi?id=97484
* lib: Simplify resource destructionBastien Nocera2018-04-183-15/+7
| | | | Use g_clear_pointer() and g_clear_object() when possible.
* lib: Fix warnings when D-Bus related properties changeBastien Nocera2018-03-022-1/+13
| | | | | | | | | | | | | | | When UPower would appear, or disappear, we'd get warnings like: g_object_notify: object class 'UpDevice' has no property named 'g-name-owner' or: g_object_notify: object class 'UpClient' has no property named 'g-name-owner' This was caused by the property proxying added in 7531dbd and 28438a7 being too lax about which properties it tried to proxy, which included ones that didn't apply to the object types in question. See https://bugs.freedesktop.org/show_bug.cgi?id=43001 https://bugs.freedesktop.org/show_bug.cgi?id=102350
* docs: Better documentation for the BatteryLevel propBastien Nocera2017-10-311-2/+10
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=103361
* lib: Fix API docs for *-level propertiesBastien Nocera2017-09-081-2/+2
| | | | | One was referencing a non-existent enum member, the other was missing a link altogether.
* lib: Add UP_DEVICE_KIND_GAMING_INPUT for gaming devicesBastien Nocera2017-08-313-2/+9
| | | | | | | | Joypads, joysticks, dance mats, paddles, Wiimotes, steering wheels, tractor cabin simulators, pedals, yokes, breathing controllers, and, hmm, etc. https://bugs.freedesktop.org/show_bug.cgi?id=102493
* lib: Simplify string checksBastien Nocera2017-04-101-31/+31
| | | | | | | | | | | We don't need to protect against NULL values, we already do at the start of the function. Created with: :%s,g_strcmp0\(.*\) == 0,g_str_equal \1, Mentioned in: https://bugs.freedesktop.org/show_bug.cgi?id=100359#c14
* all: Add BatteryLevel propertyBastien Nocera2017-04-062-1/+27
| | | | | | | | | | Export approximate battery levels that devices can use, exported by the kernel as POWER_SUPPLY_CAPACITY_LEVEL_* values. This avoids bizarrely accurate values showing up in UIs when we only have ok/warning levels of accuracy in some cases. https://bugs.freedesktop.org/show_bug.cgi?id=100359
* lib: Add more members to UpDeviceLevel structBastien Nocera2017-04-062-1/+16
| | | | | | | | | | Those levels will not be used to cover warning levels, but approximate battery levels that devices can use, exported by the kernel as POWER_SUPPLY_CAPACITY_LEVEL_* values. See linux/power_supply.h https://bugs.freedesktop.org/show_bug.cgi?id=100359
* build: Fix -Wformat-y2k compilation errorsBastien Nocera2016-06-081-0/+3
| | | | The strings are user visible strings, so this isn't a y2k problem.
* lib: Remove hidden singleton instanceMartin Pitt2016-05-181-9/+1
| | | | | | | | | | GObject _new constructors should always return a new pointer and not do anything else than g_{object,initable}_new(). Drop the internal up_client_object singleton instance. This simplifies the code and makes the code robust with multiple threads. Side issue in https://bugs.freedesktop.org/show_bug.cgi?id=95350
* lib: Add proper error and cancellable handling to UpClient constructorMartin Pitt2016-05-182-22/+67
| | | | | | | | | | | | | | | | | | | | A GObject's _init() should never fail or block, but this is currently the case as up_client_init() connects to upowerd on D-Bus. Convert this to the GInitable interface and provide a new constructor up_client_new_full() which accepts a GCancellable and GError, so that clients can do proper error handling and reporting. This changes up_client_new() to return NULL when connecting to upowerd fails. This provides a more well-defined behaviour in this case as clients can check for this and our methods stop segfaulting as they have checks like g_return_val_if_fail (UP_IS_CLIENT (client), ...) Previously we returned a valid object, but trying to call any method on it segfaulted due to the NULL D-Bus proxy, so client code had no chance to check whether the UpClient object was really valid. https://bugs.freedesktop.org/show_bug.cgi?id=95350
* Support g_autoptr() for all libupower-glib object typesKalev Lember2015-09-153-0/+43
| | | | | | | | This allows using e.g. g_autoptr(UpDevice) in other programs, but does not make upower itself use g_autoptr, or require a new enough glib to support it. Signed-off-by: Richard Hughes <richard@hughsie.com>
* Share generated code between daemon and libraryCosimo Cecchi2015-07-294-201/+162
| | | | | Since we use the same GDBus code in libupower-glib and the daemon, auto-generate a private library that can be used by both.
* lib: Fix memory leak in up_client_get_devices()Bastien Nocera2015-06-261-2/+2
| | | | | When up_client_get_devices() fails to contact the D-Bus daemon, don't leak the newly created array.
* lib: Fix crash on uninitialized variantVlad Orlov2015-03-131-2/+2
| | | | | | | | | Initialize the GVariant* pointers, so that they aren't uninitialized when jumping to "out:" and unref'ing them. https://bugs.freedesktop.org/show_bug.cgi?id=89476 https://bugs.debian.org/774546 https://bugs.launchpad.net/ubuntu-mate/+bug/1428337