summaryrefslogtreecommitdiff
path: root/libupower-glib/up-device.c
AgeCommit message (Collapse)AuthorFilesLines
2023-07-03lib: Avoid possible crash on daemon restartBastien Nocera1-0/+6
#0 0x00007f40eb3e43a6 g_type_check_class_is_a (libgobject-2.0.so.0 + 0x3b3a6) #1 0x00007f40eb3c5253 g_object_class_find_property (libgobject-2.0.so.0 + 0x1c253) #2 0x00007f40bffcc668 up_device_changed_cb (libupower-glib.so.3 + 0xc668) #3 0x00007f40eb3bd4ea g_closure_invoke (libgobject-2.0.so.0 + 0x144ea) #4 0x00007f40eb3ebe16 signal_emit_unlocked_R.isra.0 (libgobject-2.0.so.0 + 0x42e16) #5 0x00007f40eb3dccbd g_signal_emit_valist (libgobject-2.0.so.0 + 0x33cbd) #6 0x00007f40eb3dcf33 g_signal_emit (libgobject-2.0.so.0 + 0x33f33) #7 0x00007f40eb3c86b4 g_object_dispatch_properties_changed.lto_priv.0 (libgobject-2.0.so.0 + 0x1f6b4) #8 0x00007f40eb3cef1f g_object_notify (libgobject-2.0.so.0 + 0x25f1f) #9 0x00007f40bffd5f1c up_exported_device_proxy_g_properties_changed (libupower-glib.so.3 + 0x15f1c) #10 0x00007f40eb3bd4ea g_closure_invoke (libgobject-2.0.so.0 + 0x144ea) #11 0x00007f40eb3ec315 signal_emit_unlocked_R.isra.0 (libgobject-2.0.so.0 + 0x43315) #12 0x00007f40eb3dccbd g_signal_emit_valist (libgobject-2.0.so.0 + 0x33cbd) #13 0x00007f40eb3dcf33 g_signal_emit (libgobject-2.0.so.0 + 0x33f33) #14 0x00007f40eb526fff process_get_all_reply (libgio-2.0.so.0 + 0x11dfff) #15 0x00007f40eb52a749 on_name_owner_changed_get_all_cb (libgio-2.0.so.0 + 0x121749)
2022-04-19device: Only handle Refresh() method if in debug modeBastien Nocera1-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.
2021-09-13lib: Add API to access ChargeCyles D-Bus propertyBastien Nocera1-0/+27
2021-02-02lib: Invert percentage conditional in device_to_textMarijn Suijten1-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).
2020-12-16lib: Add "Touchpad" device typeBastien Nocera1-4/+8
2019-10-24lib: Add "Pen" device typeBastien Nocera1-2/+4
So we can track the battery information for powered tablet pens, rather than labelling them as tablets.
2019-02-21Replace use of G_TYPE_INSTANCE_GET_PRIVATEChristian Kellner1-3/+1
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.
2019-02-21Replace use of deprecated g_type_class_add_privateChristian Kellner1-3/+1
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.
2018-09-30lib: Use @see_also instead of "See also"Guido Günther1-2/+1
This ensures consistent rendering. See https://developer.gnome.org/gtk-doc-manual/stable/documenting_sections.html.en
2018-04-19lib: Mention that battery level is preferred when presentBastien Nocera1-6/+16
And print "should be ignored" next to the percentage. https://bugs.freedesktop.org/show_bug.cgi?id=97484
2018-04-18lib: Simplify resource destructionBastien Nocera1-7/+3
Use g_clear_pointer() and g_clear_object() when possible.
2018-03-02lib: Fix warnings when D-Bus related properties changeBastien Nocera1-0/+7
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
2017-09-08lib: Fix API docs for *-level propertiesBastien Nocera1-2/+2
One was referencing a non-existent enum member, the other was missing a link altogether.
2017-08-31lib: Add UP_DEVICE_KIND_GAMING_INPUT for gaming devicesBastien Nocera1-2/+4
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
2017-04-06all: Add BatteryLevel propertyBastien Nocera1-0/+25
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
2016-06-08build: Fix -Wformat-y2k compilation errorsBastien Nocera1-0/+3
The strings are user visible strings, so this isn't a y2k problem.
2015-07-29Share generated code between daemon and libraryCosimo Cecchi1-116/+116
Since we use the same GDBus code in libupower-glib and the daemon, auto-generate a private library that can be used by both.
2015-03-13lib: Fix crash on uninitialized variantVlad Orlov1-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
2014-05-20Do not print a critical warning when misusing up_device_set_object_path_sync()Richard Hughes1-2/+11
2013-10-17lib: Fix possible warning when type changesBastien Nocera1-1/+4
UpDevice on the daemon side has a "type" property, but the libupower-glib object has a "kind" type instead. Translate that.
2013-10-17lib: Fix compile-time warningBastien Nocera1-1/+1
2013-10-17all: Remove *changed signalsBastien Nocera1-24/+0
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-17lib: Proxy notify changes from UpDevice glueBastien Nocera1-2/+3
2013-10-17lib: Trim properties when printing the display deviceBastien Nocera1-7/+14
2013-10-15lib: Fix compilationBastien Nocera1-2/+2
2013-10-15lib: Use slices to allocate cached propertiesBastien Nocera1-2/+2
Saves on memory fragmentation.
2013-10-15lib: Print property name when cached property doesn't existBastien Nocera1-1/+1
2013-10-15lib: Cache property values correctlyBastien Nocera1-1/+2
This is cleaner.
2013-10-14lib: Add support for the IconName propertyBastien Nocera1-0/+22
2013-10-14lib: up_device_to_text() won't work for fake devicesBastien Nocera1-0/+1
For now, up_device_to_text() won't work for devices that aren't backed by a UPower device.
2013-10-14lib: Make it possible to create local UpDevicesBastien Nocera1-0/+41
gnome-settings-daemon creates a composite UpDevice that's not backed by any real D-Bus object in UPower, so we shouldn't try and poke the inexistant proxy in this case. We'll cache the properties that the caller sets in this case, but will not support sending back default/unset values.
2013-10-14lib: Fix alignment of "online" in device dumpBastien Nocera1-1/+1
2013-10-14lib: Add warning-level device propertyBastien Nocera1-0/+23
2013-10-14lib: Port UpDevice to GDBusBastien Nocera1-429/+225
Using the new proxy.
2013-10-14lib: No need to set private members to NULLBastien Nocera1-3/+0
GObject already makes sure of that for us.
2013-10-14Remove obsolete battery recall propertiesBastien Nocera1-83/+0
The recalls for that broken batch of Sony batteries dates back from 2006. All the batteries that could have been recalled have now been recalled, and somebody particularly interested in supporting them can match the batteries using the old rules file, in a user session or a separate daemon.
2013-10-14lib: Simplify _new() functionsBastien Nocera1-3/+1
No need to use a temporary variable.
2013-10-14lib: Add missing "element-type" introspection metadataBastien Nocera1-2/+2
https://bugs.freedesktop.org/show_bug.cgi?id=55419
2013-08-29Make GetHistory() array order consistentMartin Pitt1-1/+3
When requesting fewer history elements than we actually have, fix the interpolation loop to not reverse the returned elements; this already does not happen if we request more elements than available, which led to the returned list order depending on the history size. Now the first array element is always the most recent one. Update documentation accordingly. Add test case to reproduce the problem. We now add three sample points to be able to request a subset and still assert its correct order, and make the charge values be further apart to ensure correct interpolation. https://bugs.freedesktop.org/show_bug.cgi?id=68384
2013-08-23Add temperature property for batteriesSeth Forshee1-0/+24
Linux's power_supply class supports a temperature attribute, which is supported by many battery drivers. Add a new property to export this information and support this property in Linux. https://bugs.freedesktop.org/show_bug.cgi?id=68338 Signed-off-by: Seth Forshee <seth.forshee@canonical.com> Signed-off-by: Martin Pitt <martinpitt@gnome.org>
2012-10-30Add luminosity propertyJulien Danjou1-0/+27
This adds the luminosity property for devices able to recharge using light. Signed-off-by: Julien Danjou <julien@danjou.info> Signed-off-by: Richard Hughes <richard@hughsie.com>
2012-06-14Selectively disable warnings for deprecated GValueArrayMartin Pitt1-0/+6
GLib 2.33 and further deprecates GValueArray. However, we still need it as long as we are using dbus-glib, so selectively disable the deprecation warnings for the three functions that use GValueArray. This allows us to continue to build with -Werror.
2010-11-01libupower-glib: Reject invalid object paths to avoid asserting libdbusRichard Hughes1-0/+6
2010-10-05Fix up all the warnings when building with new versions of gobject-introspectionRichard Hughes1-2/+2
2010-07-26Ensure the new device types get valid descriptions in upower --dumpRichard Hughes1-1/+6
2010-02-05Use GCancellable in libupower-glib so we can eventually get to GIO async ↵Richard Hughes1-5/+9
methods without breaking future API
2010-02-05Ensure we return all lines of the UpDevice when we call up_device_to_string()Richard Hughes1-28/+28
2010-01-27Update the Free Software Foundation addressRichard Hughes1-1/+1
2010-01-26trivial: add some more gtk-doc markup to the new objectsRichard Hughes1-1/+16
2010-01-26trivial: add two more functions to DkpDevice for getting the stats and historyRichard Hughes1-0/+190