From 4848338f50eb62d74a60d3fd6a5ced5657d34cc7 Mon Sep 17 00:00:00 2001 From: Tennessee Carmel-Veilleux Date: Wed, 17 Nov 2021 17:12:02 -0500 Subject: [PATCH] Fix Python TLV codec for fully-qualified tags Python TLV codec mis-encoded fully qualified tags, reversing the vendorId and profileNum. - Fix the encoding order to match spec Testing done: manual inspection of the values encoded and still pass the round-trip self-test --- src/controller/python/chip/tlv/__init__.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/controller/python/chip/tlv/__init__.py b/src/controller/python/chip/tlv/__init__.py index 6af218fdf73338..e6887dea3463b3 100644 --- a/src/controller/python/chip/tlv/__init__.py +++ b/src/controller/python/chip/tlv/__init__.py @@ -384,12 +384,14 @@ def _encodeControlAndTag(self, type, tag, lenOfLenOrVal=0): controlByte |= TLV_TAG_CONTROL_COMMON_PROFILE_4Bytes return struct.pack("> 16) & 0xFFFF + profileNum = (profile >> 0) & 0xFFFF if tagNum <= UINT16_MAX: controlByte |= TLV_TAG_CONTROL_FULLY_QUALIFIED_6Bytes - return struct.pack("