cli: fix open by serial or bust!

parent fd081729
......@@ -35,13 +35,9 @@ class OauTest(cmd.Cmd):
pass
def do_open(self, arg):
"""open device by serial number"""
try:
serial = arg if arg else 0
except ValueError as e:
print('usage: open [serial]')
return
fd = self.api.oau_att_open(bytes(serial, 'utf8'))
"""open device by serial number."""
serial = bytes(arg, 'utf8') if arg else 0
fd = self.api.oau_att_open(serial)
if fd < 0:
print('cannot open device {}'.format(serial))
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