rnd-ash / OpenVehicleDiag

A rust based cross-platform ECU diagnostics and car hacking application, utilizing the passthru protocol
GNU General Public License v3.0
817 stars 92 forks source link

[FEATURE] socket can support #7

Open romainreignier opened 3 years ago

romainreignier commented 3 years ago

Hi!

Thanks for this project that looks promising.

I know nothing about J2534 but this seems interesting.

I was wondering if the Linux CAN API socket can could be used in order to use any CAN adapter already compatible with Linux?

That would mean to port the J2534 part of the MacchinaM2 firmware into a new driver I think.

Is your feature request related to a problem? Please describe. Use other CAN adapters, already compatible with Linux.

Describe the solution you'd like A new OVD driver using Linux socket can.

I might try to dig into it so any pointer is welcomed.

rnd-ash commented 3 years ago

Hi,

That is something I do wish to add at a later date. However currently I am too busy, so it'll have to wait until summer.

As for the 'how', socket can could be implemented by creating another struct which inherits the COMM_API trait, however I'm not sure how to send iso-tp payloads using socket CAN as of yet

romainreignier commented 3 years ago

ISO TP support has recently been added to the Linux kernel with this commit. And now available in the kernel 5.10.

romainreignier commented 3 years ago

For reference, older kernels can use this out-of-tree module: https://github.com/hartkopp/can-isotp

rnd-ash commented 3 years ago

I found these 2 crates: https://docs.rs/socketcan-isotp/0.1.1/socketcan_isotp/ https://docs.rs/socketcan/1.7.0/socketcan/

These should make implementing this easy

rnd-ash commented 3 years ago

Hi, 775a8763f2c6dca2f94099bd0dfe9dc9827f356c should add beta implementation of SocketCAN to OVD!

Appreciate some feedback from testers