def _enter_mode(self, mode): """ Tries to put the device into the specified mode. """ # Attempts twice but one should be sufficient. for _ in range(2): self._power_cycle() logging.debug("Going to execute:\n" + "pem" + " --interface {0}".format(self.pem_interface) + " --port {0}".format(self.pem_port) + " --playback {0}".format(mode["sequence"])) pem_main(["pem", "--interface", self.pem_interface, "--port", self.pem_port, "--playback", mode["sequence"]]) logging.info("Checking for device in mode \"{0}\" ." .format(mode["name"])) if self._wait_for_mode(mode=mode): logging.info("Found device in mode \"{0}\" ." .format(mode["name"])) return True else: logging.info("Device in mode \"{0}\" was not found." .format(mode["name"])) logging.critical("Unable to get device {0} in mode \"{1}.\"" .format(self.dev_id, mode["name"])) return False
def call_pem(exceptions): try: pem_main([ "pem", "--interface", self.interface, "--port", self.emulator_path, "--playback", _file ]) except Exception as err: exceptions.put(err)
def call_pem(exceptions): try: pem_main([ "pem", "--interface", self.pem_interface, "--port", self.pem_port, "--playback", keystrokes ]) except Exception, err: exceptions.put(err)
def call_pem(exceptions): try: pem_main( [ "pem", "--interface", self.pem_interface, "--port", self.pem_port, "--playback", keystrokes ]) except Exception as err: exceptions.put(err)