Currently if we send lots of bytes, test1939 output will get unreadable.
Make it easier to read by splitting output dump.
New format will looks as following example:
root@DistroKit:~ testj1939 can0:0x90 -r
80 12300: 01 23 45 67 89 ab cd ef
00008 01 23 45 67 89 ab cd ef
00010 01 23 45 67 89 ab cd ef
00018 01 23 45 67 89 ab cd ef
00020 01 23 45 67 89 ab cd ef
00028 01 23 45 67 89 ab cd ef
00030 01 23 45 67 89 ab cd ef
00038 01 23 45 67 89 ab cd ef
00040 01 23 45 67 89 ab cd ef
00048 01 23 45 67 89 ab cd ef
00050 01 23 45 67 89 ab cd ef
00058 01 23 45 67 89 ab cd ef
00060 01 23 45 67 89 ab cd ef
00068 01 23 45 67 89 ab cd ef
00070 01 23 45 67 89 ab cd ef
00078 01 23 45 67 89 ab cd ef
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Currently if we set size which is more then 128 byte
will silently ignore provided value and send only maximal
supported size.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
This option is needed for j1939 socket functionality test.
Connects wihout bind should not work.
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
This option is needed for j1939 socket functionality test.
Binding to a socket and rebinding to the socket with e.g. a different SA
should work.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
canaddr2str() from testj1939 and libj1939's libj1939_addr2str provide
the same functionality. Remove the local helper function and use
libj1939_addr2str instead.
Signed-off-by: Bastian Stender <bst@pengutronix.de>
testj1939.c: In function 'main':
testj1939.c:201:3: warning: format '%li' expects argument of type 'long int', but argument 4 has type 'unsigned int' [-Wformat=]
fprintf(stderr, "- bind(, %s, %li);\n", canaddr2str(&sockname), sizeof(sockname));
^
testj1939.c:210:4: warning: format '%li' expects argument of type 'long int', but argument 4 has type 'unsigned int' [-Wformat=]
fprintf(stderr, "- connect(, %s, %li);\n", canaddr2str(&peername), sizeof(peername));
^
testj1939.c:228:5: warning: format '%li' expects argument of type 'long int', but argument 5 has type 'unsigned int' [-Wformat=]
fprintf(stderr, "- sendto(, <dat>, %i, 0, %s, %li);\n", todo_send, canaddr2str(&peername), sizeof(peername));
^
testj1939.c:254:4: warning: format '%li' expects argument of type 'long int', but argument 3 has type 'unsigned int' [-Wformat=]
fprintf(stderr, "- recvfrom(, <dat>, %li, 0, &<peername>, %li);\n", sizeof(peername), sizeof(peername));
^
testj1939.c:254:4: warning: format '%li' expects argument of type 'long int', but argument 4 has type 'unsigned int' [-Wformat=]
Use 'z' as correct modifier to print sizeof().
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>