Esempio n. 1
0
    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])
Esempio n. 2
0
    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])
Esempio n. 3
0
 def consoles_close(self):
     # Tell the logger process to stop logging
     for console in self.consoles.keys():
         logfile_name = os.path.join(self.state_dir,
                                     "console-%s.log" % console)
         cm_logger.spec_rm(logfile_name)
Esempio n. 4
0
 def consoles_close(self):
     # Tell the logger process to stop logging
     for console in self.consoles.keys():
         logfile_name = os.path.join(self.state_dir,
                                     "console-%s.log" % console)
         cm_logger.spec_rm(logfile_name)