Talk:D-Bus

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(New page: if i use the following python code: <pre> #!/usr/bin/env python import dbus bus = dbus.SessionBus() proxy = bus.get_object("org.freesmartphone.ogsmd","/org/freesmartphone/GSM/Devi$ interf...)
 
 
(One intermediate revision by one user not shown)
Line 5: Line 5:
 
import dbus
 
import dbus
 
bus = dbus.SessionBus()
 
bus = dbus.SessionBus()
proxy = bus.get_object("org.freesmartphone.ogsmd","/org/freesmartphone/GSM/Devi$
+
proxy = bus.get_object("org.freesmartphone.ogsmd","/org/freesmartphone/GSM/Device")
 
interface = dbus.Interface(proxy, "org.freesmartphone.GSM.Call")
 
interface = dbus.Interface(proxy, "org.freesmartphone.GSM.Call")
 
interface.Initiate("12345","voice")
 
interface.Initiate("12345","voice")
Line 12: Line 12:
 
it get the following error
 
it get the following error
 
<pre>
 
<pre>
root@om-gta02:~# dbus-launch python my_dialer.py  
+
root@om-gta02:~# dbus-launch python my_dialer.py
 
Traceback (most recent call last):
 
Traceback (most recent call last):
  File "my_dialer.py", line 4, in <module>
+
File "my_dialer.py", line 4, in <module>
    proxy = bus.get_object("org.freesmartphone.ogsmd","/org/freesmartphone/GSM/Device")
+
proxy = bus.get_object("org.freesmartphone.ogsmd","/org/freesmartphone/GSM/Device")
  File "/usr/lib/python2.5/site-packages/dbus/bus.py", line 244, in get_object
+
File "/usr/lib/python2.5/site-packages/dbus/bus.py", line 244, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
+
follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python2.5/site-packages/dbus/proxies.py", line 241, in __init__
+
File "/usr/lib/python2.5/site-packages/dbus/proxies.py", line 241, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
+
self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python2.5/site-packages/dbus/bus.py", line 183, in activate_name_owner
+
File "/usr/lib/python2.5/site-packages/dbus/bus.py", line 183, in activate_name_owner
    self.start_service_by_name(bus_name)
+
self.start_service_by_name(bus_name)
  File "/usr/lib/python2.5/site-packages/dbus/bus.py", line 281, in start_service_by_name
+
File "/usr/lib/python2.5/site-packages/dbus/bus.py", line 281, in start_service_by_name
    'su', (bus_name, flags)))
+
'su', (bus_name, flags)))
  File "/usr/lib/python2.5/site-packages/dbus/connection.py", line 622, in call_blocking
+
File "/usr/lib/python2.5/site-packages/dbus/connection.py", line 622, in call_blocking
    message, timeout)
+
message, timeout)
 
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freesmartphone.ogsmd was not provided by any .service files
 
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freesmartphone.ogsmd was not provided by any .service files
 
</pre>
 
</pre>
 +
 +
replace bus = dbus.SessionBus() by bus = dbus.SystemBus() and it should work.
 +
It's now fixed on the main page
 +
thanks for spotting this(I thought it was me)

Latest revision as of 23:28, 1 March 2009

if i use the following python code:

#!/usr/bin/env python
import dbus
bus = dbus.SessionBus()
proxy = bus.get_object("org.freesmartphone.ogsmd","/org/freesmartphone/GSM/Device")
interface = dbus.Interface(proxy, "org.freesmartphone.GSM.Call")
interface.Initiate("12345","voice")

it get the following error

root@om-gta02:~# dbus-launch python my_dialer.py
Traceback (most recent call last):
File "my_dialer.py", line 4, in <module>
proxy = bus.get_object("org.freesmartphone.ogsmd","/org/freesmartphone/GSM/Device")
File "/usr/lib/python2.5/site-packages/dbus/bus.py", line 244, in get_object
follow_name_owner_changes=follow_name_owner_changes)
File "/usr/lib/python2.5/site-packages/dbus/proxies.py", line 241, in __init__
self._named_service = conn.activate_name_owner(bus_name)
File "/usr/lib/python2.5/site-packages/dbus/bus.py", line 183, in activate_name_owner
self.start_service_by_name(bus_name)
File "/usr/lib/python2.5/site-packages/dbus/bus.py", line 281, in start_service_by_name
'su', (bus_name, flags)))
File "/usr/lib/python2.5/site-packages/dbus/connection.py", line 622, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freesmartphone.ogsmd was not provided by any .service files

replace bus = dbus.SessionBus() by bus = dbus.SystemBus() and it should work. It's now fixed on the main page thanks for spotting this(I thought it was me)

Personal tools

if i use the following python code:

#!/usr/bin/env python
import dbus
bus = dbus.SessionBus()
proxy = bus.get_object("org.freesmartphone.ogsmd","/org/freesmartphone/GSM/Devi$
interface = dbus.Interface(proxy, "org.freesmartphone.GSM.Call")
interface.Initiate("12345","voice")

it get the following error

root@om-gta02:~# dbus-launch python my_dialer.py 
Traceback (most recent call last):
  File "my_dialer.py", line 4, in <module>
    proxy = bus.get_object("org.freesmartphone.ogsmd","/org/freesmartphone/GSM/Device")
  File "/usr/lib/python2.5/site-packages/dbus/bus.py", line 244, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python2.5/site-packages/dbus/proxies.py", line 241, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python2.5/site-packages/dbus/bus.py", line 183, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python2.5/site-packages/dbus/bus.py", line 281, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python2.5/site-packages/dbus/connection.py", line 622, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freesmartphone.ogsmd was not provided by any .service files