summaryrefslogtreecommitdiff
path: root/src/modules/dbus/iface-device.c
diff options
context:
space:
mode:
authorTanu Kaskinen <tanu.kaskinen@linux.intel.com>2014-11-02 20:50:37 +0200
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>2014-11-14 14:25:10 +0200
commite9513b40dbe8d155c005f41d661309ca8f350b46 (patch)
treedbe8700f46d7a06f14f092431f282a174eb319d9 /src/modules/dbus/iface-device.c
parent7d9e792d164a0c5af059a2c797ad8e4bfaa349e9 (diff)
dbus: Fix the ActivePort property handler
The old code tried to look up the port object by using an object path, but the ports hashmap uses port names as keys, so the method failed always. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=85369
Diffstat (limited to 'src/modules/dbus/iface-device.c')
-rw-r--r--src/modules/dbus/iface-device.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/modules/dbus/iface-device.c b/src/modules/dbus/iface-device.c
index 625f057a5..d4694839c 100644
--- a/src/modules/dbus/iface-device.c
+++ b/src/modules/dbus/iface-device.c
@@ -725,6 +725,8 @@ static void handle_get_active_port(DBusConnection *conn, DBusMessage *msg, void
static void handle_set_active_port(DBusConnection *conn, DBusMessage *msg, DBusMessageIter *iter, void *userdata) {
pa_dbusiface_device *d = userdata;
const char *new_active_path;
+ pa_dbusiface_device_port *port;
+ void *state;
pa_dbusiface_device_port *new_active;
int r;
@@ -747,7 +749,14 @@ static void handle_set_active_port(DBusConnection *conn, DBusMessage *msg, DBusM
dbus_message_iter_get_basic(iter, &new_active_path);
- if (!(new_active = pa_hashmap_get(d->ports, new_active_path))) {
+ PA_HASHMAP_FOREACH(port, d->ports, state) {
+ if (pa_streq(pa_dbusiface_device_port_get_path(port), new_active_path)) {
+ new_active = port;
+ break;
+ }
+ }
+
+ if (!new_active) {
pa_dbus_send_error(conn, msg, PA_DBUS_ERROR_NOT_FOUND, "No such port: %s", new_active_path);
return;
}