def test_varstr_combinations(self): """Verify various combinations of var strings are properly duplicated across the 2 eeprom sectors """ eeprom = FtdiEeprom() eeprom.enable_mirroring(True) eeprom.open(self.url, ignore=True) # manu + prod str eeprom.erase() eeprom.set_manufacturer_name(self.TEST_MANU_NAME) eeprom.set_product_name(self.TEST_PROD_NAME) self._check_for_mirrored_eeprom_contents(eeprom) # manu + sn str eeprom.erase() eeprom.set_manufacturer_name(self.TEST_MANU_NAME) eeprom.set_serial_number(self.TEST_SN) self._check_for_mirrored_eeprom_contents(eeprom) # prod + sn str eeprom.erase() eeprom.set_manufacturer_name(self.TEST_PROD_NAME) eeprom.set_serial_number(self.TEST_SN) self._check_for_mirrored_eeprom_contents(eeprom) # manu + prod + sn str eeprom.erase() eeprom.set_manufacturer_name(self.TEST_MANU_NAME) eeprom.set_manufacturer_name(self.TEST_PROD_NAME) eeprom.set_serial_number(self.TEST_SN) self._check_for_mirrored_eeprom_contents(eeprom)
def test_mirror_product(self): """Verify product string is properly duplicated across the 2 eeprom sectors """ eeprom = FtdiEeprom() eeprom.enable_mirroring(True) eeprom.open(self.url, ignore=True) eeprom.erase() eeprom.set_product_name(self.TEST_PROD_NAME) self._check_for_mirrored_eeprom_contents(eeprom)
def test_mirror_manufacturer(self): """Verify manufacturer string is properly duplicated across the 2 eeprom sectors """ eeprom = FtdiEeprom() eeprom.enable_mirroring(True) eeprom.open(self.url, ignore=True) eeprom.erase() eeprom.set_manufacturer_name(self.TEST_MANU_NAME) self._check_for_mirrored_eeprom_contents(eeprom)
def test_mirror_serial(self): """Verify serial string is properly duplicated across the 2 eeprom sectors """ eeprom = FtdiEeprom() eeprom.enable_mirroring(True) eeprom.open(self.url, ignore=True) eeprom.erase() eeprom.set_serial_number(self.TEST_SN) self._check_for_mirrored_eeprom_contents(eeprom)
def test_mirror_properties(self): """Check FtdiEeprom properties are accurate for a device that can mirror """ # properties should work regardless of if the mirror option is set # or not eeprom = FtdiEeprom() eeprom.open(self.url, ignore=True) self.assertTrue(eeprom.has_mirroring) self.assertEqual(eeprom.size // 2, eeprom.mirror_sector) eeprom.close() mirrored_eeprom = FtdiEeprom() mirrored_eeprom.enable_mirroring(True) mirrored_eeprom.open(self.url, ignore=True) self.assertTrue(mirrored_eeprom.has_mirroring) self.assertEqual(mirrored_eeprom.size // 2, mirrored_eeprom.mirror_sector) mirrored_eeprom.close()
def test_mirror_properties(self): """Check FtdiEeprom properties are accurate for a device that can not mirror. """ # properties should work regardless of if the mirror option is set # or not eeprom = FtdiEeprom() eeprom.open(self.url, ignore=True) self.assertFalse(eeprom.has_mirroring) with self.assertRaises(FtdiError): eeprom.mirror_sector eeprom.close() # even if mirroring is enabled, should still stay false mirrored_eeprom = FtdiEeprom() mirrored_eeprom.enable_mirroring(True) mirrored_eeprom.open(self.url, ignore=True) self.assertFalse(mirrored_eeprom.has_mirroring) with self.assertRaises(FtdiError): eeprom.mirror_sector mirrored_eeprom.close()