All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rostislav Lisovy <lisovy@gmail.com>
To: linux-can@vger.kernel.org
Cc: Rostislav Lisovy <lisovy@gmail.com>
Subject: [PATCH] cangen: Enable sending of RTR CAN frames
Date: Wed, 18 Jul 2012 13:33:39 +0200	[thread overview]
Message-ID: <1342611219-18643-1-git-send-email-lisovy@gmail.com> (raw)

Signed-off-by: Rostislav Lisovy <lisovy@gmail.com>
---
 cangen.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/cangen.c b/cangen.c
index 4f37808..7147f65 100644
--- a/cangen.c
+++ b/cangen.c
@@ -101,6 +101,7 @@ void print_usage(char *prg)
 		" write() syscalls)\n");
 	fprintf(stderr, "         -x            (disable local loopback of "
 		"generated CAN frames)\n");
+	fprintf(stderr, "         -R            (send RTR frame)\n");
 	fprintf(stderr, "         -v            (increment verbose level for "
 		"printing sent CAN frames)\n\n");
 	fprintf(stderr, "Generation modes:\n");
@@ -141,6 +142,7 @@ int main(int argc, char **argv)
 	unsigned char dlc_mode = MODE_RANDOM;
 	unsigned char loopback_disable = 0;
 	unsigned char verbose = 0;
+	unsigned char rtr_frame = 0;
 	int count = 0;
 	uint64_t incdata = 0;
 
@@ -165,7 +167,7 @@ int main(int argc, char **argv)
 	signal(SIGHUP, sigterm);
 	signal(SIGINT, sigterm);
 
-	while ((opt = getopt(argc, argv, "ig:eI:L:D:xp:n:vh?")) != -1) {
+	while ((opt = getopt(argc, argv, "ig:eI:L:D:xp:n:vRh?")) != -1) {
 		switch (opt) {
 
 		case 'i':
@@ -224,6 +226,10 @@ int main(int argc, char **argv)
 			loopback_disable = 1;
 			break;
 
+		case 'R':
+			rtr_frame = 1;
+			break;
+
 		case 'p':
 			polltimeout = strtoul(optarg, NULL, 10);
 			break;
@@ -268,6 +274,9 @@ int main(int argc, char **argv)
 			frame.can_id &= CAN_SFF_MASK;
 	}
 
+	if (rtr_frame)
+		frame.can_id |= CAN_RTR_FLAG;
+
 	if (extended)
 		frame.can_id |=  CAN_EFF_FLAG;
 
-- 
1.7.9.5


             reply	other threads:[~2012-07-18 11:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-18 11:33 Rostislav Lisovy [this message]
2012-07-22 11:09 ` [PATCH] cangen: Enable sending of RTR CAN frames Oliver Hartkopp

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=1342611219-18643-1-git-send-email-lisovy@gmail.com \
    --to=lisovy@gmail.com \
    --cc=linux-can@vger.kernel.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.