diff --git a/test/simple-agent b/test/simple-agent index f94c1572..7f088fee 100755 --- a/test/simple-agent +++ b/test/simple-agent @@ -20,42 +20,20 @@ class Agent(dbus.service.Object): print("Release") mainloop.quit() - def input_passphrase(self): - response = {} - - if not self.passphrase: - print("Service credentials requested, type cancel to cancel") - args = input('Answer: ') - - for arg in args.split(): - if arg.startswith("cancel"): - response["Error"] = arg - - if arg.startswith("Passphrase="): - passphrase = arg.replace("Passphrase=", "", 1) - response["Passphrase"] = passphrase - else: - if self.passphrase: - response["Passphrase"] = self.passphrase - - return response - @dbus.service.method("net.connman.iwd.Agent", in_signature='o', out_signature='s') def RequestPassphrase(self, path): print("RequestPassphrase (%s)" % (path)) - response = {} - response.update(self.input_passphrase()) + print("Service credentials requested, type cancel to cancel") + passphrase = raw_input('Answer: ') - if response.has_key("Error"): - if response["Error"] == "cancel": - raise Canceled("canceled") - return + if not passphrase or passphrase == 'cancel': + raise Canceled("canceled") - print("returning (%s)" % (response["Passphrase"])) - return response["Passphrase"] + print("returning (%s)" % (passphrase)) + return passphrase @dbus.service.method("net.connman.iwd.Agent", in_signature='', out_signature='')