From: <thomas@the-wagner.de>
To: <linux-can@vger.kernel.org>
Subject: Write canfd_frame to can interface
Date: Thu, 29 Jul 2021 12:03:56 +0200 [thread overview]
Message-ID: <006401d78461$0b868b60$2293a220$@the-wagner.de> (raw)
Hi there!
I have been working on getting my device compatible with both, CAN and CAN
FD.
For receiving this is working straight forward. My physical interface is CAN
FD capable
and no matter whether I set it up as
ip link set can0 type can bitrate 500000 fd off
or
ip link set can0 type can bitrate 500000 fd dbitrate 2000000 off
in code I can always just use the canfd_frame struct and set the
CAN_RAW_FD_FRAMES
option. Doing this I can receive CAN and CAN FD frames in both modes without
having
to fall back to the can_frame struct (as explained in the docs).
For sending I expected a similar behavior. I set the CAN_RAW_FD_FRAMES
option and
always sent using the canfd_frame struct. Sadly, this fails while writing on
the interface
when it is not in FD-mode with an Invalid Argument error. To make this work
without
falling back to the can_frame struct I just do
write(sock, &canfdf, sizeof(struct can_frame));
where canfdf is a canfd_frame. Not setting CAN_RAW_FD_FRAMES when the
interface
is in CAN mode but sending using the full canfd_frame won't work too.
Is this expected behavior? Shouldn't the error only be returned if the
canfd_frame I
pass has more than 8 bytes when the interface is not in FD-mode?
Regards,
Thomas
next reply other threads:[~2021-07-29 10:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-29 10:03 thomas [this message]
2021-07-29 10:55 ` Write canfd_frame to can interface Marc Kleine-Budde
2021-07-29 12:02 ` Thomas Wagner
2021-07-29 12:14 ` Marc Kleine-Budde
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='006401d78461$0b868b60$2293a220$@the-wagner.de' \
--to=thomas@the-wagner.de \
--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.