DBus: setting org.PulseAudio.Core1.Card.ActiveProfile property always fails with "No such profile"
Summary
Calling Set('org.PulseAudio.Core1.Card', 'ActiveProfile', <valid profile path>)
on a card object always fails with org.PulseAudio.Core1.NotFoundError: <valid profile path>: No such profile
.
AFAICT the issue is that the handle_set_active_profile
function in iface-card.c
attempts to look up the profile path in c->profiles
, but c->profiles
is a map from name to profile, rather than from path to profile.
Steps to reproduce
The following Python script reliably reproduces the issue for me:
#!/usr/bin/env python3
import dbus
bus = dbus.SessionBus()
sl = dbus.Interface(
bus.get_object('org.PulseAudio1', '/org/pulseaudio/server_lookup1'),
'org.freedesktop.DBus.Properties')
addr = sl.Get('org.PulseAudio.ServerLookup1', 'Address')
conn = dbus.connection.Connection(addr)
core = dbus.Interface(
conn.get_object(object_path='/org/pulseaudio/core1'),
'org.freedesktop.DBus.Properties')
card = dbus.Interface(
conn.get_object(object_path=core.Get('org.PulseAudio.Core1', 'Cards')[0]),
'org.freedesktop.DBus.Properties')
card.Set('org.PulseAudio.Core1.Card', 'ActiveProfile',
card.Get('org.PulseAudio.Core1.Card', 'ActiveProfile'))
What is the current bug behavior?
The above script throws an error:
dbus.exceptions.DBusException: org.PulseAudio.Core1.NotFoundError: /org/pulseaudio/core1/card0/profile3: No such profile.
What is the expected correct behavior?
The script should complete successfully.