Attachment 'scan.py'

Download

   1 import sys
   2 import dbus
   3 
   4 def main():
   5     name = "org.freedesktop.DBus"
   6     bus = dbus.bus.BusConnection("tcp:host=192.168.2.4,port=6667")
   7     p = bus.get_object(name, "/" + name.replace(".", "/"))
   8     i = dbus.Interface(p, dbus_interface=name)
   9 
  10     for s in i.ListNames():
  11         print
  12         if str(s).find(":") != -1:
  13             print "skipped %s." % s
  14             continue
  15         if str(s).find("-") != -1:
  16             print "skipped %s." % s
  17             continue
  18         else:
  19             scan(str(s))
  20 
  21 def scan(name):
  22     print "= %s =" % name
  23     bus = dbus.bus.BusConnection("tcp:host=192.168.2.4,port=6667")
  24     p = bus.get_object(name, "/" + name.replace(".", "/"))
  25     i = dbus.Interface(p, dbus_interface="org.freedesktop.DBus")
  26 
  27     print "== functions =="
  28     try:
  29         print p.Introspect()
  30     except:
  31         print "Introspect() failed."
  32 
  33     print "== objects =="
  34     try:
  35         for s in i.ListNames():
  36             print s
  37     except:
  38         print "ListNames() failed."
  39 
  40     print "== properties =="
  41     i = dbus.Interface(p, dbus_interface="org.freedesktop.DBus.Properties")
  42     try:
  43         results = i.GetAll()
  44         for s in results: 
  45             print s
  46     except:
  47         print "GetAll() failed."
  48 
  49 if __name__ == "__main__":
  50     main()

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view | diff] (2012-11-06 16:54:29, 1.2 KB) [[attachment:scan.py]]
  • [get | view | diff] (2012-11-06 16:58:26, 0.4 KB) [[attachment:toyota-cmd.py]]
  • [get | view | diff] (2012-11-06 12:56:14, 26.7 KB) [[attachment:toyota-dbus.txt]]
  • [get | view | diff] (2012-11-06 17:08:29, 8.3 KB) [[attachment:toyota.log]]
  • [get | view | diff] (2012-11-06 12:55:59, 1.2 KB) [[attachment:toyota.py]]
 All files | Selected Files: delete move to page
Normal Sort Sort + uniq Sort + uniq + count

You are not allowed to attach a file to this page.