def open(self): with self.mylock: if not self.isOpen(): if self.olimex_sn: self.port = ttyusb.find_tty_acm_sn( '0483', '5740', self.olimex_sn) else: olimex_ports = ttyusb.find_tty_acm('0483', '5740') if len(olimex_ports) > 1: raise 'more than one olimex connected'\ 'but serial number is not specified' self.port = olimex_ports[0] super(Olimex, self).open() return self.port
def find_olimex_port(self): """ Find the Olimex serial port that is connected""" self.olimex_port = ttyusb.find_tty_acm_sn('0483', '5740', olimex_sn) return self.olimex_port