Discussion:
[pulseaudio-discuss] About PulseAudio DBUS service
Zheng, Huan
2011-06-06 23:03:24 UTC
Permalink
Hi,
I want to use the server look up service of PulseAudio to find the dbus-socket address, below is the *correct* python script, I copied below just want to let you know what exactly I want

bus = dbus.SessionBus()
server_lookup = bus.get_object("org.PulseAudio1", "/org/pulseaudio/server_lookup1")
address = server_lookup.Get("org.PulseAudio.ServerLookup1", "Address", dbus_interface="org.freedesktop.DBus.Properties")

But I'm finding an issue on my system.
After system boot up, I can not access org.PulseAudio1 service, error "org.freedesktop.DBus.Error.ServiceUnknown" is reported.
This could be proved by using the following command:
dbus-send --session --print-reply --reply-timeout=2000 --type=method_call --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames

the output is
method return sender=org.freedesktop.DBus -> dest=:1.0 reply_serial=2
array [
string "org.freedesktop.DBus"
string ":1.0"
]
Apparently, org.PulseAudio1 service is not available.

Here comes the weird thing, if I kill pulseaudio and restart it. org.PulseAudio1 service becomes available, and I could get address using previous python script.
The output is:
method return sender=org.freedesktop.DBus -> dest=:1.2 reply_serial=2
array [
string "org.freedesktop.DBus"
string "org.freedesktop.ReserveDevice1.Audio0"
string "org.pulseaudio.Server"
string "org.PulseAudio1"
string ":1.1"
string ":1.2"
]

FYI:
1, When system boot up, pulseaudio start up is invoked in XDG autostart folder.
2, The log indicates "D: main.c: Got org.PulseAudio1!" "D: main.c: Got org.pulseaudio.Server!", which means, register_dbus_name(c, DBUS_BUS_SESSION, "org.PulseAudio1") and register_dbus_name(c, conf->system_instance ? DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, "org.pulseaudio.Server") all succeeded.
3, before pulseaudio start, dbus-daemon already started. There's a "dbus-daemon --fork --session --print-pid 9 --print-address 11" running in system which has a pid number less than pulseaudio

Question: the root cause on the surface is that if we start pulseaudio after system fully boot up, then there's no problem. But what's the real root cause?
And normal user has no capability to restart pulse. I need to make this service available when system boot up.

If you reached here, thanks a lot for your patience, please give me some hints.
Thanks!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20110607/ba6e8fdc/attachment.htm>
Colin Guthrie
2011-06-07 11:35:30 UTC
Permalink
Hiya,

Just so you are aware, the DBus introspection support is still only in
git master. While it will be part of the upcoming 1.0 release, it will
still not be advertised as "stable" and will be subject to changes as
new releases are made. For this reason, you should be aware that you may
need to update code as we move forward.
Post by Zheng, Huan
I want to use the server look up service of PulseAudio to find the
dbus-socket address, below is the **correct** python script, I copied
below just want to let you know what exactly I want
...
Post by Zheng, Huan
After system boot up, I can not access org.PulseAudio1 service, error
?org.freedesktop./DBus/.Error.ServiceUnknown? is reported.
dbus-send --session --print-reply --reply-timeout=2000
--type=method_call --dest=org.freedesktop.DBus /org/freedesktop/DBus
org.freedesktop.DBus.ListNames
the output is
method return sender=org.freedesktop.DBus -> dest=:1.0 reply_serial=2
array [
string "org.freedesktop.DBus"
string ":1.0"
]
Apparently, org.PulseAudio1 service is not available.
Interesting.
Post by Zheng, Huan
Here comes the weird thing, if I kill pulseaudio and restart it.
org.PulseAudio1 service becomes available, and I could get address using
previous python script.
method return sender=org.freedesktop.DBus -> dest=:1.2 reply_serial=2
array [
string "org.freedesktop.DBus"
string "org.freedesktop.ReserveDevice1.Audio0"
string "org.pulseaudio.Server"
string "org.PulseAudio1"
string ":1.1"
string ":1.2"
]
1, When system boot up, pulseaudio start up is invoked in XDG autostart folder.
2, The log indicates ?D: main.c: Got org.PulseAudio1!? ?D: main.c: Got
org.pulseaudio.Server!?, which means, register_dbus_name(c,
DBUS_BUS_SESSION, "org.PulseAudio1") and register_dbus_name(c,
conf->system_instance ? DBUS_BUS_SYSTEM : DBUS_BUS_SESSION,
"org.pulseaudio.Server") all succeeded.
3, before pulseaudio start, dbus-daemon already started. There?s a
?dbus-daemon --fork --session --print-pid 9 --print-address 11? running
in system which has a pid number less than pulseaudio
Just because the pid number is less, it doesn't mean it was fully
started and ready by the time PA tried to use it. That said, the fact
that the above messages were printed in 2) above seem to suggest that
things at least started up OK.
Post by Zheng, Huan
Question: the root cause on the surface is that if we start pulseaudio
after system fully boot up, then there?s no problem. But what?s the real
root cause?
And normal user has no capability to restart pulse. I need to make this
service available when system boot up.
If you reached here, thanks a lot for your patience, please give me some hints.
:)

I'm not 100% sure as I'm not familiar with the DBus code. Hopefully Tanu
can answer with more authority when he gets a moment.

Cheers

Col
--
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
Mageia Contributor [http://www.mageia.org/]
PulseAudio Hacker [http://www.pulseaudio.org/]
Trac Hacker [http://trac.edgewall.org/]
Tanu Kaskinen
2011-06-07 12:17:45 UTC
Permalink
Post by Zheng, Huan
If you reached here, thanks a lot for your patience, please give me some hints.
All I can think of is that the session bus that Pulseaudio connects to
at startup is not the same bus that is used for the actual user session.
I don't know any very easy way to check that - I'd probably hack
Pulseaudio code so that it prints the address of the session bus that it
connected to, and comparing that against the address of the real session
bus.
--
Tanu
Loading...