Update the documentation for J1939. 13/21413/11
authorArthur Guyader <arthur.guyader@iot.bzh>
Fri, 24 May 2019 10:17:12 +0000 (12:17 +0200)
committerRomain Forlot <romain.forlot@iot.bzh>
Thu, 27 Jun 2019 07:33:12 +0000 (09:33 +0200)
Bug-AGL: SPEC-2386

Change-Id: Ice568aebb10cc6eb3d7ac013b2e6ce08451332ba
Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
docs/3-Installation-J1939.md [new file with mode: 0644]
docs/4-Usage.md [moved from docs/3-Usage.md with 98% similarity]
docs/api-services-book.yml

diff --git a/docs/3-Installation-J1939.md b/docs/3-Installation-J1939.md
new file mode 100644 (file)
index 0000000..8ab15f3
--- /dev/null
@@ -0,0 +1,103 @@
+# Installation j1939 for AGL
+
+#### Minimum kernel version : 4.19
+
+## Compilation of kernel j1939
+
+##### Clone linux-can-next repository on kernel.org
+
+```bash
+git clone https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git/
+```
+
+##### Checkout on j1939 branch
+
+```bash
+git checkout j1939
+```
+
+##### Add the compilation of the j1939
+
+```bash
+make menuconfig
+       - Networking Support
+               - Can bus subsystem support
+                       - <M> SAE J1939
+                       - [*]   debug SAE J1939
+```
+
+##### Compile
+
+```bash
+make
+```
+
+##### Install
+
+```bash
+make modules_install
+make install
+```
+
+##### Update grub
+
+###### CentOS/RHEL/Oracle/Scientific and Fedora Linux
+
+```bash
+grub2-mkconfig -o /boot/grub2/grub.cfg
+grubby --set-default /boot/vmlinuz-...
+reboot
+```
+
+###### Debian/Ubuntu Linux
+
+```bash
+update-grub
+reboot
+```
+
+##### Check if the installation is correct
+
+```bash
+modprobe can-j1939
+```
+
+If no errors are generated you have successfully install a kernel with j1939 module.
+
+You can have a problem with header file, to check that go in the file /usr/include/linux/can.h
+
+```bash
+vi /usr/include/linux/can.h
+```
+
+If in the struct sockaddr_can you don't see j1939, the header are not upgrade.
+
+So you need to do this manually, go to you're linux-can-next repository and do the following command:
+
+```bash
+cp include/uapi/linux/can.h /usr/include/linux/can.h
+cp include/uapi/linux/can/j1939.h /usr/include/linux/can/
+```
+
+
+
+### Activate J1939 CMAKE
+
+To activate J1939 at the compilation.
+
+Edit the file conf.d/cmake/cmake/config.cmake
+
+And change the line :
+
+```cmake
+option(WITH_FEATURE_J1939 "Activate J1939" OFF)
+```
+
+With :
+
+```cmake
+option(WITH_FEATURE_J1939 "Activate J1939" ON)
+```
+
+
+
similarity index 98%
rename from docs/3-Usage.md
rename to docs/4-Usage.md
index daeca87..61ca068 100644 (file)
@@ -127,6 +127,15 @@ ls="can1"
 hs="can1"
 ```
 
+* You can use this configuration for j1939:
+
+```ini
+[CANbus-mapping]
+hs="can0"
+ls="can1"
+j1939="can2"
+```
+
 > **CAUTION VERY IMPORTANT:** Make sure the CAN bus\(es\) you specify in your
 > configuration file match those specified in your generated source file with
 > the `CAN-config-generator`.
@@ -243,6 +252,14 @@ low-can subscribe { "event" : "diagnostic*speed*" } --> will subscribe to all di
 low-can subscribe { "event" : "diagnostic*speed" } --> will subscribe to all diagnostic messages ending with speed in their name. Search will be on prefixed messages here.
 ```
 
+You can also subscribe to an event with the ID or the PGN of the message definition :
+
+
+```json
+low-can subscribe { "id" : 1568}
+low-can subscribe { "pgn" : 61442}
+```
+
 You can stop receiving event from it by unsubscribe the signal the same way you did for subscribe
 
 ```json
index c72b92e..1158885 100644 (file)
@@ -12,5 +12,7 @@ books:
       name: Architecture presentation
     - url: 2-Installation.md
       name: Installation Guide
-    - url: 3-Usage.md
-      name: Usage Guide
\ No newline at end of file
+    - url: 3-Installation-J1939
+      name: Installation Guide for J1939
+    - url: 4-Usage.md
+      name: Usage Guide