j1939 - first steps
Hi Kurt,
following the idea from Marc (cloning linux-stable, check-out 3.7.10, adding j1939 branch, applying the j1939-3.7 branch) i managed to get my linux-box working with your stack.
Following the documentation, i did this (as root):
./ip link set vcan0 j1939 on
./ip addr show vcan0
./ip addr add dev vcan0 j1939 0x22
./ip addr show vcan0
6: vcan0: <NOARP,UP,LOWER_UP> mtu 72 qdisc noqueue state UNKNOWN
link/can
can-j1939 0x22 scope linkAnd this (as user):
./jsr -v vcan0:0x22
./jsr: bind(vcan0:0000000000000022), -99: Cannot assign requested address
./jsr -v 0x22
./jsr: bind(#34:-), -19: No such device
./jsr -v 22
./jsr: bind(#22:-), -19: No such device
Any idea?
Regards,
Oliver
Quoted 8 lines · Oliver Hartkopp
Hi Kurt,
following the idea from Marc (cloning linux-stable, check-out 3.7.10, adding j1939 branch, applying the j1939-3.7 branch) i managed to get my linux-box working with your stack.
Following the documentation, i did this (as root):
Quoted 7 lines
./ip link set vcan0 j1939 on
./ip addr show vcan0
./ip addr add dev vcan0 j19390x22
./ip addr show vcan0
6: vcan0: <NOARP,UP,LOWER_UP> mtu 72 qdisc noqueue state UNKNOWNlink/can can-j1939 0x22 scope link
static addressing, ok.
Quoted 4 lines
And this (as user):
./jsr -v vcan0:0x22
you should use 'vcan0:,0x22'.
The format is: 'IFACE:<NAME>[,<ADDR>]'
Better proposals to combine dynamic & static addressing in strings?
Quoted 1 line
./jsr: bind(vcan0:0000000000000022), -99: Cannot assign requested address
indeed. The 64bit name 00...0022 is tried.
Kind regards,
Kurt
Quoted 9 lines · Kurt Van Dijck
Quoted 3 lines · Oliver Hartkopp
And this (as user):
./jsr -v vcan0:0x22
you should use 'vcan0:,0x22'.
The format is: 'IFACE:<NAME>[,<ADDR>]'
./jsr -?
jsr: An SAE J1939 send/recv utility
Usage: jsr [OPTION...] SOURCE [DEST]
-v, --verbose Increase verbosity -p, --priority=VAL J1939 priority (0..7, default 6) -S, --serialize Strictly serialize outgoing packets -s, --size Packet size, default autodetected
SOURCE [IFACE:][NAME|SA][,PGN]
DEST [NAME|SA]
Tells me something else ;-)
Btw. with your hint it works:
./jsr -v vcan0:,0x22
1122334455
112233
123123123123
112233445566778899AABBCCDDEEFF112233
leads to:
$ candump -ta any (1363674992.322459) vcan0 18ECFF22 [8] 20 0B 00 02 FF 00 00 00 (1363674992.372643) vcan0 18EBFF22 [8] 01 31 31 32 32 33 33 34 (1363674992.422713) vcan0 18EBFF22 [5] 02 34 35 35 0A (1363674999.306921) vcan0 1800FF22 [7] 31 31 32 32 33 33 0A (1363675021.549579) vcan0 18ECFF22 [8] 20 0D 00 02 FF 00 00 00 (1363675021.599657) vcan0 18EBFF22 [8] 01 31 32 33 31 32 33 31 (1363675021.649719) vcan0 18EBFF22 [7] 02 32 33 31 32 33 0A (1363675049.932595) vcan0 18ECFF22 [8] 20 25 00 06 FF 00 00 00 (1363675049.982647) vcan0 18EBFF22 [8] 01 31 31 32 32 33 33 34 (1363675050.032709) vcan0 18EBFF22 [8] 02 34 35 35 36 36 37 37 (1363675050.082781) vcan0 18EBFF22 [8] 03 38 38 39 39 41 41 42 (1363675050.132851) vcan0 18EBFF22 [8] 04 42 43 43 44 44 45 45 (1363675050.182893) vcan0 18EBFF22 [8] 05 46 46 31 31 32 32 33 (1363675050.232954) vcan0 18EBFF22 [3] 06 33 0A
First time to see j1939 on my linux box, yeah!
Best regards,
Oliver
Quoted 22 lines · Oliver Hartkopp
Quoted 9 lines · Kurt Van Dijck
Quoted 3 lines · Oliver Hartkopp
And this (as user):
./jsr -v vcan0:0x22
you should use 'vcan0:,0x22'.
The format is: 'IFACE:<NAME>[,<ADDR>]'./jsr -?
jsr: An SAE J1939 send/recv utility
Usage: jsr [OPTION...] SOURCE [DEST]-v, --verbose Increase verbosity -p, --priority=VAL J1939 priority (0..7, default 6) -S, --serialize Strictly serialize outgoing packets -s, --size Packet size, default autodetected
Quoted 4 lines
SOURCE [IFACE:][NAME|SA][,PGN]
DEST [NAME|SA]Tells me something else ;-)
I looked into the parser (can-utils/libj1939.c):
You should have omitted the 0x prefix.
jsr operates in hex (currently) by default.
I'll look for modifying this to be more intuitive.
Quoted 4 lines
Btw. with your hint it works:
./jsr -v vcan0:,0x22
Yep, it is equal to './jsr -v vcan0'.
Quoted 22 lines
1122334455
112233
123123123123
112233445566778899AABBCCDDEEFF112233leads to:
$ candump -ta any (1363674992.322459) vcan0 18ECFF22 [8] 20 0B 00 02 FF 00 00 00 (1363674992.372643) vcan0 18EBFF22 [8] 01 31 31 32 32 33 33 34 (1363674992.422713) vcan0 18EBFF22 [5] 02 34 35 35 0A (1363674999.306921) vcan0 1800FF22 [7] 31 31 32 32 33 33 0A (1363675021.549579) vcan0 18ECFF22 [8] 20 0D 00 02 FF 00 00 00 (1363675021.599657) vcan0 18EBFF22 [8] 01 31 32 33 31 32 33 31 (1363675021.649719) vcan0 18EBFF22 [7] 02 32 33 31 32 33 0A (1363675049.932595) vcan0 18ECFF22 [8] 20 25 00 06 FF 00 00 00 (1363675049.982647) vcan0 18EBFF22 [8] 01 31 31 32 32 33 33 34 (1363675050.032709) vcan0 18EBFF22 [8] 02 34 35 35 36 36 37 37 (1363675050.082781) vcan0 18EBFF22 [8] 03 38 38 39 39 41 41 42 (1363675050.132851) vcan0 18EBFF22 [8] 04 42 43 43 44 44 45 45 (1363675050.182893) vcan0 18EBFF22 [8] 05 46 46 31 31 32 32 33 (1363675050.232954) vcan0 18EBFF22 [3] 06 33 0A
Quoted 1 line
First time to see j1939 on my linux box, yeah!
congratulations.
Next step is to use flow control with transport protocol:
$ ./ip addr add dev vcan0 j1939 0x23 $ ./jsr -v vcan0:22,12345 23
And watch the can_id's & timestamps
Kind regards,
Kurt
Quoted 22 lines · Oliver Hartkopp
Quoted 9 lines · Kurt Van Dijck
Quoted 3 lines · Oliver Hartkopp
And this (as user):
./jsr -v vcan0:0x22
you should use 'vcan0:,0x22'.
The format is: 'IFACE:<NAME>[,<ADDR>]'./jsr -?
jsr: An SAE J1939 send/recv utility
Usage: jsr [OPTION...] SOURCE [DEST]-v, --verbose Increase verbosity -p, --priority=VAL J1939 priority (0..7, default 6) -S, --serialize Strictly serialize outgoing packets -s, --size Packet size, default autodetected
Quoted 4 lines
SOURCE [IFACE:][NAME|SA][,PGN]
DEST [NAME|SA]Tells me something else ;-)
Oliver, how about this change in the docs. Would that have avoided this confusion (on both sides).
jacd.c +2 -1
@@ -39,7 +39,8 @@ static const char help_msg[] ="NAME is the 64bit nodename" "\n" "\n" "Example:" "\n" -"jacd -r 100,80-120 -c /tmp/1122334455667788.jacd 1122334455667788" "\n" +" $ jacd -r 100,80-120 -c /tmp/0123456789abcdef.jacd" +" 0123456789abcdef" "\n" ;#ifdef _GNU_SOURCE
jspy.c +4 -0
@@ -37,6 +37,10 @@ static const char help_msg[] =" (= receive traffic not for this ECU)" "\n" " -b, --block=SIZE Use a receive buffer of SIZE (default 1024)" "\n" " -t, --time[=a|d|z|A] Show time: (a)bsolute, (d)elta, (z)ero, (A)bsolute w date" "\n" +"\n" +" NAME, SA & PGN are in hex, without 0x prefix.\n" +" Example\n: + " $ jpy can0:,0ea00\n" ;#ifdef _GNU_SOURCE
jsr.c +4 -0
@@ -40,6 +40,10 @@ static const char help_msg[] ="\n" " SOURCE [IFACE:][NAME|SA][,PGN]" "\n" " DEST [NAME|SA]" "\n" +"\n" +" NAME, SA & PGN are in hex, without 0x prefix.\n" +"Example:\n" +" $ jsr can0:0123456789abcdef,0da00 22\n" ;#ifdef _GNU_SOURCE
Marc Kleine-Budde
maintainerQuoted 50 lines · Kurt Van Dijck
Quoted 22 lines · Oliver Hartkopp
Quoted 9 lines · Kurt Van Dijck
Quoted 3 lines · Oliver Hartkopp
And this (as user):
./jsr -v vcan0:0x22
you should use 'vcan0:,0x22'.
The format is: 'IFACE:<NAME>[,<ADDR>]'./jsr -?
jsr: An SAE J1939 send/recv utility
Usage: jsr [OPTION...] SOURCE [DEST]-v, --verbose Increase verbosity -p, --priority=VAL J1939 priority (0..7, default 6) -S, --serialize Strictly serialize outgoing packets -s, --size Packet size, default autodetectedQuoted 4 lines
SOURCE [IFACE:][NAME|SA][,PGN]
DEST [NAME|SA]Tells me something else ;-)
Oliver, how about this change in the docs. Would that have avoided this confusion (on both sides).
jacd.c +2
-1@@ -39,7 +39,8 @@ static const char help_msg[] ="NAME is the 64bit nodename" "\n" "\n" "Example:" "\n" -"jacd -r 100,80-120 -c /tmp/1122334455667788.jacd 1122334455667788" "\n" +" $ jacd -r 100,80-120 -c /tmp/0123456789abcdef.jacd" +" 0123456789abcdef" "\n" ;#ifdef _GNU_SOURCEjspy.c +0
-0
jspy.c static const char help_msg[] = · line 41
Quoted 5 lines
jspy.c +2
-0@@ -37,6 +37,10 @@ static const char help_msg[] =" (= receive traffic not for this ECU)" "\n" " -b, --block=SIZE Use a receive buffer of SIZE (default 1024)" "\n" " -t, --time[=a|d|z|A] Show time: (a)bsolute, (d)elta, (z)ero, (A)bsolute w date" "\n" +"\n" +" NAME, SA & PGN are in hex, without 0x prefix.\n"
What do you use to parse these numbers?
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
Quoted 44 lines · Marc Kleine-Budde
Quoted 43 lines · Kurt Van Dijck
Quoted 21 lines · Oliver Hartkopp
Quoted 8 lines · Kurt Van Dijck
Quoted 3 lines · Oliver Hartkopp
And this (as user):
./jsr -v vcan0:0x22
you should use 'vcan0:,0x22'.
./jsr -?
jsr: An SAE J1939 send/recv utility
Usage: jsr [OPTION...] SOURCE [DEST]-v, --verbose Increase verbosity -p, --priority=VAL J1939 priority (0..7, default 6) -S, --serialize Strictly serialize outgoing packets -s, --size Packet size, default autodetectedQuoted 4 lines
SOURCE [IFACE:][NAME|SA][,PGN]
DEST [NAME|SA]Tells me something else ;-)
Oliver, how about this change in the docs. Would that have avoided this confusion (on both sides).
jacd.c +2
-1@@ -39,7 +39,8 @@ static const char help_msg[] ="NAME is the 64bit nodename" "\n" "\n" "Example:" "\n" -"jacd -r 100,80-120 -c /tmp/1122334455667788.jacd 1122334455667788" "\n" +" $ jacd -r 100,80-120 -c /tmp/0123456789abcdef.jacd" +" 0123456789abcdef" "\n" ;
Quoted 13 lines
jspy.c static const char help_msg[] = · line 41
Quoted 11 lines
jacd.c +0
-0#ifdef _GNU_SOURCEjspy.c +2
-0@@ -37,6 +37,10 @@ static const char help_msg[] =" (= receive traffic not for this ECU)" "\n" " -b, --block=SIZE Use a receive buffer of SIZE (default 1024)" "\n" " -t, --time[=a|d|z|A] Show time: (a)bsolute, (d)elta, (z)ero, (A)bsolute w date" "\n" +"\n" +" NAME, SA & PGN are in hex, without 0x prefix.\n" What do you use to parse these numbers?
strtoul(str, &endp, 16); ^^^^
The use is very similar to cansend, I believe, where a can_id of exactly 8 hex chars long means 29bit, and shorter means 11bit.
Implicitely, everything is told to be in hex, without 0x.
And because this was not clear, Oliver got himself a 64bit nodename as strlen(0x22) > 2 :-)
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
The format is: 'IFACE:<NAME>[,<ADDR>]'
And my first attempt to help him, out of the head, was a 'legacy thought', not good either. always check the code :-)
Kurt
Quoted 11 lines · Kurt Van Dijck
Quoted 1 line · Marc Kleine-Budde
What do you use to parse these numbers?
strtoul(str, &endp, 16); ^^^^The use is very similar to cansend, I believe, where a
can_idof exactly 8 hex chars long means 29bit, and shorter means 11bit.
Implicitely, everything is told to be in hex, without 0x.And because this was not clear, Oliver got himself a 64bit nodename as strlen(0x22) > 2 :-)
Yes that was my trap. I've seen the strlen but it didn't help me %-)
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
The format is: 'IFACE:<NAME>[,<ADDR>]'
And my first attempt to help him, out of the head, was a 'legacy thought', not good either. always check the code :-)
Regards,
Oliver