parser.add_argument("command", nargs=argparse.REMAINDER,
help="a command to be executed with the device being" +
"activated for the duration of the execution")
parser.add_argument("command", nargs=argparse.REMAINDER,
help="a command to be executed with the device being" +
"activated for the duration of the execution")
- proxy = onoff.dbusutils.get_dbus_proxy(args)
- if args.command:
+ if args.list:
+ bus = onoff.dbusutils.get_dbus(args)
+ for elem in onoff.dbusutils.list_objects(bus, args.busname):
+ print(elem)
+ elif args.command:
+ proxy = onoff.dbusutils.get_dbus_proxy(args)
st, fd = proxy.activatefd()
fd = fd.take()
os.dup2(fd, 254)
os.close(fd)
if st != ST_ACTIVE:
print("state is %d waiting for signal" % st)
st, fd = proxy.activatefd()
fd = fd.take()
os.dup2(fd, 254)
os.close(fd)
if st != ST_ACTIVE:
print("state is %d waiting for signal" % st)
- st = wait_for_signal(proxy, "changestate")
- print("new state is %d" % st)
+ wait_for_signal(proxy, "changestate", ST_ACTIVE)
+ print("new state is actived")
- st = wait_for_signal(proxy, "changestate")
- print("new state is %d" % st)
+ wait_for_signal(proxy, "changestate", ST_ACTIVE)
+ print("new state is active")