All of lore.kernel.org
 help / color / mirror / Atom feed
* correct length of bcm message
@ 2021-02-04 15:38 Patrick Menschel
  2021-02-04 17:47 ` Patrick Menschel
  0 siblings, 1 reply; 7+ messages in thread
From: Patrick Menschel @ 2021-02-04 15:38 UTC (permalink / raw)
  To: linux-can

Hi,

is anyone writing to BCMSocket on the Raspberry Pi from Python3 ?

I'm digging through an endianess / alignment issue on armhf platform.

My testcode [1] that I wrote years ago on works on X86_64 platform but
fails on armhf platform with OSERROR 22 "invalid argument".

Then I started concatenating bytes by hand instead of using ctypes.

What I came around is that frames[0] is somehow expected to be 8 bytes
length although it should be 16 bytes.

struct bcm_msg_head {
...
        struct can_frame frames[0];
};

I ended up inserting padding 8 bytes instead of frames[0] value and that
actually works.

That makes my overall BCMHead 40 bytes and the complete bcm message
including the can frame 56bytes.

[1] https://github.com/menschel/pysocketcan

Thanks,
Patrick

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-02-07 18:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04 15:38 correct length of bcm message Patrick Menschel
2021-02-04 17:47 ` Patrick Menschel
2021-02-04 20:14   ` Oliver Hartkopp
2021-02-05  8:27     ` Patrick Menschel
2021-02-05  9:01       ` Oliver Hartkopp
2021-02-07  6:33         ` Patrick Menschel
2021-02-07 18:23           ` 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.