def __init__(self, slot_idx, **kwargs): super().__init__(slot_idx, **kwargs) self.log = get_logger("sim_db-{}".format(slot_idx)) self.device_info = { 'pid': to_native_str(self.__class__.pids[0]), 'serial': to_native_str("todo:serial-here"), 'rev': to_native_str("1"), 'eeprom_version': to_native_str('0') } self.rev = int(self.device_info['rev']) self.log.trace("This is a rev: {}".format(chr(65 + self.rev))) self._make_extra_methods()
def __init__(self, slot_idx, **kwargs): self.log = get_logger('dboardManager') self.slot_idx = slot_idx if 'eeprom_md' not in kwargs: self.log.debug("No EEPROM metadata given!") # In C++, we can only handle dicts if all the values are of the # same type. So we must convert them all to strings here: self.device_info = { key: to_native_str(kwargs.get('eeprom_md', {}).get(key, 'n/a')) for key in ('pid', 'serial', 'rev', 'eeprom_version') } self.log.trace("Dboard device info: `{}'".format(self.device_info)) self._spi_nodes = self._init_spi_nodes(kwargs.get('spi_nodes', []), self.spi_chipselect) self.log.debug("spidev device node map: {}".format(self._spi_nodes))
def __init__(self, slot_idx, **kwargs): self.log = get_logger('dboardManager') self.slot_idx = slot_idx if 'eeprom_md' not in kwargs: self.log.debug("No EEPROM metadata given!") # In C++, we can only handle dicts if all the values are of the # same type. So we must convert them all to strings here: self.device_info = { key: to_native_str(kwargs.get('eeprom_md', {}).get(key, 'n/a')) for key in ('pid', 'serial', 'rev', 'eeprom_version') } self.log.trace("Dboard device info: `{}'".format(self.device_info)) self._spi_nodes = self._init_spi_nodes( kwargs.get('spi_nodes', []), self.spi_chipselect ) self.log.debug("spidev device node map: {}".format(self._spi_nodes))