Skip to content

channel2int() defect in Vector ASC conversion (from SocketCAN log format) ?? #1268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hartkopp opened this issue Mar 1, 2022 · 1 comment · Fixed by #1269
Closed

channel2int() defect in Vector ASC conversion (from SocketCAN log format) ?? #1268

hartkopp opened this issue Mar 1, 2022 · 1 comment · Fixed by #1269
Labels
Milestone

Comments

@hartkopp
Copy link
Collaborator

hartkopp commented Mar 1, 2022

def channel2int(channel: Optional[typechecking.Channel]) -> Optional[int]:

I did some tests with BLF/ASC/LOG conversions and discovered a problem with the latest develop branch (at least):

Usually the CAN interface names for SocketCAN look like can0, can1, vcan12 and so on. The BLF to LOG conversion lead to CAN interface names that are numbers like 1, 2, 33 - which is unusual but works too.

When converting a LOG file to ASC the channel2int() function should assign unique CAN interface numbers for the converted CAN interfaces for the ASC file. In the logfile below channel2int() maps two CAN interfaces can1 and can11 to the same CAN interface number 2 - which is definitely wrong:

Converting a SocketCAN logfile with (unusual) numbers as CAN interface names:

(1643782223.031881) 11 128#70000000000000 R
(1643782223.032020) 1 206##160E87E0000F80F0000000000000000000800FE03000010F4 R
(1643782223.032033) 11 148#100000 R
(1643782223.032041) 14 12DD54DB##1000000000000000000000000000000000000000000000000 R
(1643782223.032059) 7 5E9##100FF1F7FFF070000 R
(1643782223.032077) 4 268##10000FFFFF7FF7FFFFFF7FF7FFFFFFFFFFF000000000000000000000000000000 R
(1643782223.032241) 11 118#D20000000003 R
(1643782223.032244) 1 0B6##1E30A058005800003805A78000280028000000000000000000000000000000000 R
(1643782223.032415) 11 138#10000000 R
(1643782223.032492) 14 0B6##1E30A058005800003805A78000280028000000000000000000000000000000000 R
(1643782223.032515) 1 1BFDDA0A##1E48B8C2B80808080000000000000000000000000000000000000000000000000 R
(1643782223.032625) 1 09F##1950DFE4F006A80F0 R
(1643782223.032756) 4 09F##1950DFE4F006A80F0 R
(1643782223.032762) 14 09F##1950DFE4F006A80F0 R

results in

date Tue Mar 01 08:01:42.462503 PM 2022
base hex  timestamps absolute
internal events logged
Begin Triggerblock Wed Feb 02 07:10:23.031 AM 2022
 0.000000 Start of measurement
 0.000000 12  128             Rx   d 7 70 00 00 00 00 00 00
 0.000139 CANFD   2 Rx        206                                   1 0 c 24 60 E8 7E 00 00 F8 0F 00 00 00 00 00 00 00 00 00 08 00 FE 03 00 00 10 F4        0    0     3000        0        0        0        0        0
 0.000152 12  148             Rx   d 3 10 00 00
 0.000160 CANFD  15 Rx   12DD54DBx                                   1 0 c 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00        0    0     3000        0        0        0        0        0
 0.000178 CANFD   8 Rx        5E9                                   1 0 8  8 00 FF 1F 7F FF 07 00 00        0    0     3000        0        0        0        0        0
 0.000196 CANFD   5 Rx        268                                   1 0 d 32 00 00 FF FF F7 FF 7F FF FF F7 FF 7F FF FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00        0    0     3000        0        0        0        0        0
 0.000360 12  118             Rx   d 6 D2 00 00 00 00 03
 0.000363 CANFD   2 Rx         B6                                   1 0 d 32 E3 0A 05 80 05 80 00 03 80 5A 78 00 02 80 02 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00        0    0     3000        0        0        0        0        0
 0.000534 12  138             Rx   d 4 10 00 00 00
 0.000611 CANFD  15 Rx         B6                                   1 0 d 32 E3 0A 05 80 05 80 00 03 80 5A 78 00 02 80 02 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00        0    0     3000        0        0        0        0        0
 0.000634 CANFD   2 Rx   1BFDDA0Ax                                   1 0 d 32 E4 8B 8C 2B 80 80 80 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00        0    0     3000        0        0        0        0        0
 0.000744 CANFD   2 Rx         9F                                   1 0 8  8 95 0D FE 4F 00 6A 80 F0        0    0     3000        0        0        0        0        0
 0.000875 CANFD   5 Rx         9F                                   1 0 8  8 95 0D FE 4F 00 6A 80 F0        0    0     3000        0        0        0        0        0
 0.000881 CANFD  15 Rx         9F                                   1 0 8  8 95 0D FE 4F 00 6A 80 F0        0    0     3000        0        0        0        0        0
