Thank you. Now it works using the following sample code:
-----------------------------------------------------
#!/usr/bin/env python
import dbus
import gobject
import dbus.mainloop.glib
def jockey_reply_handler(r):
global failed
global result
failed = False
result = r
print ("Replied: %s" % r)
loop.quit()
def jockey_error_handler(e):
global failed
global result
failed = True
result = e
print ("Error: %s" % e)
loop.quit()
def call_jockey():
callresult =
jockeyloader.search_driver("printer_deviceid:MFG:%s;MDL:%s;DES:%s;CMD:%s;" % \
(mfg, mdl, description, \
','.join (commandsets)),
reply_handler=jockey_reply_handler,
error_handler=jockey_error_handler,
timeout=99999)
print callresult
print ("Jockey called.")
return False
mfg = "Samsung"
mdl = "ML-1610"
description = ""
commandsets = [ "GDI" ]
jockeyloader = None
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SessionBus()
try:
print ("Requesting drivers for device
\"printer_deviceid:MFG:%s;MDL:%s;DES:%s;CMD:%s;\"" % \
(mfg, mdl, description, \
','.join (commandsets)))
obj = bus.get_object("com.ubuntu.DeviceDriver", "/GUI")
jockeyloader = dbus.Interface(obj, "com.ubuntu.DeviceDriver")
global result
global failed
result = 0
failed = False
gobject.timeout_add(100, call_jockey)
print ("Starting loop to wait for Jockey.")
loop = gobject.MainLoop()
loop.run()
print failed
print result
print ("Done.")
except dbus.DBusException, e:
print ("D-Bus Error: %s" % e)
jockeyloader = None
-----------------------------------------------------
--
Asynchronous access to D-Bus API method "search_driver()" from a Python program
does not work
https://bugs.launchpad.net/bugs/269169
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs