You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Python wrapper helping the use of [can-isotp Loadable Kernel Module](https://github.com/hartkopp/can-isotp) extending SocketCAN under Linux.
5
8
It provides a friendly and pythonic interface to interact with SocketCAN using the ISO-TP (ISO-15765-2) protocol.
6
9
7
-
## What it's not ##
10
+
What it's not
11
+
-------------
12
+
8
13
- An implementation of the ISO-TP protocol. It simplifies the access to the already available features within Python and your operating system
9
14
- A portable module. It is designed to work under Linux only.
10
15
- A way to magically do ISO-TP regardless of your environment. You need to load a module into your Linux kernel before using this. Otherwise, your OS will deny the creation of the socket.
11
16
- A revolutionary module. It just makes the syntax easier :)
12
17
13
-
## Why is it differents from other projects ##
18
+
Why is it differents from other projects
19
+
----------------------------------------
20
+
14
21
Other Python libraries enabling the use of ISO-TP protocol makes an implementation of the standard in Python, in the user space.
15
22
As mentioned by the authors of SocketCAN in their documentation, this approach has many downsides, mainly when comes to respecting the protocol timings.
16
23
17
24
The best way do ISO-TP communication is within the kernel space, just like [hartkopp/can-isotp](https://github.com/hartkopp/can-isotp) module does by using a socket interface following the mentality of SocketCAN. The well known duality between complexity and flexibility makes the usage of sockets onerous and non-intuitive to the uninitiated. This is where this project becomes handy, it wraps the socket object so that a programmer can configure and use it quickly, in an intuitive way.
18
25
19
26
Also, it will tells you if you do something wrong, like setting a socket options after binding the socket to the addresse. The native implementation will silently ignore the options, which can causes some headaches!
20
27
21
-
## Troubleshooting ##
28
+
Troubleshooting
29
+
---------------
30
+
22
31
- **My socket module does not include the `CAN_ISOTP` constant**
23
32
24
33
That means that your Python version does not include support for ISOTP protocol. It should be included starting from Python 3.7, under Linux build only.
@@ -27,66 +36,72 @@ That means that your Python version does not include support for ISOTP protocol.
27
36
28
37
The Loadable Kernel Module is not loaded in your Linux kernel. Follow the steps given it the module repository. You needs to compile the module, install the `.ko` file and then run `modprobe can-isotp` as Super User. Then your OS will accept to create a ISO-TP sockets.
29
38
30
-
## Examples ##
31
-
32
-
### Without this project ###
33
-
```python
34
-
SOL_CAN_ISOTP=106# These constants exist in the module header, not in Python.
35
-
CAN_ISOTP_RECV_FC=2
36
-
# Many more exists.
37
-
38
-
import socket
39
-
import struct
40
-
41
-
s = socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_ISOTP)
0 commit comments