@@ -70,7 +70,7 @@ def __repr__(self) -> str:
7070 else :
7171 args = [
7272 f"timestamp={ self .timestamp } " ,
73- f"arbitration_id={ self .arbitration_id :#x} " ,
73+ f"arbitration_id={ self .arbitration_id : #x} " ,
7474 f"is_extended_id={ self .is_extended_id } " ,
7575 ]
7676
@@ -86,7 +86,7 @@ def __repr__(self) -> str:
8686 if self .channel is not None :
8787 args .append (f"channel={ self .channel !r} " )
8888
89- data = [f"{ byte :#02x} " for byte in self .data ]
89+ data = [f"{ byte : #02x} " for byte in self .data ]
9090 args += [f"dlc={ self .dlc } " , f"data=[{ ', ' .join (data )} ]" ]
9191
9292 if self .is_fd :
@@ -184,7 +184,14 @@ def _parse_msg_v2_x(self, cols: List[str] | Tuple[str]) -> Optional[Message]:
184184
185185 channel = int (cols [bus ]) if bus is not None else 1
186186 dlc = dlc
187- data = bytearray ([int (cols [i + self .columns ["D" ]], 16 ) for i in range (length )])
187+
188+ # Parse data - handle space-separated hex values in a single column
189+ data = bytearray (length )
190+ if length > 0 and self .columns ["D" ] < len (cols ) and cols [self .columns ["D" ]].strip ():
191+ hex_values = cols [self .columns ["D" ]].strip ().split ()
192+ parsed_bytes = [int (val , 16 ) for val in hex_values if val ]
193+ data [: len (parsed_bytes )] = parsed_bytes
194+
188195 is_rx = cols [self .columns ["d" ]] == "Rx"
189196 is_fd = type_ in ["FD" , "FB" , "FE" , "BI" ]
190197 bitrate_switch = type_ in ["FB" , " FE" ]
@@ -246,11 +253,11 @@ def _format_message_by_format(self, msg: TypedMessage, channel: int):
246253 arb_id = f"{ msg .arbitration_id } "
247254 else :
248255 if msg .is_extended_id :
249- arb_id = f"{ msg .arbitration_id :07X} "
256+ arb_id = f"{ msg .arbitration_id : 07X} "
250257 else :
251- arb_id = f"{ msg .arbitration_id :04X} "
258+ arb_id = f"{ msg .arbitration_id : 04X} "
252259
253- data = [f"{ byte :02X} " for byte in msg .data ]
260+ data = [f"{ byte : 02X} " for byte in msg .data ]
254261
255262 # For the time python-can was doing subtraction with the first message timestamp
256263 # which is incorrect. It should be with the start time of the trace otherwise the
0 commit comments