I started trying to add support for runtime pm and I began with adding new properties to report the current values from the sysfs node. When I try to test it though, I end up with a crash that is impossible. The stack trace at the time is:
update_configuration g_key_file_new g_key_file_init g_get_language_names g_private_set g_private_set aborts because pthread_setspecific fails. This can't possibly happen though because g_get_language_names calls g_private_get first, which initializes the underlying pthread object the first time it is called, and this whole stack is called successfully several times before it aborts, in the same thread, with the same value for the key object ( which is a static local so it shouldn't ever change, but I made sure with gdb to rule out memory spray ). The patch is attached. Any clue how the hell this can be happening?
From 684e20ac027696c25c9f498cb458f0ee4bc16e91 Mon Sep 17 00:00:00 2001 From: Phillip Susi <ps...@ubuntu.com> Date: Tue, 26 Nov 2013 20:25:59 -0500 Subject: [PATCH] Initial runtime_pm support --- data/org.freedesktop.UDisks2.xml | 3 +++ src/udiskslinuxdrive.c | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/data/org.freedesktop.UDisks2.xml b/data/org.freedesktop.UDisks2.xml index 6e40c9b..9a8e790 100644 --- a/data/org.freedesktop.UDisks2.xml +++ b/data/org.freedesktop.UDisks2.xml @@ -435,6 +435,9 @@ that are part of the same physical device. --> <property name="SiblingId" type="s" access="read"/> + <property name="pm_status" type="s" access="read"/> + <property name="pm_autosuspend_delay" type="x" access="read"/> + <property name="pm_control" type="s" access="read"/> </interface> diff --git a/src/udiskslinuxdrive.c b/src/udiskslinuxdrive.c index 170ba27..c250254 100644 --- a/src/udiskslinuxdrive.c +++ b/src/udiskslinuxdrive.c @@ -668,6 +668,19 @@ append_fixedup_sd (const gchar *prefix, return g_string_free (str, FALSE); } +static void update_runtime_pm( UDisksDrive *drive, UDisksLinuxDevice *device ) +{ + const gchar *pm_status = g_udev_device_get_sysfs_attr (device->udev_device, "device/power/runtime_status"); + guint64 pm_autosuspend_delay = g_udev_device_get_sysfs_attr_as_uint64 (device->udev_device, "device/power/autosuspend_delay"); + const gchar *pm_control = g_udev_device_get_sysfs_attr (device->udev_device, "device/power/control"); + + udisks_drive_set_pm_status (drive, pm_status); + udisks_drive_set_pm_autosuspend_delay (drive, pm_autosuspend_delay); + udisks_drive_set_pm_control (drive, pm_control); + g_free (pm_status); + g_free (pm_control); +} + /** * udisks_linux_drive_update: * @drive: A #UDisksLinuxDrive. @@ -924,7 +937,7 @@ udisks_linux_drive_update (UDisksLinuxDrive *drive, } set_id (iface); - + update_runtime_pm (iface, device); ret = update_configuration (drive, object); out: -- 1.8.3.2
signature.asc
Description: OpenPGP digital signature
_______________________________________________ devkit-devel mailing list devkit-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/devkit-devel