From 16e26e2e4861c8083a54fa47c520e5e5d03d7c84 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Wed, 13 Mar 2024 15:47:28 +0100 Subject: [PATCH 1/3] UDS: avoid endless recursion in deprecated function Signed-off-by: Andreas Lauser Signed-off-by: Christian Hackenbeck --- odxtools/uds.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odxtools/uds.py b/odxtools/uds.py index fb8219a6..cfe8ce51 100644 --- a/odxtools/uds.py +++ b/odxtools/uds.py @@ -175,4 +175,4 @@ def is_response_pending(telegram_payload: bytes, request_sid: Optional[int] = No # previous versions of odxtools had a typo here. hit happens! @deprecated(details="use is_response_pending()") # type: ignore[misc] def is_reponse_pending(telegram_payload: bytes, request_sid: Optional[int] = None) -> bool: - return is_reponse_pending(telegram_payload, request_sid) # type: ignore[no-any-return] + return is_response_pending(telegram_payload, request_sid) From 90c2bff10da8ccf1f9ae04435a269f3696b62d6d Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Wed, 13 Mar 2024 15:48:09 +0100 Subject: [PATCH 2/3] isotp_state_machine: fix unpacking of frame type Signed-off-by: Andreas Lauser Signed-off-by: Christian Hackenbeck --- odxtools/isotp_state_machine.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odxtools/isotp_state_machine.py b/odxtools/isotp_state_machine.py index f6591651..75e4b4df 100644 --- a/odxtools/isotp_state_machine.py +++ b/odxtools/isotp_state_machine.py @@ -55,7 +55,7 @@ def decode_rx_frame(self, rx_id: int, data: bytes) -> Iterable[Tuple[int, bytes] return # unknown CAN ID # decode the isotp segment - frame_type, _ = bitstruct.unpack("u4", data) + frame_type, _ = bitstruct.unpack("u4u4", data) assert isinstance(frame_type, int) telegram_len = None From d69a7b2e16ae390a1f4e1ca25d354e7fefa7e1f8 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Wed, 13 Mar 2024 16:09:03 +0100 Subject: [PATCH 3/3] ReservedParameter: do not advance the cursor position twice `DecodeState.extract_atomic_value()` already does this. This caused decode errors for objects that contained reserved parameters... Signed-off-by: Andreas Lauser Signed-off-by: Christian Hackenbeck --- odxtools/parameters/reservedparameter.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/odxtools/parameters/reservedparameter.py b/odxtools/parameters/reservedparameter.py index 56af745b..c44b3482 100644 --- a/odxtools/parameters/reservedparameter.py +++ b/odxtools/parameters/reservedparameter.py @@ -54,8 +54,6 @@ def get_coded_value_as_bytes(self, encode_state: EncodeState) -> bytes: @override def _decode_positioned_from_pdu(self, decode_state: DecodeState) -> ParameterValue: - decode_state.cursor_byte_position += ((self.bit_position or 0) + self.bit_length + 7) // 8 - return decode_state.extract_atomic_value( bit_length=self.bit_length, base_data_type=DataType.A_UINT32,