From: Wolfgang Grandegger <wg@grandegger.com>
To: "Daniel M. Drucker, Ph.D." <dmd@interactive-motion.com>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] patch to src/utils/can/rtcansend.c to support data from a file
Date: Fri, 19 Apr 2013 10:55:56 +0200 [thread overview]
Message-ID: <5171069C.3020909@grandegger.com> (raw)
In-Reply-To: <CAD1EtoiZ05S5HXEvdq2+Sg6-1XbxHwMUpcVMrpYA6gv0JgLqJw@mail.gmail.com>
Hi Daniel,
On 04/18/2013 11:49 PM, Daniel M. Drucker, Ph.D. wrote:
>> Thinking more about it, a specialized rtcanmultisend.c in
>> "examples/rtdm/profiles/can" would be nice. Please also provide an
>> example input file.
>
> Here is my rtcansendmulti.c:
>
> https://gist.github.com/dmd/5416474
>
>
> By default, it operates exactly the same as the current rtcansend (so
> this could just replace the existing rtcansend - there's no real
> reason to have both).
Well, simply duplicating code/file/features was also not my idea. Reduce
it to the useful minimum, e.g. remove reading from the command line,
remove "-c", "-s" etc.
> If a filename option is provided, it ignores any <can-msg> that may be
> present on the command line, and instead reads that file line at a
> time, treating each line as if it were a command line. The updated
> help should explain this:
>
> Usage: ./rtcansendmulti <can-interface> [Global Options] [<can-msg>]
>
> Global Options:
> -f, --file=filename filename to read from, or - for stdin
> <can-msg> will be ignored if a file is specified
> -L, --loopback=0|1 switch local loopback off or on
> -v, --verbose be verbose
> -t, --timeout=MS timeout in ms
> -s, --send use send instead of sendto
> -h, --help this help
>
> Global Options OR any line in file:
> -i, --identifier=ID CAN Identifier (default = 1)
> -d, --delay=MS delay in ms (default = 1ms)
> -r --rtr send remote request
> -e --extended send extended frame
> -l --loop=COUNT send message COUNT times
> -c, --count message count in data[0-3]
> -p, --print=MODULO print every MODULO message
>
> filename (or - for stdin) contains lines of the format:
> [Options] [<can-msg>]
>
> Blank lines are ignored.
> # comments out the remainder of a line.
>
>
> If an option is given on a particular line in a file, that option
> overrides the specified global option for that line only.
>
> For example, I might have a file foo which contains:
>
> # this is a comment
> -i 0x601 0x40 0x41 0x60 0x00 #this is another comment
> 0x40 0x41 0x60 0x00
>
> And I run:
> rtcansendmulti rtcan0 -v -i 0x602 -f foo
>
> I will see:
> interface rtcan0
> s=1, ifr_name=rtcan0
> <0x601> [4] 40 41 60 00
> <0x602> [4] 40 41 60 00
> Cleaning up...
>
> Note that the first line was sent to cobid 0x601 (specified on that
> line), and the second to globally specified 0x602.
I would prefer removing -i, -r, -e, etc. and add it as data:
s 0x601 0x40 0x41 0x60 0x00 (standard frame)
e 0x12345678 0x40 0x41 (extended frame)
sr 0x601 (standard rtr frame)
er 0x3456778 (extended rtr frame)
You could also fill an array of CAN messages instead of parsing the
lines every time.
What do you think?
Thanks,
Wolfgang.
next prev parent reply other threads:[~2013-04-19 8:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-28 22:00 [Xenomai] patch to src/utils/can/rtcansend.c to support data from a file Daniel M. Drucker, Ph.D.
2013-04-15 7:09 ` Wolfgang Grandegger
2013-04-17 3:04 ` Matthew Fornero
2013-04-17 3:06 ` Matthew Fornero
2013-04-17 5:30 ` Gilles Chanteperdrix
2013-04-17 13:04 ` Matthew Fornero
2013-04-17 13:07 ` Daniel M. Drucker, Ph.D.
2013-04-18 7:19 ` Wolfgang Grandegger
2013-04-18 7:27 ` Wolfgang Grandegger
2013-04-18 21:49 ` Daniel M. Drucker, Ph.D.
2013-04-19 8:55 ` Wolfgang Grandegger [this message]
2013-04-19 13:58 ` Carles Lopez
2013-04-19 20:01 ` Wolfgang Grandegger
2013-04-19 20:09 ` Daniel M. Drucker, Ph.D.
2013-04-22 8:29 ` Wolfgang Grandegger
2013-04-22 13:40 ` Daniel M. Drucker, Ph.D.
2013-04-18 15:08 ` Daniel M. Drucker, Ph.D.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5171069C.3020909@grandegger.com \
--to=wg@grandegger.com \
--cc=dmd@interactive-motion.com \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.