End TriggerBlock

Which is ok!

Converting a SocketCAN logfile with usual CAN interface names (like can3):

(1643782223.031881) can11 128#70000000000000 R
(1643782223.032020) can1 206##160E87E0000F80F0000000000000000000800FE03000010F4 R
(1643782223.032033) can11 148#100000 R
(1643782223.032041) can14 12DD54DB##1000000000000000000000000000000000000000000000000 R
(1643782223.032059) can7 5E9##100FF1F7FFF070000 R
(1643782223.032077) can4 268##10000FFFFF7FF7FFFFFF7FF7FFFFFFFFFFF000000000000000000000000000000 R
(1643782223.032241) can11 118#D20000000003 R
(1643782223.032244) can1 0B6##1E30A058005800003805A78000280028000000000000000000000000000000000 R
(1643782223.032415) can11 138#10000000 R
(1643782223.032492) can14 0B6##1E30A058005800003805A78000280028000000000000000000000000000000000 R
(1643782223.032515) can1 1BFDDA0A##1E48B8C2B80808080000000000000000000000000000000000000000000000000 R
(1643782223.032625) can1 09F##1950DFE4F006A80F0 R
(1643782223.032756) can4 09F##1950DFE4F006A80F0 R
(1643782223.032762) can14 09F##1950DFE4F006A80F0 R

leads to an assignment of can11 and can1 to the same CAN interface number 2

date Tue Mar 01 08:01:33.411783 PM 2022
base hex  timestamps absolute
internal events logged
Begin Triggerblock Wed Feb 02 07:10:23.031 AM 2022
 0.000000 Start of measurement
 0.000000 2  128             Rx   d 7 70 00 00 00 00 00 00
 0.000139 CANFD   2 Rx        206                                   1 0 c 24 60 E8 7E 00 00 F8 0F 00 00 00 00 00 00 00 00 00 08 00 FE 03 00 00 10 F4        0    0     3000        0        0        0        0        0
 0.000152 2  148             Rx   d 3 10 00 00
 0.000160 CANFD   5 Rx   12DD54DBx                                   1 0 c 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00        0    0     3000        0        0        0        0        0
 0.000178 CANFD   8 Rx        5E9                                   1 0 8  8 00 FF 1F 7F FF 07 00 00        0    0     3000        0        0        0        0        0
 0.000196 CANFD   5 Rx        268                                   1 0 d 32 00 00 FF FF F7 FF 7F FF FF F7 FF 7F FF FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00        0    0     3000        0        0        0        0        0
 0.000360 2  118             Rx   d 6 D2 00 00 00 00 03
 0.000363 CANFD   2 Rx         B6                                   1 0 d 32 E3 0A 05 80 05 80 00 03 80 5A 78 00 02 80 02 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00        0    0     3000        0        0        0        0        0
 0.000534 2  138             Rx   d 4 10 00 00 00
 0.000611 CANFD   5 Rx         B6                                   1 0 d 32 E3 0A 05 80 05 80 00 03 80 5A 78 00 02 80 02 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00        0    0     3000        0        0        0        0        0
 0.000634 CANFD   2 Rx   1BFDDA0Ax                                   1 0 d 32 E4 8B 8C 2B 80 80 80 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00        0    0     3000        0        0        0        0        0
 0.000744 CANFD   2 Rx         9F                                   1 0 8  8 95 0D FE 4F 00 6A 80 F0        0    0     3000        0        0        0        0        0
 0.000875 CANFD   5 Rx         9F                                   1 0 8  8 95 0D FE 4F 00 6A 80 F0        0    0     3000        0        0        0        0        0
 0.000881 CANFD   5 Rx         9F                                   1 0 8  8 95 0D FE 4F 00 6A 80 F0        0    0     3000        0        0        0        0        0
End TriggerBlock

Which is wrong!

@zariiii9003 zariiii9003 added the bug label Mar 2, 2022
@zariiii9003
Copy link
Collaborator

Thanks for reporting and locating the problem. There's a small error in the channel2int regular expression.

@felixdivo felixdivo added this to the 4.0.1 milestone Mar 8, 2022
@felixdivo felixdivo modified the milestones: 4.0.1, 4.1.0 Nov 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants