* j1939 - first steps
@ 2013-03-18 20:13 Oliver Hartkopp
2013-03-18 21:41 ` Kurt Van Dijck
0 siblings, 1 reply; 8+ messages in thread
From: Oliver Hartkopp @ 2013-03-18 20:13 UTC (permalink / raw)
To: Kurt Van Dijck; +Cc: linux-can
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 link
And 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: j1939 - first steps
2013-03-18 20:13 j1939 - first steps Oliver Hartkopp
@ 2013-03-18 21:41 ` Kurt Van Dijck
2013-03-19 6:52 ` Oliver Hartkopp
0 siblings, 1 reply; 8+ messages in thread
From: Kurt Van Dijck @ 2013-03-18 21:41 UTC (permalink / raw)
To: Oliver Hartkopp; +Cc: linux-can
On Mon, Mar 18, 2013 at 09:13:33PM +0100, Oliver Hartkopp wrote:
> 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 link
static addressing, ok.
>
> 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?
> ./jsr: bind(vcan0:0000000000000022), -99: Cannot assign requested address
indeed. The 64bit name 00...0022 is tried.
Kind regards,
Kurt
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: j1939 - first steps
2013-03-18 21:41 ` Kurt Van Dijck
@ 2013-03-19 6:52 ` Oliver Hartkopp
2013-03-20 9:07 ` Kurt Van Dijck
2013-03-20 19:24 ` Kurt Van Dijck
0 siblings, 2 replies; 8+ messages in thread
From: Oliver Hartkopp @ 2013-03-19 6:52 UTC (permalink / raw)
To: Kurt Van Dijck; +Cc: linux-can
On 18.03.2013 22:41, Kurt Van Dijck wrote:
> On Mon, Mar 18, 2013 at 09:13:33PM +0100, Oliver Hartkopp wrote:
>> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: j1939 - first steps
2013-03-19 6:52 ` Oliver Hartkopp
@ 2013-03-20 9:07 ` Kurt Van Dijck
2013-03-20 19:24 ` Kurt Van Dijck
1 sibling, 0 replies; 8+ messages in thread
From: Kurt Van Dijck @ 2013-03-20 9:07 UTC (permalink / raw)
To: Oliver Hartkopp; +Cc: linux-can
On Tue, Mar 19, 2013 at 07:52:03AM +0100, Oliver Hartkopp wrote:
> On 18.03.2013 22:41, Kurt Van Dijck wrote:
>
> > On Mon, Mar 18, 2013 at 09:13:33PM +0100, Oliver Hartkopp wrote:
>
>
> >> 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 ;-)
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.
>
> Btw. with your hint it works:
>
> ./jsr -v vcan0:,0x22
Yep, it is equal to './jsr -v vcan0'.
> 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!
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: j1939 - first steps
2013-03-19 6:52 ` Oliver Hartkopp
2013-03-20 9:07 ` Kurt Van Dijck
@ 2013-03-20 19:24 ` Kurt Van Dijck
2013-03-20 20:44 ` Marc Kleine-Budde
1 sibling, 1 reply; 8+ messages in thread
From: Kurt Van Dijck @ 2013-03-20 19:24 UTC (permalink / raw)
To: Oliver Hartkopp; +Cc: linux-can
On Tue, Mar 19, 2013 at 07:52:03AM +0100, Oliver Hartkopp wrote:
> On 18.03.2013 22:41, Kurt Van Dijck wrote:
>
> > On Mon, Mar 18, 2013 at 09:13:33PM +0100, Oliver Hartkopp wrote:
>
>
> >> 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 ;-)
Oliver, how about this change in the docs.
Would that have avoided this confusion (on both sides).
diff --git a/jacd.c b/jacd.c
index 1358918..088b72c 100644
--- a/jacd.c
+++ b/jacd.c
@@ -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
diff --git a/jspy.c b/jspy.c
index b48fea1..6b7a215 100644
--- a/jspy.c
+++ b/jspy.c
@@ -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
diff --git a/jsr.c b/jsr.c
index 0303af0..aad6093 100644
--- a/jsr.c
+++ b/jsr.c
@@ -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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: j1939 - first steps
2013-03-20 19:24 ` Kurt Van Dijck
@ 2013-03-20 20:44 ` Marc Kleine-Budde
2013-03-21 5:53 ` Kurt Van Dijck
0 siblings, 1 reply; 8+ messages in thread
From: Marc Kleine-Budde @ 2013-03-20 20:44 UTC (permalink / raw)
To: Oliver Hartkopp, linux-can
[-- Attachment #1: Type: text/plain, Size: 2100 bytes --]
On 03/20/2013 08:24 PM, Kurt Van Dijck wrote:
> On Tue, Mar 19, 2013 at 07:52:03AM +0100, Oliver Hartkopp wrote:
>> On 18.03.2013 22:41, Kurt Van Dijck wrote:
>>
>>> On Mon, Mar 18, 2013 at 09:13:33PM +0100, Oliver Hartkopp wrote:
>>
>>
>>>> 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 ;-)
>
> Oliver, how about this change in the docs.
> Would that have avoided this confusion (on both sides).
>
> diff --git a/jacd.c b/jacd.c
> index 1358918..088b72c 100644
> --- a/jacd.c
> +++ b/jacd.c
> @@ -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
> diff --git a/jspy.c b/jspy.c
> index b48fea1..6b7a215 100644
> --- a/jspy.c
> +++ b/jspy.c
> @@ -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
--
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 |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: j1939 - first steps
2013-03-20 20:44 ` Marc Kleine-Budde
@ 2013-03-21 5:53 ` Kurt Van Dijck
2013-03-21 6:50 ` Oliver Hartkopp
0 siblings, 1 reply; 8+ messages in thread
From: Kurt Van Dijck @ 2013-03-21 5:53 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: Oliver Hartkopp, linux-can
On Wed, Mar 20, 2013 at 09:44:18PM +0100, Marc Kleine-Budde wrote:
> On 03/20/2013 08:24 PM, Kurt Van Dijck wrote:
> > On Tue, Mar 19, 2013 at 07:52:03AM +0100, Oliver Hartkopp wrote:
> >> On 18.03.2013 22:41, Kurt Van Dijck wrote:
> >>
> >>> On Mon, Mar 18, 2013 at 09:13:33PM +0100, Oliver Hartkopp wrote:
> >>
> >>
> >>>> 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 autodetected
> >>
> >> 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).
> >
> > diff --git a/jacd.c b/jacd.c
> > index 1358918..088b72c 100644
> > --- a/jacd.c
> > +++ b/jacd.c
> > @@ -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
> > diff --git a/jspy.c b/jspy.c
> > index b48fea1..6b7a215 100644
> > --- a/jspy.c
> > +++ b/jspy.c
> > @@ -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 :-)
> >>> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: j1939 - first steps
2013-03-21 5:53 ` Kurt Van Dijck
@ 2013-03-21 6:50 ` Oliver Hartkopp
0 siblings, 0 replies; 8+ messages in thread
From: Oliver Hartkopp @ 2013-03-21 6:50 UTC (permalink / raw)
To: Marc Kleine-Budde, linux-can
On 21.03.2013 06:53, Kurt Van Dijck wrote:
> On Wed, Mar 20, 2013 at 09:44:18PM +0100, Marc Kleine-Budde wrote:
>> 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 :-)
Yes that was my trap. I've seen the strlen but it didn't help me %-)
>>>>> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-03-21 6:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-18 20:13 j1939 - first steps Oliver Hartkopp
2013-03-18 21:41 ` Kurt Van Dijck
2013-03-19 6:52 ` Oliver Hartkopp
2013-03-20 9:07 ` Kurt Van Dijck
2013-03-20 19:24 ` Kurt Van Dijck
2013-03-20 20:44 ` Marc Kleine-Budde
2013-03-21 5:53 ` Kurt Van Dijck
2013-03-21 6:50 ` Oliver Hartkopp
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.