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
+3 -2
View File
@@ -730,6 +730,7 @@ int main(int argc, char **argv)
if (canfd) {
mtu = CANFD_MTU;
maxdlen = CANFD_MAX_DLEN;
frame.flags |= CANFD_FDF;
if (brs)
frame.flags |= CANFD_BRS;
if (esi)
@@ -830,9 +831,9 @@ int main(int argc, char **argv)
printf(" %s ", argv[optind]);
if (verbose > 1)
fprint_long_canframe(stdout, &frame, "\n", (verbose > 2) ? 1 : 0, maxdlen);
fprint_long_canframe(stdout, &frame, "\n", (verbose > 2) ? 1 : 0);
else
fprint_canframe(stdout, &frame, "\n", 1, maxdlen);
fprint_canframe(stdout, &frame, "\n", 1);
}
ret = do_send_one(s, &frame, mtu, polltimeout);