Exemplo n.º 1
0
 def first(*args, **kwargs):
     while True:
         try:
             try:
                 com = serial_ports()[0]
                 return Device.USB(com, *args, **kwargs)
             except IndexError:
                 return Device.discover(*args, **kwargs)[0]
         except IndexError:
             continue
Exemplo n.º 2
0
    def USB(com=None, *args, **kwargs):
        if com is None:
            while True:
                try:
                    com = serial_ports()[0]
                except IndexError:
                    continue
                else:
                    break

        return Device(com, *args, **kwargs)