cli: fix open by serial or bust!

parent fd081729
...@@ -35,13 +35,9 @@ class OauTest(cmd.Cmd): ...@@ -35,13 +35,9 @@ class OauTest(cmd.Cmd):
pass pass
def do_open(self, arg): def do_open(self, arg):
"""open device by serial number""" """open device by serial number."""
try: serial = bytes(arg, 'utf8') if arg else 0
serial = arg if arg else 0 fd = self.api.oau_att_open(serial)
except ValueError as e:
print('usage: open [serial]')
return
fd = self.api.oau_att_open(bytes(serial, 'utf8'))
if fd < 0: if fd < 0:
print('cannot open device {}'.format(serial)) print('cannot open device {}'.format(serial))
return return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment