1

I want to read the CAN bus and get the data from a specific device on the CAN bus. I have implemented this previously using the Socket communication api that is available in the user space (sys/socket). I now have a similar requirement but this time working on device drivers which work in the kernel space. The same socket communication is i suppose not available in the kernel space which is why i guess i am not able to compile the kernel module with #include .

An approach i have come up to is to create a device driver for device creation and a supporting user-space program to interact it and provide CAN data by using socket communication. If there is any better approach please suggest me.

  • So, what you have done so far? What the particular question? – 0andriy Apr 30 '20 at 07:54
  • I have used socketCAN api in the user space code in another application to get data from the CAN interface . But the same cannot be used in a kernel module. I want an alternative option that i can use in a kernel module to read CAN data – Sanjay Varghese May 01 '20 at 11:46
  • Yeah, and my question is what did you do after that when you discovered that user space and kernel space APIs are completely different. – 0andriy May 01 '20 at 13:36
  • Right now i am performing socket can comm. and just passing the data after parsing from the user space code to the device driver. The device driver, upon receiving the full message, updates it in the memory. i also came across candev library in linux which works in kernel space. but i havent yet found any good links to understand all its functions that i can use. – Sanjay Varghese May 05 '20 at 11:10

0 Answers0