RE: Write canfd_frame to can interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Marc,

On 2021-07-29 12:55, Marc Kleine-Budde wrote:
> On 29.07.2021 12:03:56, thomas@xxxxxxxxxxxxx wrote:
>> 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?
> 
> A CAN-2.0 frame with 8 bytes is something different than a CAN-FD frame
> with 8 bytes. The kernel uses the length of the frame to decide if it is
> a CAN-2.0 or CAN-FD frame. If your CAN controller has switched CAN-FD
> off, it cannot send CAN-FD frames, thus you get an error.
>
> Does that make sense?

Sure!

I see how a CAN-2.0 frame with 8 bytes differs from a CAN-FD frame with
8-bytes, but when I receive into a canfd_frame I can't differentiate like that
anymore. In userspace an 8B CAN-2.0 frame and an 8B CAN-FD frame look just
the same, no matter the interface running with FD on or off.

... which is wrong as I just noticed. Paying attention to the actual bytes read
by the socket I can see the 16 vs. 72B that make up a can_frame vs. a
canfd_frame respectively. Even when always writing into a canfd_frame.
The same differentiation I must make when sending...

Thanks for the quick reply!

Best regards
Thomas Wagner






[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux