示例#1
0
 def check_need_restart(self):
     output("Checking Current MCU Configuration...")
     get_cfg_cmd = mcu.CommandQueryWrapper(self._serial, GET_CFG_CMD,
                                           GET_CFG_RESPONSE)
     params = get_cfg_cmd.send()
     output_line("Done")
     if params['is_config'] or params['is_shutdown']:
         output_line("MCU needs restart: is_config=%d, is_shutdown=%d" %
                     (params['is_config'], params['is_shutdown']))
         return True
     return False
示例#2
0
 def get_mcu_config(self):
     # Iterate through backwards compatible response strings
     for response in GET_CFG_RESPONSES:
         try:
             get_cfg_cmd = mcu.CommandQueryWrapper(
                 self._serial, GET_CFG_CMD, response)
             break
         except Exception as err:
             # Raise an exception if we hit the end of the list.
             if response == GET_CFG_RESPONSES[-1]:
                 raise err
             output("Trying fallback...")
     return get_cfg_cmd.send()
 def check_need_restart(self):
     output("Checking Current MCU Configuration...")
     # Iterate through backwards compatible response strings
     for response in GET_CFG_RESPONSES:
         try:
             get_cfg_cmd = mcu.CommandQueryWrapper(self._serial,
                                                   GET_CFG_CMD, response)
             break
         except Exception as err:
             # Raise an exception if we hit the end of the list.
             if response == GET_CFG_RESPONSES[-1]:
                 raise err
             output("Trying fallback...")
     params = get_cfg_cmd.send()
     output_line("Done")
     if params['is_config'] or params['is_shutdown']:
         output_line("MCU needs restart: is_config=%d, is_shutdown=%d" %
                     (params['is_config'], params['is_shutdown']))
         return True
     return False
示例#4
0
 def __init__(self, ser):
     self.oid = SPI_OID
     self._spi_send_cmd = mcu.CommandWrapper(ser, SPI_SEND_CMD)
     self._spi_transfer_cmd = mcu.CommandQueryWrapper(
         ser, SPI_XFER_CMD, SPI_XFER_RESPONSE, self.oid)