Comments (7)
Hi Łukasz,
the problem is, that the
struct bcm_msg_head {
__u32 opcode;
__u32 flags;
__u32 count;
struct bcm_timeval ival1, ival2;
canid_t can_id;
__u32 nframes;
struct can_frame frames[];
};
has this
struct bcm_timeval {
long tv_sec;
long tv_usec;
};
where the long
can be either 32 or 64 bit.
And this is the problem: You have a 32 bit user space running on a 64 bit kernel. And therefore the length check for the sizeof(struct bcm_mag_head) fails with errno 22 ("invalid argument").
That's the story.
IIRC Marc prepared a patch to solve this. I have to take a look at it.
from can-utils.
Hi Łukasz,
I tried your exact setup with a virtual CAN interface "vcan0"
echo "< vcan0 A 1 0 123 8 11 22 33 44 55 66 77 88 >" | nc 0.0.0.0 28600
and it works as expected:
$ candump any -td
(000.000000) vcan0 123 [8] 11 22 33 44 55 66 77 88
(001.000135) vcan0 123 [8] 11 22 33 44 55 66 77 88
(001.000146) vcan0 123 [8] 11 22 33 44 55 66 77 88
...
Maybe there's something wrong with your can0 interface?!?
Can you please check if your system runs fine with a virtual CAN interface?
from can-utils.
I have another idea what might be wrong.
juraszekl@raspberrypi:~ $ uname -a
Linux raspberrypi 6.1.0-rpi8-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.73-1+rpt1 (2024-01-25) aarch64 GNU/Linux
Can you please check whether the bcmserver
is a 64 bit binary too?
E.g. with file bcmserver
On my 64 bit X86 it looks like this:
$ file bcmserver
bcmserver: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=eee7e8c285a5dbdb9c0b6bfcf3ceb5f29667fcca, for GNU/Linux 3.2.0, not stripped
from can-utils.
Can you please check if your system runs fine with a virtual CAN interface?
So, i have both modules:
$ lsmod | grep can
can_bcm 24576 0
can 28672 1 can_bcm
vcan 16384 0
can_dev 40960 2 mcp251xfd,vcan
and operating vcan0:
$ sudo ip link add dev vcan0 type vcan
$ sudo ip link set vcan0 up
$ ip link show vcan0
6: vcan0: <NOARP,UP,LOWER_UP> mtu 72 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/can
but output is the same:
$ ./bcmserver
listening
forking
BCM socket opened, sc = 5
BCM socket connected
read '< vcan0 A 1 0 123 8 11 22 33 44 55 66 77 88 >'
sscanf ok! items = 14
res = -1, errno = 22
Can you please check whether the
bcmserver
is a 64 bit binary too?
Bingo!
$ file bcmserver
bcmserver: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=1bd7bfb49bc9c25fab7e00675c1ccc1e1f807487, for GNU/Linux 3.2.0, not stripped
How can i solve this issue?
I've checked other exec files that were compiled in the same way, all of them are 32-bit and all of them work fine with f.e. RAW sockets.
Just to make that clear - i use Raspbian directly to compile files (no cross-compilation).
from can-utils.
IIRC there was a discussion some time ago.
Can you try to add (or change)
arm_64bit=0
into /boot/config.txt
from can-utils.
In my case the right file is under /boot/firmware/config.txt
This solution works fine!
candump can1
can1 123 [8] 11 22 33 44 55 66 77 88
can1 123 [8] 11 22 33 44 55 66 77 88
can1 123 [8] 11 22 33 44 55 66 77 88
can1 123 [8] 11 22 33 44 55 66 77 88
can1 123 [8] 11 22 33 44 55 66 77 88
Can You please tell me what is wrong? I just want to understand the issue as a beginner.
Thank You.
Łukasz
from can-utils.
How about downgrade my OS to Bullseye and use external toolchain like this one?
from can-utils.
Related Issues (20)
- Miss frame when using canfdtest HOT 4
- CMake build broken due to ISOBUS HOT 2
- isobusfs throws warning when compiled with recent clang HOT 1
- can-j1939 - trying to emulate an entire truck HOT 21
- Cannot clear TX Buffer of CAN. HOT 6
- unable to transmit CAN frames with ixxat USB-to-CAN v2 HOT 6
- bcmserver: build issue with AOSP14 HOT 1
- can-calc-bit-timing - with an invalid option, exit code is 0
- CAN FD, data phase bitrate is equal to arbitration phase (RPI4 + MCP2518FD) HOT 3
- Error when using dbitrate with fd on : RTNETLINK answers : Operation not supported HOT 12
- New tools: canerrsim and canerrdump HOT 3
- Too many build systems HOT 2
- isobusfs_srv_cm: stringop-overflow HOT 1
- isobusfs_cmn: format-truncation warning
- gcc complains about unknown pragma
- HELP!! HOT 1
- That was easy to help on empty problems! HOT 3
- isobusfs_cmn: Werror=format HOT 1
- How do I compile AOSP without the Android.mk file? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from can-utils.