def consoles_open(self): """ Open all serial ports assigned to the target """ # Tell the logger process to start logging for console_id in self.consoles.keys(): logfile_name = os.path.join(self.state_dir, "console-%s.log" % console_id) cm_logger.spec_add(logfile_name, self.consoles[console_id])
def console_takeover(self, console_id = None): """ Indicate the console serial background port reading thread that it has to stop reading from the port. >>> with object.console_takeover(CONSOLEID) as descr, log: >>> # ... operate the descr serial object and log file When the with statement is left, the background reader takes control of the port again. """ if console_id == None: console_id = self.console_default logfile_name = os.path.join(self.state_dir, "console-%s.log" % console_id) try: cm_logger.spec_rm(logfile_name) yield self.consoles[console_id], logfile_name finally: cm_logger.spec_add(logfile_name, self.consoles[console_id])
def console_takeover(self, console_id=None): """ Indicate the console serial background port reading thread that it has to stop reading from the port. >>> with object.console_takeover(CONSOLEID) as descr, log: >>> # ... operate the descr serial object and log file When the with statement is left, the background reader takes control of the port again. """ if console_id == None: console_id = self.console_default logfile_name = os.path.join(self.state_dir, "console-%s.log" % console_id) try: cm_logger.spec_rm(logfile_name) yield self.consoles[console_id], logfile_name finally: cm_logger.spec_add(logfile_name, self.consoles[console_id])