diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2012-01-31 15:08:47 +0100 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-01-31 15:08:47 +0100 |
commit | 71f29271268d4d2fd38d2df3901b26a71061b6e0 (patch) | |
tree | 3f2714bb82eb95f5ccba0f8c47f0c26d9eec3811 | |
parent | 4b84df01d14fc8f4b10164833a3d25010acc9e18 (diff) | |
download | neard-71f29271268d4d2fd38d2df3901b26a71061b6e0.tar.gz neard-71f29271268d4d2fd38d2df3901b26a71061b6e0.tar.bz2 neard-71f29271268d4d2fd38d2df3901b26a71061b6e0.zip |
test: Add enable and disable adapter scripts
-rwxr-xr-x | test/disable-adapter | 23 | ||||
-rwxr-xr-x | test/enable-adapter | 23 |
2 files changed, 46 insertions, 0 deletions
diff --git a/test/disable-adapter b/test/disable-adapter new file mode 100755 index 0000000..abc6144 --- /dev/null +++ b/test/disable-adapter @@ -0,0 +1,23 @@ +#!/usr/bin/python + +import sys +import dbus + +if len(sys.argv) < 2: + print "Usage: %s <nfc device>" % (sys.argv[0]) + sys.exit(1) + +bus = dbus.SystemBus() + +manager = dbus.Interface(bus.get_object("org.neard", "/"), + "org.neard.Manager") + + +path = "/org/neard/" + sys.argv[1] +adapter = dbus.Interface(bus.get_object("org.neard", path), + "org.neard.Adapter") + +try: + adapter.SetProperty("Powered", dbus.Boolean(0)) +except dbus.DBusException, error: + print "%s: %s" % (error._dbus_error_name, error.message)
\ No newline at end of file diff --git a/test/enable-adapter b/test/enable-adapter new file mode 100755 index 0000000..d5a7e66 --- /dev/null +++ b/test/enable-adapter @@ -0,0 +1,23 @@ +#!/usr/bin/python + +import sys +import dbus + +if len(sys.argv) < 2: + print "Usage: %s <nfc device>" % (sys.argv[0]) + sys.exit(1) + +bus = dbus.SystemBus() + +manager = dbus.Interface(bus.get_object("org.neard", "/"), + "org.neard.Manager") + + +path = "/org/neard/" + sys.argv[1] +adapter = dbus.Interface(bus.get_object("org.neard", path), + "org.neard.Adapter") + +try: + adapter.SetProperty("Powered", dbus.Boolean(1)) +except dbus.DBusException, error: + print "%s: %s" % (error._dbus_error_name, error.message) |