SocketCAN is a Linux socket based implementation for Controller Area Network (CAN) protocol.
Questions tagged [socketcan]
155 questions
0
votes
2 answers
C - Sending cyclic message on socketCAN's broadcast manager
I'm writing some messages on a CAN bus using socketcan's broadcast manager:
struct bcm_message{
struct bcm_msg_head msg_head;
struct can_frame frame[5];
};
int main(){
int s;
struct sockaddr_can addr;
struct ifreq ifr;
…

spx305
- 109
- 2
- 11
0
votes
1 answer
How to create a stop-filter (instead of a pass-filter) when reading CAN messages? [C++, Linux]
I am using a SocketCAN to access the CAN bus.
I have successfully created pass-filters like this:
struct can_filter m_Filter;
// ... setting up m_Filters
setsockopt(m_CanSockId, SOL_CAN_RAW, CAN_RAW_FILTER, m_Filter,
sizeof(struct…

robitop
- 13
- 2
0
votes
1 answer
Problems with sending EFF 29bit ID message over socketCAN
I am trying to send 29bit EFF CAN messages over socket can, but for some reason it sends them with 11bit identifier cutting off 5 bytes from ID. Using loopback mode, through candump i can see that messages are received as 11bit.
I get no errors,…

Mantas Serpetauskis
- 25
- 5
0
votes
2 answers
sending 4 bytes of HEX on linux commandline
I have a command
for i in {1..9} ; do cansend slcan0 "7e0#02090"$i"0000000000"
How can I send the same command but for $i send 4 bytes of HEX instead. Sort of like a brute force ?
0
votes
1 answer
How to send and receive a file in SocketCAN or Python-can?
I want to send a text file from one serial device(slcan0) to another serial device(slcan1) can this operation be performed in SocketCAN? The serial CAN device I am using is CANtact toolkit. Or can the same operation be done in Python-can?

annonymous
- 131
- 3
- 14
0
votes
0 answers
Is it possible to generate CAN message in one device and dump CAN message in another device using SocketCAN?
I am using SocketCAN and CANtact toolkit to send and receive CAN message. I am using two CANtact toolkits one to send CAN message and other to receive the CAN message both the CANtact toolkits are connected by DB9 female to DB9 female and the other…

annonymous
- 131
- 3
- 14
0
votes
0 answers
How to send and receive HMAC(Hashed Message Authentication Code) CAN messages in SocketCAN?
HMAC CODE
import hmac, hashlib
def _generate_signature(data):
key = '123' # Defined as a simple string.
key_bytes= bytes(key , 'latin-1')
data_bytes = bytes(data, 'latin-1') # Assumes `data` is also a string.
return hmac.new(key_bytes,…

Priyam
- 1
- 1
0
votes
1 answer
Can i implement loopback in Linux using socketCAN without CAN HW interface?
I am new on socketCAN and wanted to use socketCAN lib in Linux but i don't have CAN hardware interface to my system so i thought to implement it using loopback as we do it in TCP/IP socket programming. but i am not sure whether I can implement…

krnk
- 11
- 4
0
votes
0 answers
C++ system call to other C++ program not working when called on startup
I have a C++ program which is called at startup via a cronjob (in crontab):
@reboot sudo /home/pi/CAN/RCR_datalogging/logfileControl
Which does run logfileControl anytime the Pi is booted as it shows up in the list of running programs (ps -e).…

Jacob Bernard
- 25
- 6
0
votes
0 answers
SocketCAN and Incoming Packet Control
I have an application for linux. I am using SocketCAN to talk to the CAN bus. We are doing this on a Beaglebone Black based device we made ourselves.
We have another device we need to listen to traffic from. This device sends a ton of data way…

user856232
- 1,073
- 2
- 14
- 40
0
votes
1 answer
SocketCAN + Express.js + Node.js + Socket.io
So I've installed the SocketCAN, Express, and Socket.io node modules.
What I want to do, is:
*initialize a Socket via Socket.io on a Express server
*use socketCAN "node-can" module on the server to send messages to my Frontend (Angular6)
What i've…

Gewitt
- 1
- 3
0
votes
2 answers
uint64 to hex array in Python
I have different uint64 numbers which I want to send via CAN-Bus with SocketCAN in Python. I need to divide the large number in 8 bytes, so I can assign the values to the CAN data-bytes. But I'm struggling with the implementation.
I am grateful for…

StealthScream
- 43
- 1
- 5
0
votes
1 answer
BCM socket cyclic reception in python
I'm trying to monitor a can bus through socketcan with Python. I'm taking as a reference the can4python package.
Since I want to continuously acquire data from the can socket, I'm thinking of using BCM sockets since it handles this on the Kernel…

Yazly
- 13
- 3
0
votes
0 answers
How to write structure with members of the structure storing binary data into a file using C
In the following programs, there is my structure as
struct binary
{
char *time_str;
uint16_t id;
uint8_t data[8];
};
long usec()
{
struct timeval start;
long mtime;
gettimeofday(&start,NULL);
mtime = start.tv_sec + start.tv_usec;
…

user8540390
- 143
- 1
- 10
0
votes
1 answer
C++ Read file stream from terminal line by line with only one command
Short: I want to read data from the terminal into a variable and compare it with a string.
Long: I am using a TI AM3358 development board from GOEMBED which runs embedded linux. I use this kit to read data from a canbus. To read the data from the…

TMO
- 1
- 3