Update LIN demo to use lin-config 78/22878/1
authorScott Murray <scott.murray@konsulko.com>
Wed, 6 Nov 2019 21:14:57 +0000 (16:14 -0500)
committerScott Murray <scott.murray@konsulko.com>
Wed, 6 Nov 2019 21:08:14 +0000 (21:08 +0000)
Changes include:
- Add patch to fix lin-config recipe build QA error.
- Tweak lin-config recipe to install lin_config as executable.
- Rework sllin-demo systemd unit and start_lin_demo.sh script to use
  lin_config with an appropriate configuration file that enables
  polling of the steering wheel adapter instead of just using
  ldattach.

Bug-AGL: SPEC-2918

Change-Id: I3258b7e34cecbbb1cfb93ea6f63a44f0bbb2c06f
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
recipes-kernel/sllin/files/lin_config.conf [new file with mode: 0644]
recipes-kernel/sllin/files/sllin-demo.service
recipes-kernel/sllin/files/start_lin_demo.sh [changed mode: 0755->0644]
recipes-kernel/sllin/sllin.bb
recipes-support/lin-config/files/0002-Change-Makefile-to-use-LDFLAGS.patch [new file with mode: 0644]
recipes-support/lin-config/lin-config_git.bb

diff --git a/recipes-kernel/sllin/files/lin_config.conf b/recipes-kernel/sllin/files/lin_config.conf
new file mode 100644 (file)
index 0000000..9775b8b
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--PCAN-LIN CT profile.-->
+<PCLIN_PROFILE Version="1">
+       <LIN Group="2">
+               <Scheduler_Entries Count="1">
+                       <!-- Poll steering wheel adapter at address 0x21 every 100 ms -->
+                       <Entry Time="100">33</Entry>
+               </Scheduler_Entries>
+       </LIN>
+</PCLIN_PROFILE>
index 7eb6cfa..2f2f5ac 100644 (file)
@@ -1,13 +1,13 @@
 [Unit]
-Description = LIN DEMO startup
+Description=LIN demo configuration
+ConditionPathExists=/dev/ttyUSB0
 After=afm-system-daemon.service
  
 [Service]
 Type=forking
-PIDFile=/var/run/lin_ldattach
+PIDFile=/var/run/lin_config.pid
 ExecStart=/usr/bin/start_lin_demo.sh
 RemainAfterExit=yes
-
  
 [Install]
 WantedBy=multi-user.target
old mode 100755 (executable)
new mode 100644 (file)
index 741189f..4fcfcc6
@@ -1,10 +1,13 @@
 #!/bin/sh
 
+# Attach serial LIN->CAN bridge and set up LIN polling
 sleep 1
-ldattach 25 /dev/ttySC3
-pidof ldattach > /var/run/lin_ldattach
+/usr/bin/lin_config -c /etc/lin_config.conf -a sllin:/dev/ttyUSB0
+pidof lin_config > /var/run/lin_config.pid
 sleep 1
 ip link set sllin0 up
+
+# Initialize HVAC controller
 usleep 100000
 cansend sllin0 030#
 usleep 100000
index 6213fd9..0478b21 100644 (file)
@@ -19,6 +19,7 @@ SRC_URI_append = " \
        file://0001-Disable-sllin-driver-debug-log.patch;pnum=2 \
        file://sllin-demo.service \
        file://start_lin_demo.sh \
+       file://lin_config.conf \
 "
 
 KERNEL_MODULE_AUTOLOAD_append = " sllin"
@@ -34,6 +35,10 @@ do_install_append () {
        install -m 755 ${WORKDIR}/start_lin_demo.sh ${D}/${bindir}/start_lin_demo.sh
        install -d ${D}${systemd_system_unitdir}
        install -m 0644 ${WORKDIR}/sllin-demo.service ${D}${systemd_system_unitdir}/
+       install -d ${D}${sysconfdir}
+       install -m 0644 ${WORKDIR}/lin_config.conf ${D}${sysconfdir}/
 }
 
-FILES_${PN}_append = " ${bindir}/start_lin_demo.sh"
+FILES_${PN} += "${bindir}/start_lin_demo.sh ${sysconfdir}/lin_config.conf"
+
+RDEPENDS_${PN} += "lin-config"
diff --git a/recipes-support/lin-config/files/0002-Change-Makefile-to-use-LDFLAGS.patch b/recipes-support/lin-config/files/0002-Change-Makefile-to-use-LDFLAGS.patch
new file mode 100644 (file)
index 0000000..2636445
--- /dev/null
@@ -0,0 +1,20 @@
+Use LDFLAGS when linking
+
+Use LDFLAGS when linking the output binary to quiet QA warnings due to
+missing link flags.
+
+Upstream-Status: Pending
+
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+--- a/Makefile 2019-11-05 11:08:11.060565285 +0000
++++ b/Makefile 2019-11-05 11:09:38.663570084 +0000
+@@ -6,7 +6,7 @@
+ objects = linc_parse_xml.o pcl_config.o sllin_config.o lin_config.o
+ lin_config: $(objects)
+-      $(CC) $(objects) $(LIBS) -o lin_config
++      $(CC) $(LDFLAGS) $(objects) $(LIBS) -o lin_config
+ %.o : %.c %.h
+       $(CC) $(CFLAGS) $(LIBS) -c $< -o $@
index 6c8db84..e83f716 100644 (file)
@@ -2,7 +2,6 @@ DESCRIPTION = "lin-config tool for the sllin driver module"
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
 
-
 DEPENDS += "libnl libxml2"
 
 SRC_URI = "git://github.com/trainman419/linux-lin.git;protocol=https"
@@ -11,17 +10,16 @@ S = "${WORKDIR}/git/lin_config/src"
 
 SRC_URI_append = " \
        file://0001-Change-Makefile-to-use-pkg-config-for-libxml-2.0.patch \
+       file://0002-Change-Makefile-to-use-LDFLAGS.patch \
        "
 
 inherit pkgconfig
 
 PV = "0.1+git${SRCPV}"
 
-
 do_configure[noexec] = "1"
 
 do_install_append() {
-
     install -d ${D}/${bindir}
-    install -m 644 ${S}/lin_config ${D}/${bindir}
-}
\ No newline at end of file
+    install -m 755 ${S}/lin_config ${D}/${bindir}
+}