Does DBus Lie?
Arigead
captain.deadly at gmail.com
Tue Aug 24 01:45:27 PDT 2010
Hello all,
I'm a bit confused by what DBus is telling me when I try to listen
to the System bus. I'm trying to listen to gpsd which "posts" a location
fix at regular intervals. If I look at the system bus with:
dbus-monitor --system
I can see the info which I'm looking for. I'm inside an office at
present so the actual gps chipset has no fix so this data don't tell you
much about where I am but the info is there for org.gpsd:
signal sender=:1.11 -> dest=(null destination) serial=3849
path=/org/gpsd; interface=org.gpsd; member=fix
double 1.17539e+09
int32 1
double nan
double 180
double 0
double nan
double -6.37813e+06
double nan
double 0
double nan
double 0
double nan
double 0
double nan
string "/dev/ttyUSB0"
Now to capture the above I decided I'd write a bit of python for a start
but I'll probably have to move it to Java eventually. So my code tries
to get a handle on the org.gpsd Interface:
#!/usr/bin/python
import dbus
bus = dbus.SystemBus()
proxy = bus.get_object('org.gpsd', '/org/gpsd')
Those four lines are all I have at the moment and they give me an error
which I don't really understand:
./gpsd-dbus.py
Traceback (most recent call last):
File "./gpsd-dbus.py", line 7, in <module>
proxy = bus.get_object('org.gpsd', '/org/gpsd')
File "/usr/lib/pymodules/python2.6/dbus/bus.py", line 244, in get_object
follow_name_owner_changes=follow_name_owner_changes)
File "/usr/lib/pymodules/python2.6/dbus/proxies.py", line 241, in __init__
self._named_service = conn.activate_name_owner(bus_name)
File "/usr/lib/pymodules/python2.6/dbus/bus.py", line 183, in
activate_name_owner
self.start_service_by_name(bus_name)
File "/usr/lib/pymodules/python2.6/dbus/bus.py", line 281, in
start_service_by_name
'su', (bus_name, flags)))
File "/usr/lib/pymodules/python2.6/dbus/connection.py", line 620, in
call_blocking
message, timeout)
dbus.exceptions.DBusException:
org.freedesktop.DBus.Error.ServiceUnknown: The name org.gpsd was not
provided by any .service files
That error suggests that the org.gpsd don't exist but according to
dbus-monitor it does exist. I thought that it might be a security policy
as I've never messed about on the System bus before, only the session.
So I created a poicy in /etc/dbus-1. This don't make any difference:
cat /etc/dbus-1/system-local.conf
<busconfig>
<policy user="user">
<allow send_destination="*" eavesdrop="true"/>
<allow receive_sender="*" eavesdrop="true"/>
</policy>
</busconfig>
I know you're all busy as but I'd really appreciate any hint which you
might be able to offer me on this little problem.
More information about the dbus
mailing list