[opensuse] qdbus query
I have a couple of queries about qdbus. Why does qdbus need an available X session to run? I noticed this on a remote ssh session to my home box. craig@pablo:~> qdbus org.ktorrent.ktorrent /KTorrent \ org.ktorrent.KTorrent.torrents Could not connect to D-Bus server: org.freedesktop.DBus.Error.Spawn.ExecFailed: dbus-launch failed to autolaunch D-Bus session: Autolaunch error: X11 initialization failed. This is resolved if I ssh -X but it still strikes me as odd. Then the second problem that I have is that I can't seem to work out how to connect to another existing session (kde session logged in as myself this morning). craig@pablo:~> qdbus org.ktorrent.ktorrent /KTorrent \ org.ktorrent.KTorrent.torrents Service 'org.ktorrent.ktorrent' does not exist. But I know that it does exist - I just can't work our how to use the other session - a simple invocation of qdbus gives me this: craig@pablo:~> qdbus :1.1 org.freedesktop.DBus ^^ presumable the above session is the one I need to engage? Will I be able to do it without being root for a start? Thanks for any replies. Craig -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Monday 07 April 2008, Craig Millar said:
I have a couple of queries about qdbus.
Why does qdbus need an available X session to run? I noticed this on a remote ssh session to my home box.
craig@pablo:~> qdbus org.ktorrent.ktorrent /KTorrent \ org.ktorrent.KTorrent.torrents Could not connect to D-Bus server: org.freedesktop.DBus.Error.Spawn.ExecFailed: dbus-launch failed to autolaunch D-Bus session: Autolaunch error: X11 initialization failed.
This is resolved if I ssh -X but it still strikes me as odd. Then the second problem that I have is that I can't seem to work out how to connect to another existing session (kde session logged in as myself this morning).
It doesn't need absolutely need an X session. It first looks in DBUS_SESSION_BUS_ADDRESS. If this isn't set it will try to run dbus-launch --autostart to determine the address by querying another X window... which is session dependent.
craig@pablo:~> qdbus org.ktorrent.ktorrent /KTorrent \ org.ktorrent.KTorrent.torrents Service 'org.ktorrent.ktorrent' does not exist.
But I know that it does exist - I just can't work our how to use the other session - a simple invocation of qdbus gives me this:
craig@pablo:~> qdbus
:1.1
You're talking on the wrong bus. KTorrent doesn't exist on the bus in DBUS_SESSION_BUS_ADDRESS then. You can copy the value of that from another environment then you should be talking on the right bus. I guess you are trying to remotely control a ktorrent instance over an SSH session. The first time it didn't work because there was no bus address and no way to get one, the second time you got the address of the session bus of your local session. You could try saving the value of DBUS_SESSION_BUS_ADDRESS when you start ktorrent to a file and then setting it after you ssh in. Let us know how you get on, with dcop all this was easy^Waround for years and well known. Will -- Desktop Engineer KDE Team -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 07/04/08 16:02 +0200, Will Stephenson wrote:
On Monday 07 April 2008, Craig Millar said:
Why does qdbus need an available X session to run? I noticed this on a remote ssh session to my home box.
It doesn't need absolutely need an X session. It first looks in DBUS_SESSION_BUS_ADDRESS. If this isn't set it will try to run dbus-launch --autostart to determine the address by querying another X window... which is session dependent.
Ok - thanks for explaining that - documentation is a little thin on the ground.
You're talking on the wrong bus. KTorrent doesn't exist on the bus in DBUS_SESSION_BUS_ADDRESS then.
You can copy the value of that from another environment then you should be talking on the right bus.
I guess you are trying to remotely control a ktorrent instance over an SSH session. The first time it didn't work because there was no bus address and no way to get one, the second time you got the address of the session bus of your local session. You could try saving the value of DBUS_SESSION_BUS_ADDRESS when you start ktorrent to a file and then setting it after you ssh in.
Ok - that makes perfect sense - but is there any way I can determine the DBUS_SESSION_BUS_ADDRESS of the existing session on the remote machine? It kind of defeats the object of being able to do stuff remotely if I have to work out what that may be before I leave the computer. ;)
Let us know how you get on, with dcop all this was easy^Waround for years and well known.
Making progress. Slowly! It seems the docs are lagging way behind - I did find a small blog entry [1] about using qdbus that got me started, other than that google results are pretty sparse. But I was encouraged by the apparent ease of use in the early stages - it's not too disimilar to dcop in terms of usage, at least as far as I can tell.
Will
Thanks again, Craig [1]. http://www.kuliniewicz.org/blog/archives/2007/12/28/qdbus/ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Monday 07 April 2008, Craig Millar said:
Ok - that makes perfect sense - but is there any way I can determine the DBUS_SESSION_BUS_ADDRESS of the existing session on the remote machine? It kind of defeats the object of being able to do stuff remotely if I have to work out what that may be before I leave the computer. ;)
You could look for DBUS_SESSION_BUS_ADDRESS in /proc/PID/environ for processes in the session you want to talk to. This is not guaranteed to be there though.. I asked Thiago Macieira about it and he says this is a gap in dbus' functionality in general since there is no good way to export a bus address from a session.
Let us know how you get on, with dcop all this was easy^Waround for years and well known.
Making progress. Slowly! It seems the docs are lagging way behind - I did find a small blog entry [1] about using qdbus that got me started, other than that google results are pretty sparse. But I was encouraged by the apparent ease of use in the early stages - it's not too disimilar to dcop in terms of usage, at least as far as I can tell.
Consider registering on techbase.kde.org and writing a HOWTO article there then. Stardom and Fame await. Will -- Desktop Engineer KDE Team -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 07/04/08 17:21 +0200, Will Stephenson wrote:
You could look for DBUS_SESSION_BUS_ADDRESS in /proc/PID/environ for processes in the session you want to talk to. This is not guaranteed to be there though.. I asked Thiago Macieira about it and he says this is a gap in dbus' functionality in general since there is no good way to export a bus address from a session.
Brilliant - that absolutely nailed it - got DBUS_SESSION_BUS_ADDRESS out of proc, exported it, and suddenly I could see all the programs from my remote session. Not exactly the most straightforward but it seems to be at least doable. :)
Consider registering on techbase.kde.org and writing a HOWTO article there then. Stardom and Fame await.
I will certainly consider putting something together if I feel it is good enough to go up. Thanks for your help. Craig -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (2)
-
Craig Millar
-
Will Stephenson