From a2082df41053cd85d5415ca490561b1f498256ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Czekan=CC=81ski?= Date: Tue, 10 Sep 2024 22:57:14 +0200 Subject: [PATCH 01/11] VW MQB: Added unittests for CRC calculation Some of the messages are either missing fields that causes serialization to skip bits or CRC/BZ fields aren't picked up by packers leading to invalid values. --- opendbc/can/tests/test_checksums.py | 405 ++++++++++++++++++++++++++++ 1 file changed, 405 insertions(+) diff --git a/opendbc/can/tests/test_checksums.py b/opendbc/can/tests/test_checksums.py index e584ba30a5..6e9109e863 100644 --- a/opendbc/can/tests/test_checksums.py +++ b/opendbc/can/tests/test_checksums.py @@ -1,3 +1,5 @@ +import copy +import pytest from opendbc.can.parser import CANParser from opendbc.can.packer import CANPacker @@ -31,3 +33,406 @@ def test_honda_checksum(self): assert parser.vl['LKAS_HUD']['CHECKSUM'] == std assert parser.vl['LKAS_HUD_A']['CHECKSUM'] == ext + + def verify_mqb_crc(self, subtests, msg_name: str, msg_addr: int, test_messages: list[int], crc_field: str = 'CHECKSUM', counter_field: str = 'COUNTER'): + """Validates checksum calculation for each message provided""" + dbc_file = "vw_mqb_2010" + parser = CANParser(dbc_file, [(msg_name, 0)], 0) + packer = CANPacker(dbc_file) + + if len(test_messages) == 0: + pytest.skip('No input data given') # TODO: Remove eventually + + assert len(test_messages) == 16 # All counter values must be tested + + for data in test_messages: + expected_msg = (msg_addr, data, 0) + + # Parse known valid message from logs + parser.update_strings([0, [expected_msg]]) + expected = copy.deepcopy(parser.vl[msg_name]) + + # Clear CHECKSUM to make sure packer recalculates it + modified = copy.deepcopy(expected) + modified.pop(crc_field, None) + + # Serialize message + modified_msg = packer.make_can_msg(msg_name, 0, modified) + + assert modified_msg[2] == expected_msg[2] + + # And parse it + parser.update_strings([0, [modified_msg]]) + tested = parser.vl[msg_name] + + with subtests.test(counter=expected[counter_field]): + assert tested[crc_field] == expected[crc_field] + + def verify_mqb_crc_custom(self, subtests, msg_name: str, msg_addr: int, test_messages: list[int]): + self.verify_mqb_crc(subtests, msg_name, msg_addr, test_messages, crc_field=f'{msg_name}_CRC', counter_field=f'{msg_name}_BZ') + + def test_mqb_crc_LWI_01(self, subtests): + self.verify_mqb_crc(subtests, "LWI_01", 0x86, [ + b'\x6b\x00\xbd\x00\x00\x00\x00\x00', + b'\xee\x01\x0a\x00\x00\x00\x00\x00', + b'\xd8\x02\xa9\x00\x00\x00\x00\x00', + b'\x03\x03\xbe\xa2\x12\x00\x00\x00', + b'\x7b\x04\x31\x20\x03\x00\x00\x00', + b'\x8b\x05\xe2\x85\x09\x00\x00\x00', + b'\x63\x06\x13\x21\x00\x00\x00\x00', + b'\x66\x07\x05\x00\x00\x00\x00\x00', + b'\x49\x08\x0d\x00\x00\x00\x00\x00', + b'\x5f\x09\x7e\x60\x01\x00\x00\x00', + b'\xaf\x0a\x72\x20\x00\x00\x00\x00', + b'\x59\x0b\x1b\x00\x00\x00\x00\x00', + b'\xa8\x0c\x06\x00\x00\x00\x00\x00', + b'\xbc\x0d\x72\x20\x00\x00\x00\x00', + b'\xf9\x0e\x0f\x00\x00\x00\x00\x00', + b'\x60\x0f\x62\xc0\x00\x00\x00\x00', + ]) + + def test_mqb_crc_ACC_02(self, subtests): + self.verify_mqb_crc(subtests, "ACC_02", 780, [ + b'\x82\xf0\x3f\x00\x40\x30\x00\x40', + b'\xe6\xf1\x3f\x00\x40\x30\x00\x40', + b'\x4a\xf2\x3f\x00\x40\x30\x00\x40', + b'\x2e\xf3\x3f\x00\x40\x30\x00\x40', + b'\x3d\xf4\x3f\x00\x40\x30\x00\x40', + b'\x59\xf5\x3f\x00\x40\x30\x00\x40', + b'\xf5\xf6\x3f\x00\x40\x30\x00\x40', + b'\x91\xf7\x3f\x00\x40\x30\x00\x40', + b'\xd3\xf8\x3f\x00\x40\x30\x00\x40', + b'\xb7\xf9\x3f\x00\x40\x30\x00\x40', + b'\x1b\xfa\x3f\x00\x40\x30\x00\x40', + b'\x7f\xfb\x3f\x00\x40\x30\x00\x40', + b'\x6c\xfc\x3f\x00\x40\x30\x00\x40', + b'\x08\xfd\x3f\x00\x40\x30\x00\x40', + b'\xa4\xfe\x3f\x00\x40\x30\x00\x40', + b'\xc0\xff\x3f\x00\x40\x30\x00\x40', + ]) + + def test_mqb_crc_LH_EPS_03(self, subtests): + self.verify_mqb_crc(subtests, "LH_EPS_03", 0x9F, [ + b'\x11\x30\x2e\x00\x05\x1c\x80\x30', + b'\x5b\x31\x8e\x03\x05\x53\x00\x30', + b'\xcb\x32\xd3\x06\x05\x73\x00\x30', + b'\xf2\x33\x28\x00\x05\x26\x00\x30', + b'\x0b\x34\x44\x00\x05\x5b\x80\x30', + b'\xed\x35\x80\x00\x03\x34\x00\x30', + b'\xf0\x36\x88\x00\x05\x3d\x80\x30', + b'\x9e\x37\x44\x03\x05\x41\x00\x30', + b'\x68\x38\x06\x01\x05\x18\x80\x30', + b'\x87\x39\x51\x00\x05\x11\x80\x30', + b'\x8c\x3a\x29\x00\x05\xac\x00\x30', + b'\x08\x3b\xbd\x00\x05\x8e\x00\x30', + b'\xd4\x3c\x19\x00\x05\x05\x80\x30', + b'\x29\x3d\x54\x00\x05\x5b\x00\x30', + b'\xa1\x3e\x49\x01\x03\x04\x80\x30', + b'\xe2\x3f\x05\x00\x05\x0a\x00\x30', + ]) + + @pytest.mark.skip(reason="Missing field definitions in .dbc for Getriebe_11") + def test_mqb_crc_Getriebe_11(self, subtests): + self.verify_mqb_crc(subtests, "Getriebe_11", 0xAD, [ + b'\xf8\xe0\xbf\xff\x5f\x20\x20\x20', + b'\xb0\xe1\xbf\xff\xc6\x98\x21\x80', + b'\xd2\xe2\xbf\xff\x5f\x20\x20\x20', + b'\x00\xe3\xbf\xff\xaa\x20\x20\x10', + b'\xf1\xe4\xbf\xff\x5f\x20\x20\x20', + b'\xc4\xe5\xbf\xff\x5f\x20\x20\x20', + b'\xda\xe6\xbf\xff\x5f\x20\x20\x20', + b'\x85\xe7\xbf\xff\x5f\x20\x20\x20', + b'\x12\xe8\xbf\xff\x5f\x20\x20\x20', + b'\x45\xe9\xbf\xff\xaa\x20\x20\x10', + b'\x03\xea\xbf\xff\xcc\x20\x20\x10', + b'\xfc\xeb\xbf\xff\x5f\x20\x21\x20', + b'\xfe\xec\xbf\xff\xad\x20\x20\x10', + b'\xbd\xed\xbf\xff\xaa\x20\x20\x10', + b'\x67\xee\xbf\xff\xaa\x20\x20\x10', + b'\x36\xef\xbf\xff\xaa\x20\x20\x10', + ], counter_field='COUNTERXX') + + @pytest.mark.skip(reason="Missing field definitions in .dbc for ESP_21") + def test_mqb_crc_ESP_21(self, subtests): + self.verify_mqb_crc(subtests, "ESP_21", 0xFD, [ + b'\x66\xd0\x1f\x80\x45\x05\x00\x00', + b'\x87\xd1\x1f\x80\x52\x05\x00\x00', + b'\xcd\xd2\x1f\x80\x50\x06\x00\x00', + b'\xfd\xd3\x1f\x80\x35\x02\x00\x00', + b'\xfa\xd4\x1f\x80\x22\x05\x00\x00', + b'\xfd\xd5\x1f\x80\x84\x04\x00\x00', + b'\x2e\xd6\x1f\x80\xf0\x03\x00\x00', + b'\x9f\xd7\x1f\x80\x00\x00\x00\x00', + b'\x1e\xd8\x1f\x80\xb3\x03\x00\x00', + b'\x61\xd9\x1f\x80\x6d\x05\x00\x00', + b'\x44\xda\x1f\x80\x47\x02\x00\x00', + b'\x86\xdb\x1f\x80\x3a\x02\x00\x00', + b'\x39\xdc\x1f\x80\xcb\x01\x00\x00', + b'\x19\xdd\x1f\x80\x00\x00\x00\x00', + b'\x8c\xde\x1f\x80\xba\x04\x00\x00', + b'\xfb\xdf\x1f\x80\x46\x00\x00\x00', + ]) + + def test_mqb_crc_ESP_05(self, subtests): + self.verify_mqb_crc(subtests, "ESP_05", 0x106, [ + b'\x90\x80\x64\x00\x00\x00\xe7\x10', + b'\xf4\x81\x64\x00\x00\x00\xe7\x10', + b'\x90\x82\x63\x00\x00\x00\xe8\x10', + b'\xa0\x83\x63\x00\x00\x00\xe6\x10', + b'\xe7\x84\x63\x00\x00\x00\xe8\x10', + b'\x2e\x85\x78\x04\x00\x00\xea\x30', + b'\x7b\x86\x63\x00\x00\x00\xe6\x10', + b'\x71\x87\x79\x04\x00\x00\xd0\x30', + b'\x50\x88\x79\x04\x00\x00\xea\x30', + b'\x81\x89\x64\x00\x00\x00\xe1\x10', + b'\x6a\x8a\x68\x00\x00\x04\xd0\x10', + b'\x17\x8b\x6a\x04\x00\x00\xe6\x10', + b'\xc7\x8c\x63\x00\x00\x00\xd1\x10', + b'\x53\x8d\x64\x04\x00\x00\xe2\x10', + b'\x24\x8e\x63\x00\x00\x00\xe7\x10', + b'\x3f\x8f\x82\x04\x00\x00\xe6\x30', + ]) + + def test_mqb_crc_ACC_10(self, subtests): + self.verify_mqb_crc(subtests, "ACC_10", 0x117, [ + b'\x9b\x00\x00\x40\x68\x00\x00\xff', + b'\xff\x01\x00\x40\x68\x00\x00\xff', + b'\x53\x02\x00\x40\x68\x00\x00\xff', + b'\x37\x03\x00\x40\x68\x00\x00\xff', + b'\x24\x04\x00\x40\x68\x00\x00\xff', + b'\x40\x05\x00\x40\x68\x00\x00\xff', + b'\xec\x06\x00\x40\x68\x00\x00\xff', + b'\x88\x07\x00\x40\x68\x00\x00\xff', + b'\xca\x08\x00\x40\x68\x00\x00\xff', + b'\xae\x09\x00\x40\x68\x00\x00\xff', + b'\x02\x0a\x00\x40\x68\x00\x00\xff', + b'\x66\x0b\x00\x40\x68\x00\x00\xff', + b'\x75\x0c\x00\x40\x68\x00\x00\xff', + b'\x11\x0d\x00\x40\x68\x00\x00\xff', + b'\xbd\x0e\x00\x40\x68\x00\x00\xff', + b'\xd9\x0f\x00\x40\x68\x00\x00\xff', + ]) + + def test_mqb_crc_TSK_06(self, subtests): + self.verify_mqb_crc(subtests, "TSK_06", 0x120, [ + b'\xc1\x00\x00\x02\x00\x08\xff\x21', + b'\x34\x01\x00\x02\x00\x08\xff\x21', + b'\xcc\x02\x00\x02\x00\x08\xff\x21', + b'\x1e\x03\x00\x02\x00\x08\xff\x21', + b'\x48\x04\x00\x02\x00\x08\xff\x21', + b'\x4a\x05\x00\x02\x00\x08\xff\x21', + b'\xa5\x06\x00\x02\x00\x08\xff\x21', + b'\xa7\x07\x00\x02\x00\x08\xff\x21', + b'\xfe\x08\x00\x02\x00\x08\xff\x21', + b'\xa8\x09\x00\x02\x00\x08\xff\x21', + b'\x73\x0a\x00\x02\x00\x08\xff\x21', + b'\xdf\x0b\x00\x02\x00\x08\xff\x21', + b'\x05\x0c\x00\x02\x00\x08\xff\x21', + b'\xb5\x0d\x00\x02\x00\x08\xff\x21', + b'\xde\x0e\x00\x02\x00\x08\xff\x21', + b'\x0b\x0f\x00\x02\x00\x08\xff\x21', + ]) + + @pytest.mark.skip(reason="Missing field definitions in .dbc for Motor_20") + def test_mqb_crc_Motor_20(self, subtests): + self.verify_mqb_crc(subtests, "Motor_20", 0x121, [ + b'\xb9\x00\x00\xc0\x39\x46\x7e\xfe', + b'\x85\x31\x20\x00\x1a\x46\x7e\xfe', + b'\xc7\x12\x00\x40\x1a\x46\x7e\xfe', + b'\x53\x93\x00\x00\x19\x46\x7e\xfe', + b'\xa4\x34\x00\x80\x1a\x46\x7e\xfe', + b'\x0e\x55\x20\x60\x18\x46\x7e\xfe', + b'\x3f\x06\x00\xc0\x37\x4c\x7e\xfe', + b'\x0c\x07\x00\x40\x39\x46\x7e\xfe', + b'\x2a\x08\x00\x00\x3a\x46\x7e\xfe', + b'\x7f\x49\x20\x80\x1a\x46\x7e\xfe', + b'\x2f\x0a\x00\xc0\x39\x46\x7e\xfe', + b'\x70\xbb\x00\x00\x17\x46\x7e\xfe', + b'\x06\x0c\x00\x00\x39\x46\x7e\xfe', + b'\x4b\x9d\x20\xe0\x16\x4c\x7e\xfe', + b'\x73\xfe\x00\x40\x16\x46\x7e\xfe', + b'\xaf\x0f\x20\x80\x39\x4c\x7e\xfe', + ]) + + def test_mqb_crc_ACC_06(self, subtests): + self.verify_mqb_crc(subtests, "ACC_06", 0x122, [ + b'\x14\x80\x00\xfe\x07\x00\x00\x18', + b'\x9f\x81\x00\xfe\x07\x00\x00\x18', + b'\x0a\x82\x00\xfe\x07\x00\x00\x28', + b'\x40\x83\x00\xfe\x07\x00\x00\x18', + b'\x2d\x84\x00\xfe\x07\x00\x00\x28', + b'\xdb\x85\x00\xfe\x07\x00\x00\x18', + b'\x4d\x86\x00\xfe\x07\x00\x00\x28', + b'\x35\x87\x00\xfe\x07\x00\x00\x18', + b'\x23\x88\x00\xfe\x07\x00\x00\x28', + b'\x4a\x89\x00\xfe\x07\x00\x00\x28', + b'\xe1\x8a\x00\xfe\x07\x00\x00\x28', + b'\x30\x8b\x00\xfe\x07\x00\x00\x28', + b'\x60\x8c\x00\xfe\x07\x00\x00\x28', + b'\x0d\x8d\x00\xfe\x07\x00\x00\x18', + b'\x8c\x8e\x00\xfe\x07\x00\x00\x18', + b'\x6f\x8f\x00\xfe\x07\x00\x00\x28', + ]) + + def test_mqb_crc_HCA_01(self, subtests): + self.verify_mqb_crc(subtests, "HCA_01", 0x126, [ + b'\x00\x30\x0d\xc0\x05\xfe\x07\x00', + b'\x3e\x31\x54\xc0\x05\xfe\x07\x00', + b'\xa7\x32\xbb\x40\x05\xfe\x07\x00', + b'\x96\x33\x29\xc0\x05\xfe\x07\x00', + b'\x5f\x34\x00\x00\x03\xfe\x07\x00', + b'\x3b\x35\xae\x40\x05\xfe\x07\x00', + b'\xc7\x36\x7a\x40\x05\xfe\x07\x00', + b'\x6f\x37\x76\x40\x05\xfe\x07\x00', + b'\xb1\x38\x00\x00\x03\xfe\x07\x00', + b'\xd5\x39\x00\x00\x03\xfe\x07\x00', + b'\xba\x3a\x69\xc0\x05\xfe\x07\x00', + b'\x65\x3b\x10\x40\x05\xfe\x07\x00', + b'\x49\x3c\x72\xc0\x05\xfe\x07\x00', + b'\xc6\x3d\xdf\x40\x05\xfe\x07\x00', + b'\x1d\x3e\x2c\xc1\x05\xfe\x07\x00', + b'\x9b\x3f\x20\x40\x05\xfe\x07\x00', + ]) + + def test_mqb_crc_GRA_ACC_01(self, subtests): + self.verify_mqb_crc(subtests, "GRA_ACC_01", 0x12B, [ + b'\x86\x40\x80\x2a\x00\x00\x00\x00', + b'\xf4\x41\x80\x2a\x00\x00\x00\x00', + b'\x50\x42\x80\x2a\x00\x00\x00\x00', + b'\x08\x43\x80\x2a\x00\x00\x00\x00', + b'\x88\x44\x80\x2a\x00\x00\x00\x00', + b'\x2d\x45\x80\x2a\x00\x00\x00\x00', + b'\x34\x46\x80\x2a\x00\x00\x00\x00', + b'\x11\x47\x80\x2a\x00\x00\x00\x00', + b'\xc4\x48\x80\x2a\x00\x00\x00\x00', + b'\xcc\x49\x80\x2a\x00\x00\x00\x00', + b'\xdc\x4a\x80\x2a\x00\x00\x00\x00', + b'\x79\x4b\x80\x2a\x00\x00\x00\x00', + b'\x3c\x4c\x80\x2a\x00\x00\x00\x00', + b'\x68\x4d\x80\x2a\x00\x00\x00\x00', + b'\x27\x4e\x80\x2a\x00\x00\x00\x00', + b'\x0d\x4f\x80\x2a\x00\x00\x00\x00', + ]) + + def test_mqb_crc_ACC_07(self, subtests): + self.verify_mqb_crc(subtests, "ACC_07", 0x12E, [ + b'\xac\xe0\x7f\x00\xfe\x00\xc0\xff', + b'\xa2\xe1\x7f\x00\xfe\x00\xc0\xff', + b'\x6b\xe2\x7f\x00\xfe\x00\xc0\xff', + b'\xf2\xe3\x7f\x00\xfe\x00\xc0\xff', + b'\xd5\xe4\x7f\x00\xfe\x00\xc0\xff', + b'\x35\xe5\x7f\x00\xfe\x00\xc0\xff', + b'\x7f\xe6\x7f\x00\xfe\x00\xc0\xff', + b'\x6c\xe7\x7f\x00\xfe\x00\xc0\xff', + b'\x05\xe8\x7f\x00\xfe\x00\xc0\xff', + b'\x79\xe9\x7f\x00\xfe\x00\xc0\xff', + b'\x25\xea\x7f\x00\xfe\x00\xc0\xff', + b'\xd1\xeb\x7f\x00\xfe\x00\xc0\xff', + b'\x72\xec\x7f\x00\xfe\x00\xc0\xff', + b'\x58\xed\x7f\x00\xfe\x00\xc0\xff', + b'\x82\xee\x7f\x00\xfe\x00\xc0\xff', + b'\x85\xef\x7f\x00\xfe\x00\xc0\xff', + ]) + + @pytest.mark.skip(reason="Missing field definitions in .dbc for EV_Gearshift") + def test_mqb_crc_EV_Gearshift(self, subtests): + self.verify_mqb_crc(subtests, "EV_Gearshift", 0x187, [ + b'\x70\x80\x15\x00\x00\x00\x00\xF0', + b'\x07\x81\x15\x00\x00\x00\x00\xF0', + b'\x7A\x82\x15\x00\x00\x00\x00\xF0', + b'\x26\x83\x15\x00\x00\x00\x00\xF0', + b'\xBE\x84\x15\x00\x00\x00\x00\xF0', + b'\x5A\x85\x15\x00\x00\x00\x00\xF0', + b'\xFC\x86\x15\x00\x00\x00\x00\xF0', + b'\x9E\x87\x15\x00\x00\x00\x00\xF0', + b'\xAF\x88\x15\x00\x00\x00\x00\xF0', + b'\x35\x89\x15\x00\x00\x00\x00\xF0', + b'\xC5\x8A\x15\x00\x00\x00\x00\xF0', + b'\x11\x8B\x15\x00\x00\x00\x00\xF0', + b'\xD0\x8C\x15\x00\x00\x00\x00\xF0', + b'\xE8\x8D\x15\x00\x00\x00\x00\xF0', + b'\xF5\x8E\x15\x00\x00\x00\x00\xF0', + b'\x00\x8F\x15\x00\x00\x00\x00\xF0', + ]) + + @pytest.mark.skip(reason="Missing field definitions in .dbc for SWA_01") + def test_mqb_crc_SWA_01(self, subtests): + self.verify_mqb_crc(subtests, "SWA_01", 0x30F, [ + b'\x0b\x00\xf2\x00\x10\x01\x00\x00', + b'\xda\x01\xf2\x00\x10\x00\x00\x00', + b'\xc3\x02\xf2\x00\x10\x01\x00\x00', + b'\x12\x03\xf2\x00\x10\x00\x00\x00', + b'\xb4\x04\xf2\x00\x10\x01\x00\x00', + b'\x65\x05\xf2\x00\x10\x00\x00\x00', + b'\xc9\x06\xf2\x00\x10\x00\x00\x00', + b'\x18\x07\xf2\x00\x10\x01\x00\x00', + b'\xef\x08\xf2\x00\x10\x00\x00\x00', + b'\x8b\x09\xf2\x00\x10\x00\x00\x00', + b'\x92\x0a\xf2\x00\x10\x01\x00\x00', + b'\xf6\x0b\xf2\x00\x10\x01\x00\x00', + b'\x50\x0c\xf2\x00\x10\x00\x00\x00', + b'\x34\x0d\xf2\x00\x10\x00\x00\x00', + b'\x98\x0e\xf2\x00\x10\x00\x00\x00', + b'\x49\x0f\xf2\x00\x10\x01\x00\x00', + ]) + + def test_mqb_crc_ACC_04(self, subtests): + self.verify_mqb_crc(subtests, "ACC_04", 0x324, [ + b'\xba\x00\x00\x00\x00\x00\x00\x10', + b'\xde\x01\x00\x00\x00\x00\x00\x10', + b'\x72\x02\x00\x00\x00\x00\x00\x10', + b'\x16\x03\x00\x00\x00\x00\x00\x10', + b'\x05\x04\x00\x00\x00\x00\x00\x10', + b'\x44\x05\x00\x00\x00\x00\x00\x00', + b'\xe8\x06\x00\x00\x00\x00\x00\x00', + b'\xa9\x07\x00\x00\x00\x00\x00\x10', + b'\xeb\x08\x00\x00\x00\x00\x00\x10', + b'\x8f\x09\x00\x00\x00\x00\x00\x10', + b'\x06\x0a\x00\x00\x00\x00\x00\x00', + b'\x47\x0b\x00\x00\x00\x00\x00\x10', + b'\x71\x0c\x00\x00\x00\x00\x00\x00', + b'\x15\x0d\x00\x00\x00\x00\x00\x00', + b'\xb9\x0e\x00\x00\x00\x00\x00\x00', + b'\xdd\x0f\x00\x00\x00\x00\x00\x00', + ]) + + def test_mqb_crc_Klemmen_Status_01(self, subtests): + self.verify_mqb_crc(subtests, "Klemmen_Status_01", 0x3C0, [ + b'\x74\x00\x03\x00', + b'\xc1\x01\x03\x00', + b'\x31\x02\x03\x00', + b'\x84\x03\x03\x00', + b'\xfe\x04\x03\x00', + b'\x4b\x05\x03\x00', + b'\xbb\x06\x03\x00', + b'\x0e\x07\x03\x00', + b'\x4f\x08\x03\x00', + b'\xfa\x09\x03\x00', + b'\x0a\x0a\x03\x00', + b'\xbf\x0b\x03\x00', + b'\xc5\x0c\x03\x00', + b'\x70\x0d\x03\x00', + b'\x80\x0e\x03\x00', + b'\x35\x0f\x03\x00', + ]) + + @pytest.mark.skip(reason="Missing field definitions in .dbc for ESP_20") + def test_mqb_crc_ESP_20(self, subtests): + self.verify_mqb_crc(subtests, "ESP_20", 0x65D, [ + b'\x98\x30\x2b\x10\x00\x00\x22\x81', + b'\xc8\x31\x2b\x10\x00\x00\x22\x81', + b'\x9d\x32\x2b\x10\x00\x00\x22\x81', + b'\x1f\x33\x2b\x10\x00\x00\x22\x81', + b'\x6e\x34\x2b\x10\x00\x00\x22\x81', + b'\x61\x35\x2b\x10\x00\x00\x22\x81', + b'\x6f\x36\x2b\x10\x00\x00\x22\x81', + b'\xe5\x37\x2b\x10\x00\x00\x22\x81', + b'\xf8\x38\x2b\x10\x00\x00\x22\x81', + b'\xe1\x39\x2b\x10\x00\x00\x22\x81', + b'\xaa\x3a\x2b\x10\x00\x00\x22\x81', + b'\xe6\x3b\x2b\x10\x00\x00\x22\x81', + b'\xef\x3c\x2b\x10\x00\x00\x22\x81', + b'\xbb\x3d\x2b\x10\x00\x00\x22\x81', + b'\x9b\x3e\x2b\x10\x00\x00\x22\x81', + b'\x72\x3f\x2b\x10\x00\x00\x22\x81', + ]) From 7183393bd8c6b226d1b7c3e07949e70ed6aa193d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Czekan=CC=81ski?= Date: Thu, 12 Sep 2024 00:07:22 +0200 Subject: [PATCH 02/11] VW MQB: Add missing fields in Getriebe_11 Test case is reenabled and now passes --- opendbc/can/tests/test_checksums.py | 3 +-- opendbc/dbc/vw_mqb_2010.dbc | 8 +++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/opendbc/can/tests/test_checksums.py b/opendbc/can/tests/test_checksums.py index 6e9109e863..cc2ff54f63 100644 --- a/opendbc/can/tests/test_checksums.py +++ b/opendbc/can/tests/test_checksums.py @@ -131,7 +131,6 @@ def test_mqb_crc_LH_EPS_03(self, subtests): b'\xe2\x3f\x05\x00\x05\x0a\x00\x30', ]) - @pytest.mark.skip(reason="Missing field definitions in .dbc for Getriebe_11") def test_mqb_crc_Getriebe_11(self, subtests): self.verify_mqb_crc(subtests, "Getriebe_11", 0xAD, [ b'\xf8\xe0\xbf\xff\x5f\x20\x20\x20', @@ -150,7 +149,7 @@ def test_mqb_crc_Getriebe_11(self, subtests): b'\xbd\xed\xbf\xff\xaa\x20\x20\x10', b'\x67\xee\xbf\xff\xaa\x20\x20\x10', b'\x36\xef\xbf\xff\xaa\x20\x20\x10', - ], counter_field='COUNTERXX') + ]) @pytest.mark.skip(reason="Missing field definitions in .dbc for ESP_21") def test_mqb_crc_ESP_21(self, subtests): diff --git a/opendbc/dbc/vw_mqb_2010.dbc b/opendbc/dbc/vw_mqb_2010.dbc index 44ec0cd3e0..586f256634 100644 --- a/opendbc/dbc/vw_mqb_2010.dbc +++ b/opendbc/dbc/vw_mqb_2010.dbc @@ -483,13 +483,15 @@ BO_ 296 Getriebe_06: 3 Getriebe_DQ_Hybrid_MQB BO_ 173 Getriebe_11: 8 Getriebe_DQ_Hybrid_MQB SG_ CHECKSUM : 0|8@1+ (1,0) [0|255] "" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ COUNTERXX : 8|4@1+ (1,0) [0|15] "" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB + SG_ COUNTER : 8|4@1+ (1,0) [0|15] "" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB SG_ GE_MMom_Soll_02 : 12|10@1+ (1,-509) [-509|509] "Unit_NewtoMeter" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB SG_ GE_MMom_Vorhalt_02 : 22|10@1+ (1,-509) [-509|509] "Unit_NewtoMeter" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB SG_ GE_Uefkt : 32|10@1+ (0.1,0) [0|102.2] "" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB SG_ GE_Fahrstufe : 42|5@1+ (1,0) [0|31] "" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ GE_Schaltvorgang : 47|1@1+ (1,0) [0|1] "" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB - SG_ GE_Status_Kupplung : 54|2@1+ (1,0) [0|3] "" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB + SG_ GE_Schaltablauf : 47|2@1+ (1,0) [0|3] "" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB + SG_ GE_Uefkt_unplausibel : 49|1@1+ (1,0) [0|1] "" Gateway_MQB + SG_ GE_MMom_Status_02 : 50|3@1+ (1,0) [0|7] "" Gateway_MQB + SG_ GE_Status_Kraftschluss : 53|3@1+ (1,0) [0|7] "" Gateway_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB SG_ GE_MMom_Status : 56|2@1+ (1,0) [0|3] "" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB SG_ GE_Freig_MMom_Vorhalt : 58|1@1+ (1,0) [0|1] "" Gateway_MQB,Motor_Diesel_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB SG_ GE_Verbot_Ausblendung : 59|1@1+ (1,0) [0|1] "" Gateway_MQB,Motor_Hybrid_MQB,Motor_Otto_MQB From 23dc8483b8a4d28791f2a9c15e4cd307960d636f Mon Sep 17 00:00:00 2001 From: Jason Young Date: Thu, 12 Sep 2024 13:17:25 -0400 Subject: [PATCH 03/11] EV_Gearshift -> Motor_EV_01, enable test --- opendbc/can/tests/test_checksums.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/opendbc/can/tests/test_checksums.py b/opendbc/can/tests/test_checksums.py index cc2ff54f63..d98e0bd512 100644 --- a/opendbc/can/tests/test_checksums.py +++ b/opendbc/can/tests/test_checksums.py @@ -333,9 +333,8 @@ def test_mqb_crc_ACC_07(self, subtests): b'\x85\xef\x7f\x00\xfe\x00\xc0\xff', ]) - @pytest.mark.skip(reason="Missing field definitions in .dbc for EV_Gearshift") - def test_mqb_crc_EV_Gearshift(self, subtests): - self.verify_mqb_crc(subtests, "EV_Gearshift", 0x187, [ + def test_mqb_crc_Motor_EV_01(self, subtests): + self.verify_mqb_crc(subtests, "Motor_EV_01", 0x187, [ b'\x70\x80\x15\x00\x00\x00\x00\xF0', b'\x07\x81\x15\x00\x00\x00\x00\xF0', b'\x7A\x82\x15\x00\x00\x00\x00\xF0', From b3c50b89d06eb09c27c310d3b06de2655a925959 Mon Sep 17 00:00:00 2001 From: Jason Young Date: Thu, 12 Sep 2024 14:06:34 -0400 Subject: [PATCH 04/11] skip Getribe_11 testing with a note about why --- opendbc/can/tests/test_checksums.py | 1 + 1 file changed, 1 insertion(+) diff --git a/opendbc/can/tests/test_checksums.py b/opendbc/can/tests/test_checksums.py index d98e0bd512..ececa54fe8 100644 --- a/opendbc/can/tests/test_checksums.py +++ b/opendbc/can/tests/test_checksums.py @@ -131,6 +131,7 @@ def test_mqb_crc_LH_EPS_03(self, subtests): b'\xe2\x3f\x05\x00\x05\x0a\x00\x30', ]) + @pytest.mark.skip(reason="This message has broken COUNTER behavior, see opendbc#1235") def test_mqb_crc_Getriebe_11(self, subtests): self.verify_mqb_crc(subtests, "Getriebe_11", 0xAD, [ b'\xf8\xe0\xbf\xff\x5f\x20\x20\x20', From 0ed131a856b4714ccfbb05751a0ae3a703054079 Mon Sep 17 00:00:00 2001 From: Jason Young Date: Thu, 12 Sep 2024 14:09:15 -0400 Subject: [PATCH 05/11] reenable all others, except SWA_01 --- opendbc/can/tests/test_checksums.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/opendbc/can/tests/test_checksums.py b/opendbc/can/tests/test_checksums.py index ececa54fe8..bfdc502830 100644 --- a/opendbc/can/tests/test_checksums.py +++ b/opendbc/can/tests/test_checksums.py @@ -152,7 +152,6 @@ def test_mqb_crc_Getriebe_11(self, subtests): b'\x36\xef\xbf\xff\xaa\x20\x20\x10', ]) - @pytest.mark.skip(reason="Missing field definitions in .dbc for ESP_21") def test_mqb_crc_ESP_21(self, subtests): self.verify_mqb_crc(subtests, "ESP_21", 0xFD, [ b'\x66\xd0\x1f\x80\x45\x05\x00\x00', @@ -233,7 +232,6 @@ def test_mqb_crc_TSK_06(self, subtests): b'\x0b\x0f\x00\x02\x00\x08\xff\x21', ]) - @pytest.mark.skip(reason="Missing field definitions in .dbc for Motor_20") def test_mqb_crc_Motor_20(self, subtests): self.verify_mqb_crc(subtests, "Motor_20", 0x121, [ b'\xb9\x00\x00\xc0\x39\x46\x7e\xfe', @@ -354,7 +352,7 @@ def test_mqb_crc_Motor_EV_01(self, subtests): b'\x00\x8F\x15\x00\x00\x00\x00\xF0', ]) - @pytest.mark.skip(reason="Missing field definitions in .dbc for SWA_01") + @pytest.mark.skip(reason="Investigate why this is still broken") def test_mqb_crc_SWA_01(self, subtests): self.verify_mqb_crc(subtests, "SWA_01", 0x30F, [ b'\x0b\x00\xf2\x00\x10\x01\x00\x00', @@ -415,7 +413,6 @@ def test_mqb_crc_Klemmen_Status_01(self, subtests): b'\x35\x0f\x03\x00', ]) - @pytest.mark.skip(reason="Missing field definitions in .dbc for ESP_20") def test_mqb_crc_ESP_20(self, subtests): self.verify_mqb_crc(subtests, "ESP_20", 0x65D, [ b'\x98\x30\x2b\x10\x00\x00\x22\x81', From 94310b78332d090eb7e5e9be006c24a17a2f2031 Mon Sep 17 00:00:00 2001 From: Jason Young Date: Thu, 12 Sep 2024 14:12:00 -0400 Subject: [PATCH 06/11] turns out we can still test Getriebe_11 --- opendbc/can/tests/test_checksums.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/opendbc/can/tests/test_checksums.py b/opendbc/can/tests/test_checksums.py index bfdc502830..f34e44fe20 100644 --- a/opendbc/can/tests/test_checksums.py +++ b/opendbc/can/tests/test_checksums.py @@ -131,7 +131,6 @@ def test_mqb_crc_LH_EPS_03(self, subtests): b'\xe2\x3f\x05\x00\x05\x0a\x00\x30', ]) - @pytest.mark.skip(reason="This message has broken COUNTER behavior, see opendbc#1235") def test_mqb_crc_Getriebe_11(self, subtests): self.verify_mqb_crc(subtests, "Getriebe_11", 0xAD, [ b'\xf8\xe0\xbf\xff\x5f\x20\x20\x20', @@ -150,7 +149,7 @@ def test_mqb_crc_Getriebe_11(self, subtests): b'\xbd\xed\xbf\xff\xaa\x20\x20\x10', b'\x67\xee\xbf\xff\xaa\x20\x20\x10', b'\x36\xef\xbf\xff\xaa\x20\x20\x10', - ]) + ], counter_field="COUNTER_DISABLED") # see opendbc#1235 def test_mqb_crc_ESP_21(self, subtests): self.verify_mqb_crc(subtests, "ESP_21", 0xFD, [ From 95c7ba5cb8574e295fab12a4eaf9be0fc2a5933e Mon Sep 17 00:00:00 2001 From: Jason Young Date: Thu, 12 Sep 2024 14:31:05 -0400 Subject: [PATCH 07/11] New test data for SWA_01, re-enable test --- opendbc/can/tests/test_checksums.py | 33 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/opendbc/can/tests/test_checksums.py b/opendbc/can/tests/test_checksums.py index f34e44fe20..6366481cb5 100644 --- a/opendbc/can/tests/test_checksums.py +++ b/opendbc/can/tests/test_checksums.py @@ -351,25 +351,24 @@ def test_mqb_crc_Motor_EV_01(self, subtests): b'\x00\x8F\x15\x00\x00\x00\x00\xF0', ]) - @pytest.mark.skip(reason="Investigate why this is still broken") def test_mqb_crc_SWA_01(self, subtests): self.verify_mqb_crc(subtests, "SWA_01", 0x30F, [ - b'\x0b\x00\xf2\x00\x10\x01\x00\x00', - b'\xda\x01\xf2\x00\x10\x00\x00\x00', - b'\xc3\x02\xf2\x00\x10\x01\x00\x00', - b'\x12\x03\xf2\x00\x10\x00\x00\x00', - b'\xb4\x04\xf2\x00\x10\x01\x00\x00', - b'\x65\x05\xf2\x00\x10\x00\x00\x00', - b'\xc9\x06\xf2\x00\x10\x00\x00\x00', - b'\x18\x07\xf2\x00\x10\x01\x00\x00', - b'\xef\x08\xf2\x00\x10\x00\x00\x00', - b'\x8b\x09\xf2\x00\x10\x00\x00\x00', - b'\x92\x0a\xf2\x00\x10\x01\x00\x00', - b'\xf6\x0b\xf2\x00\x10\x01\x00\x00', - b'\x50\x0c\xf2\x00\x10\x00\x00\x00', - b'\x34\x0d\xf2\x00\x10\x00\x00\x00', - b'\x98\x0e\xf2\x00\x10\x00\x00\x00', - b'\x49\x0f\xf2\x00\x10\x01\x00\x00', + b'\x10\x00\x10\x00\x00\x00\x00\x00', + b'\x74\x01\x10\x00\x00\x00\x00\x00', + b'\xD8\x02\x10\x00\x00\x00\x00\x00', + b'\xBC\x03\x10\x00\x00\x00\x00\x00', + b'\xAF\x04\x10\x00\x00\x00\x00\x00', + b'\xCB\x05\x10\x00\x00\x00\x00\x00', + b'\x67\x06\x10\x00\x00\x00\x00\x00', + b'\x03\x07\x10\x00\x00\x00\x00\x00', + b'\x41\x08\x10\x00\x00\x00\x00\x00', + b'\x25\x09\x10\x00\x00\x00\x00\x00', + b'\x89\x0A\x10\x00\x00\x00\x00\x00', + b'\xED\x0B\x10\x00\x00\x00\x00\x00', + b'\xFE\x0C\x10\x00\x00\x00\x00\x00', + b'\x9A\x0D\x10\x00\x00\x00\x00\x00', + b'\x36\x0E\x10\x00\x00\x00\x00\x00', + b'\x52\x0F\x10\x00\x00\x00\x00\x00', ]) def test_mqb_crc_ACC_04(self, subtests): From 1269a7bbf89158a807fb1adbfdeafe580c003436 Mon Sep 17 00:00:00 2001 From: Jason Young Date: Thu, 12 Sep 2024 14:33:15 -0400 Subject: [PATCH 08/11] no longer a need for test skipping --- opendbc/can/tests/test_checksums.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/opendbc/can/tests/test_checksums.py b/opendbc/can/tests/test_checksums.py index 6366481cb5..7606ab8a2a 100644 --- a/opendbc/can/tests/test_checksums.py +++ b/opendbc/can/tests/test_checksums.py @@ -40,9 +40,6 @@ def verify_mqb_crc(self, subtests, msg_name: str, msg_addr: int, test_messages: parser = CANParser(dbc_file, [(msg_name, 0)], 0) packer = CANPacker(dbc_file) - if len(test_messages) == 0: - pytest.skip('No input data given') # TODO: Remove eventually - assert len(test_messages) == 16 # All counter values must be tested for data in test_messages: From 499ea2aa97945fb097345b3e3e47224353bb87c5 Mon Sep 17 00:00:00 2001 From: Jason Young Date: Thu, 12 Sep 2024 14:34:40 -0400 Subject: [PATCH 09/11] no longer a need for custom tests --- opendbc/can/tests/test_checksums.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/opendbc/can/tests/test_checksums.py b/opendbc/can/tests/test_checksums.py index 7606ab8a2a..7742a0776a 100644 --- a/opendbc/can/tests/test_checksums.py +++ b/opendbc/can/tests/test_checksums.py @@ -65,9 +65,6 @@ def verify_mqb_crc(self, subtests, msg_name: str, msg_addr: int, test_messages: with subtests.test(counter=expected[counter_field]): assert tested[crc_field] == expected[crc_field] - def verify_mqb_crc_custom(self, subtests, msg_name: str, msg_addr: int, test_messages: list[int]): - self.verify_mqb_crc(subtests, msg_name, msg_addr, test_messages, crc_field=f'{msg_name}_CRC', counter_field=f'{msg_name}_BZ') - def test_mqb_crc_LWI_01(self, subtests): self.verify_mqb_crc(subtests, "LWI_01", 0x86, [ b'\x6b\x00\xbd\x00\x00\x00\x00\x00', From 786bf0024e004615bc7141a65e69cf635ffd5f84 Mon Sep 17 00:00:00 2001 From: Jason Young Date: Thu, 12 Sep 2024 14:51:15 -0400 Subject: [PATCH 10/11] more concise --- opendbc/can/tests/test_checksums.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/opendbc/can/tests/test_checksums.py b/opendbc/can/tests/test_checksums.py index 7742a0776a..30ea114e62 100644 --- a/opendbc/can/tests/test_checksums.py +++ b/opendbc/can/tests/test_checksums.py @@ -1,5 +1,4 @@ import copy -import pytest from opendbc.can.parser import CANParser from opendbc.can.packer import CANPacker @@ -44,24 +43,15 @@ def verify_mqb_crc(self, subtests, msg_name: str, msg_addr: int, test_messages: for data in test_messages: expected_msg = (msg_addr, data, 0) - - # Parse known valid message from logs parser.update_strings([0, [expected_msg]]) expected = copy.deepcopy(parser.vl[msg_name]) - # Clear CHECKSUM to make sure packer recalculates it modified = copy.deepcopy(expected) modified.pop(crc_field, None) - - # Serialize message modified_msg = packer.make_can_msg(msg_name, 0, modified) - assert modified_msg[2] == expected_msg[2] - - # And parse it parser.update_strings([0, [modified_msg]]) tested = parser.vl[msg_name] - with subtests.test(counter=expected[counter_field]): assert tested[crc_field] == expected[crc_field] From f7f1430f54b8ca16fd37a280ef05860150edae8f Mon Sep 17 00:00:00 2001 From: Jason Young Date: Thu, 12 Sep 2024 14:55:39 -0400 Subject: [PATCH 11/11] prefix with VW for clarity --- opendbc/can/tests/test_checksums.py | 76 ++++++++++++++--------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/opendbc/can/tests/test_checksums.py b/opendbc/can/tests/test_checksums.py index 30ea114e62..52ac79398b 100644 --- a/opendbc/can/tests/test_checksums.py +++ b/opendbc/can/tests/test_checksums.py @@ -33,8 +33,8 @@ def test_honda_checksum(self): assert parser.vl['LKAS_HUD']['CHECKSUM'] == std assert parser.vl['LKAS_HUD_A']['CHECKSUM'] == ext - def verify_mqb_crc(self, subtests, msg_name: str, msg_addr: int, test_messages: list[int], crc_field: str = 'CHECKSUM', counter_field: str = 'COUNTER'): - """Validates checksum calculation for each message provided""" + def verify_vw_mqb_crc(self, subtests, msg_name: str, msg_addr: int, test_messages: list[int], crc_field: str = 'CHECKSUM', counter_field: str = 'COUNTER'): + """Validates AUTOSAR E2E Profile 2 CRC calculation against recorded reference messages""" dbc_file = "vw_mqb_2010" parser = CANParser(dbc_file, [(msg_name, 0)], 0) packer = CANPacker(dbc_file) @@ -55,8 +55,8 @@ def verify_mqb_crc(self, subtests, msg_name: str, msg_addr: int, test_messages: with subtests.test(counter=expected[counter_field]): assert tested[crc_field] == expected[crc_field] - def test_mqb_crc_LWI_01(self, subtests): - self.verify_mqb_crc(subtests, "LWI_01", 0x86, [ + def test_vw_mqb_crc_LWI_01(self, subtests): + self.verify_vw_mqb_crc(subtests, "LWI_01", 0x86, [ b'\x6b\x00\xbd\x00\x00\x00\x00\x00', b'\xee\x01\x0a\x00\x00\x00\x00\x00', b'\xd8\x02\xa9\x00\x00\x00\x00\x00', @@ -75,8 +75,8 @@ def test_mqb_crc_LWI_01(self, subtests): b'\x60\x0f\x62\xc0\x00\x00\x00\x00', ]) - def test_mqb_crc_ACC_02(self, subtests): - self.verify_mqb_crc(subtests, "ACC_02", 780, [ + def test_vw_mqb_crc_ACC_02(self, subtests): + self.verify_vw_mqb_crc(subtests, "ACC_02", 780, [ b'\x82\xf0\x3f\x00\x40\x30\x00\x40', b'\xe6\xf1\x3f\x00\x40\x30\x00\x40', b'\x4a\xf2\x3f\x00\x40\x30\x00\x40', @@ -95,8 +95,8 @@ def test_mqb_crc_ACC_02(self, subtests): b'\xc0\xff\x3f\x00\x40\x30\x00\x40', ]) - def test_mqb_crc_LH_EPS_03(self, subtests): - self.verify_mqb_crc(subtests, "LH_EPS_03", 0x9F, [ + def test_vw_mqb_crc_LH_EPS_03(self, subtests): + self.verify_vw_mqb_crc(subtests, "LH_EPS_03", 0x9F, [ b'\x11\x30\x2e\x00\x05\x1c\x80\x30', b'\x5b\x31\x8e\x03\x05\x53\x00\x30', b'\xcb\x32\xd3\x06\x05\x73\x00\x30', @@ -115,8 +115,8 @@ def test_mqb_crc_LH_EPS_03(self, subtests): b'\xe2\x3f\x05\x00\x05\x0a\x00\x30', ]) - def test_mqb_crc_Getriebe_11(self, subtests): - self.verify_mqb_crc(subtests, "Getriebe_11", 0xAD, [ + def test_vw_mqb_crc_Getriebe_11(self, subtests): + self.verify_vw_mqb_crc(subtests, "Getriebe_11", 0xAD, [ b'\xf8\xe0\xbf\xff\x5f\x20\x20\x20', b'\xb0\xe1\xbf\xff\xc6\x98\x21\x80', b'\xd2\xe2\xbf\xff\x5f\x20\x20\x20', @@ -135,8 +135,8 @@ def test_mqb_crc_Getriebe_11(self, subtests): b'\x36\xef\xbf\xff\xaa\x20\x20\x10', ], counter_field="COUNTER_DISABLED") # see opendbc#1235 - def test_mqb_crc_ESP_21(self, subtests): - self.verify_mqb_crc(subtests, "ESP_21", 0xFD, [ + def test_vw_mqb_crc_ESP_21(self, subtests): + self.verify_vw_mqb_crc(subtests, "ESP_21", 0xFD, [ b'\x66\xd0\x1f\x80\x45\x05\x00\x00', b'\x87\xd1\x1f\x80\x52\x05\x00\x00', b'\xcd\xd2\x1f\x80\x50\x06\x00\x00', @@ -155,8 +155,8 @@ def test_mqb_crc_ESP_21(self, subtests): b'\xfb\xdf\x1f\x80\x46\x00\x00\x00', ]) - def test_mqb_crc_ESP_05(self, subtests): - self.verify_mqb_crc(subtests, "ESP_05", 0x106, [ + def test_vw_mqb_crc_ESP_05(self, subtests): + self.verify_vw_mqb_crc(subtests, "ESP_05", 0x106, [ b'\x90\x80\x64\x00\x00\x00\xe7\x10', b'\xf4\x81\x64\x00\x00\x00\xe7\x10', b'\x90\x82\x63\x00\x00\x00\xe8\x10', @@ -175,8 +175,8 @@ def test_mqb_crc_ESP_05(self, subtests): b'\x3f\x8f\x82\x04\x00\x00\xe6\x30', ]) - def test_mqb_crc_ACC_10(self, subtests): - self.verify_mqb_crc(subtests, "ACC_10", 0x117, [ + def test_vw_mqb_crc_ACC_10(self, subtests): + self.verify_vw_mqb_crc(subtests, "ACC_10", 0x117, [ b'\x9b\x00\x00\x40\x68\x00\x00\xff', b'\xff\x01\x00\x40\x68\x00\x00\xff', b'\x53\x02\x00\x40\x68\x00\x00\xff', @@ -195,8 +195,8 @@ def test_mqb_crc_ACC_10(self, subtests): b'\xd9\x0f\x00\x40\x68\x00\x00\xff', ]) - def test_mqb_crc_TSK_06(self, subtests): - self.verify_mqb_crc(subtests, "TSK_06", 0x120, [ + def test_vw_mqb_crc_TSK_06(self, subtests): + self.verify_vw_mqb_crc(subtests, "TSK_06", 0x120, [ b'\xc1\x00\x00\x02\x00\x08\xff\x21', b'\x34\x01\x00\x02\x00\x08\xff\x21', b'\xcc\x02\x00\x02\x00\x08\xff\x21', @@ -215,8 +215,8 @@ def test_mqb_crc_TSK_06(self, subtests): b'\x0b\x0f\x00\x02\x00\x08\xff\x21', ]) - def test_mqb_crc_Motor_20(self, subtests): - self.verify_mqb_crc(subtests, "Motor_20", 0x121, [ + def test_vw_mqb_crc_Motor_20(self, subtests): + self.verify_vw_mqb_crc(subtests, "Motor_20", 0x121, [ b'\xb9\x00\x00\xc0\x39\x46\x7e\xfe', b'\x85\x31\x20\x00\x1a\x46\x7e\xfe', b'\xc7\x12\x00\x40\x1a\x46\x7e\xfe', @@ -235,8 +235,8 @@ def test_mqb_crc_Motor_20(self, subtests): b'\xaf\x0f\x20\x80\x39\x4c\x7e\xfe', ]) - def test_mqb_crc_ACC_06(self, subtests): - self.verify_mqb_crc(subtests, "ACC_06", 0x122, [ + def test_vw_mqb_crc_ACC_06(self, subtests): + self.verify_vw_mqb_crc(subtests, "ACC_06", 0x122, [ b'\x14\x80\x00\xfe\x07\x00\x00\x18', b'\x9f\x81\x00\xfe\x07\x00\x00\x18', b'\x0a\x82\x00\xfe\x07\x00\x00\x28', @@ -255,8 +255,8 @@ def test_mqb_crc_ACC_06(self, subtests): b'\x6f\x8f\x00\xfe\x07\x00\x00\x28', ]) - def test_mqb_crc_HCA_01(self, subtests): - self.verify_mqb_crc(subtests, "HCA_01", 0x126, [ + def test_vw_mqb_crc_HCA_01(self, subtests): + self.verify_vw_mqb_crc(subtests, "HCA_01", 0x126, [ b'\x00\x30\x0d\xc0\x05\xfe\x07\x00', b'\x3e\x31\x54\xc0\x05\xfe\x07\x00', b'\xa7\x32\xbb\x40\x05\xfe\x07\x00', @@ -275,8 +275,8 @@ def test_mqb_crc_HCA_01(self, subtests): b'\x9b\x3f\x20\x40\x05\xfe\x07\x00', ]) - def test_mqb_crc_GRA_ACC_01(self, subtests): - self.verify_mqb_crc(subtests, "GRA_ACC_01", 0x12B, [ + def test_vw_mqb_crc_GRA_ACC_01(self, subtests): + self.verify_vw_mqb_crc(subtests, "GRA_ACC_01", 0x12B, [ b'\x86\x40\x80\x2a\x00\x00\x00\x00', b'\xf4\x41\x80\x2a\x00\x00\x00\x00', b'\x50\x42\x80\x2a\x00\x00\x00\x00', @@ -295,8 +295,8 @@ def test_mqb_crc_GRA_ACC_01(self, subtests): b'\x0d\x4f\x80\x2a\x00\x00\x00\x00', ]) - def test_mqb_crc_ACC_07(self, subtests): - self.verify_mqb_crc(subtests, "ACC_07", 0x12E, [ + def test_vw_mqb_crc_ACC_07(self, subtests): + self.verify_vw_mqb_crc(subtests, "ACC_07", 0x12E, [ b'\xac\xe0\x7f\x00\xfe\x00\xc0\xff', b'\xa2\xe1\x7f\x00\xfe\x00\xc0\xff', b'\x6b\xe2\x7f\x00\xfe\x00\xc0\xff', @@ -315,8 +315,8 @@ def test_mqb_crc_ACC_07(self, subtests): b'\x85\xef\x7f\x00\xfe\x00\xc0\xff', ]) - def test_mqb_crc_Motor_EV_01(self, subtests): - self.verify_mqb_crc(subtests, "Motor_EV_01", 0x187, [ + def test_vw_mqb_crc_Motor_EV_01(self, subtests): + self.verify_vw_mqb_crc(subtests, "Motor_EV_01", 0x187, [ b'\x70\x80\x15\x00\x00\x00\x00\xF0', b'\x07\x81\x15\x00\x00\x00\x00\xF0', b'\x7A\x82\x15\x00\x00\x00\x00\xF0', @@ -335,8 +335,8 @@ def test_mqb_crc_Motor_EV_01(self, subtests): b'\x00\x8F\x15\x00\x00\x00\x00\xF0', ]) - def test_mqb_crc_SWA_01(self, subtests): - self.verify_mqb_crc(subtests, "SWA_01", 0x30F, [ + def test_vw_mqb_crc_SWA_01(self, subtests): + self.verify_vw_mqb_crc(subtests, "SWA_01", 0x30F, [ b'\x10\x00\x10\x00\x00\x00\x00\x00', b'\x74\x01\x10\x00\x00\x00\x00\x00', b'\xD8\x02\x10\x00\x00\x00\x00\x00', @@ -355,8 +355,8 @@ def test_mqb_crc_SWA_01(self, subtests): b'\x52\x0F\x10\x00\x00\x00\x00\x00', ]) - def test_mqb_crc_ACC_04(self, subtests): - self.verify_mqb_crc(subtests, "ACC_04", 0x324, [ + def test_vw_mqb_crc_ACC_04(self, subtests): + self.verify_vw_mqb_crc(subtests, "ACC_04", 0x324, [ b'\xba\x00\x00\x00\x00\x00\x00\x10', b'\xde\x01\x00\x00\x00\x00\x00\x10', b'\x72\x02\x00\x00\x00\x00\x00\x10', @@ -375,8 +375,8 @@ def test_mqb_crc_ACC_04(self, subtests): b'\xdd\x0f\x00\x00\x00\x00\x00\x00', ]) - def test_mqb_crc_Klemmen_Status_01(self, subtests): - self.verify_mqb_crc(subtests, "Klemmen_Status_01", 0x3C0, [ + def test_vw_mqb_crc_Klemmen_Status_01(self, subtests): + self.verify_vw_mqb_crc(subtests, "Klemmen_Status_01", 0x3C0, [ b'\x74\x00\x03\x00', b'\xc1\x01\x03\x00', b'\x31\x02\x03\x00', @@ -395,8 +395,8 @@ def test_mqb_crc_Klemmen_Status_01(self, subtests): b'\x35\x0f\x03\x00', ]) - def test_mqb_crc_ESP_20(self, subtests): - self.verify_mqb_crc(subtests, "ESP_20", 0x65D, [ + def test_vw_mqb_crc_ESP_20(self, subtests): + self.verify_vw_mqb_crc(subtests, "ESP_20", 0x65D, [ b'\x98\x30\x2b\x10\x00\x00\x22\x81', b'\xc8\x31\x2b\x10\x00\x00\x22\x81', b'\x9d\x32\x2b\x10\x00\x00\x22\x81',