lib: integrate CAN FD indicator into dual-use struct canfd_frame

Replace maxdlen parameter and use CANFD_FDF flags instead.

Since the CANFD_FDF flag has been introduced in can.h the struct canfd_frame
can be used for CAN CC and CAN FD frames as a dual-use data structure.

Remove the extra maxdlen parameter in library calls and only use the
CANFD_FDF flag to differentiate the two CAN CC/FD frames.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
This commit is contained in:
Oliver Hartkopp
2024-02-24 11:28:35 +01:00
parent c6f4cbcaa7
commit 2522ec127b
8 changed files with 78 additions and 60 deletions
+2 -6
View File
@@ -470,7 +470,7 @@ int main(int argc, char **argv)
} else if (txidx > 0) { /* only send to valid CAN devices */
txmtu = parse_canframe(ascframe, &frame);
txmtu = parse_canframe(ascframe, &frame); /* dual-use frame */
if (!txmtu) {
fprintf(stderr, "wrong CAN frame format: '%s'!", ascframe);
return 1;
@@ -486,11 +486,7 @@ int main(int argc, char **argv)
if (verbose) {
printf("%s (%s) ", get_txname(device), device);
if (txmtu == CAN_MTU)
fprint_long_canframe(stdout, &frame, "\n", CANLIB_VIEW_INDENT_SFF, CAN_MAX_DLEN);
else
fprint_long_canframe(stdout, &frame, "\n", CANLIB_VIEW_INDENT_SFF, CANFD_MAX_DLEN);
fprint_long_canframe(stdout, &frame, "\n", CANLIB_VIEW_INDENT_SFF);
}
if (count && (--count == 0))