diff options
Diffstat (limited to '_to_remove/recipes-config')
21 files changed, 834 insertions, 0 deletions
diff --git a/_to_remove/recipes-config/cluster-dashboard-demo-config/cluster-dashboard-demo-config_1.0.bb b/_to_remove/recipes-config/cluster-dashboard-demo-config/cluster-dashboard-demo-config_1.0.bb new file mode 100644 index 000000000..f1fce78f8 --- /dev/null +++ b/_to_remove/recipes-config/cluster-dashboard-demo-config/cluster-dashboard-demo-config_1.0.bb @@ -0,0 +1,11 @@ +SUMMARY = "AGL cluster demo dashboard configuration file" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +SRC_URI += "file://AGL.conf.cluster" + +inherit allarch + +do_install() { + install -D -m 0644 ${WORKDIR}/AGL.conf.cluster ${D}${sysconfdir}/xdg/AGL.conf +} diff --git a/_to_remove/recipes-config/cluster-dashboard-demo-config/files/AGL.conf.cluster b/_to_remove/recipes-config/cluster-dashboard-demo-config/files/AGL.conf.cluster new file mode 100644 index 000000000..dd8a912c5 --- /dev/null +++ b/_to_remove/recipes-config/cluster-dashboard-demo-config/files/AGL.conf.cluster @@ -0,0 +1,2 @@ +[dashboard] +animation=false diff --git a/_to_remove/recipes-config/cluster-demo-network-config/cluster-demo-network-config_1.0.bb b/_to_remove/recipes-config/cluster-demo-network-config/cluster-demo-network-config_1.0.bb new file mode 100644 index 000000000..8d737282d --- /dev/null +++ b/_to_remove/recipes-config/cluster-demo-network-config/cluster-demo-network-config_1.0.bb @@ -0,0 +1,33 @@ +SUMMARY = "Setting files for cluster network for the AGL Demonstrator" +DESCRIPTION = "Setting files for cluster network for the AGL Demonstrator" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +inherit systemd allarch + +SRC_URI = "file://cluster-demo-network-conf@.service \ + file://cluster-demo-network-conf.sh \ +" + +# Network device for dedicated connection to cluster +AGL_CLUSTER_NET_DEVICE ?= "eth1" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +do_install() { + # Install helper script + install -d ${D}${sbindir} + install -m 0755 ${WORKDIR}/cluster-demo-network-conf.sh ${D}${sbindir}/ + + # Install service unit + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/cluster-demo-network-conf@.service ${D}${systemd_system_unitdir}/ + + # Add symlink to network.target.wants + install -d ${D}${sysconfdir}/systemd/system/network.target.wants + ln -s ${systemd_system_unitdir}/cluster-demo-network-conf@.service \ + ${D}${sysconfdir}/systemd/system/network.target.wants/cluster-demo-network-conf@${AGL_CLUSTER_NET_DEVICE}.service +} + +FILES:${PN} += "${systemd_system_unitdir}" diff --git a/_to_remove/recipes-config/cluster-demo-network-config/files/cluster-demo-network-conf.sh b/_to_remove/recipes-config/cluster-demo-network-config/files/cluster-demo-network-conf.sh new file mode 100644 index 000000000..3f538175f --- /dev/null +++ b/_to_remove/recipes-config/cluster-demo-network-config/files/cluster-demo-network-conf.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +CONNMAN_CONF=/etc/connman/main.conf +CLUSTER_ADDRESS=192.168.20.93 + +if [ -z "$1" ]; then + echo "Usage: $0 <network device>" + exit 1 +fi + +# Need to blacklist given device with connman if it isn't already, +# otherwise connman will over-ride address configuration. +if ! grep '^NetworkInterfaceBlacklist=' ${CONNMAN_CONF} | grep -q $1; then + sed -i "s/^\(NetworkInterfaceBlacklist=.*\)/\1,$1/" ${CONNMAN_CONF} +fi + +/sbin/ifconfig $1 ${CLUSTER_ADDRESS} diff --git a/_to_remove/recipes-config/cluster-demo-network-config/files/cluster-demo-network-conf@.service b/_to_remove/recipes-config/cluster-demo-network-config/files/cluster-demo-network-conf@.service new file mode 100644 index 000000000..5fc29b7a0 --- /dev/null +++ b/_to_remove/recipes-config/cluster-demo-network-config/files/cluster-demo-network-conf@.service @@ -0,0 +1,12 @@ +[Unit] +Description=Configure dedicated link for cluster demo network +After=sys-subsystem-net-devices-%i.device +Requires=sys-subsystem-net-devices-%i.device +Before=network.target + +[Service] +ExecStart=/usr/sbin/cluster-demo-network-conf.sh %i +Type=oneshot + +[Install] +WantedBy=network.target diff --git a/_to_remove/recipes-config/cluster-demo-simulator/cluster-demo-simulator.bb b/_to_remove/recipes-config/cluster-demo-simulator/cluster-demo-simulator.bb new file mode 100644 index 000000000..2eaabc979 --- /dev/null +++ b/_to_remove/recipes-config/cluster-demo-simulator/cluster-demo-simulator.bb @@ -0,0 +1,23 @@ +DESCRIPTION = "Systemd unit to start simple CAN simulator" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +SRC_URI = "file://cluster-demo-simulator.service" + +inherit systemd + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE:${PN} = "cluster-demo-simulator.service" +SYSTEMD_AUTO_ENABLE:${PN} = "enable" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +do_install() { + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/cluster-demo-simulator.service ${D}${systemd_system_unitdir} +} + +FILES:${PN} += "${systemd_system_unitdir}" + +RDEPENDS:${PN} = "simple-can-simulator" diff --git a/_to_remove/recipes-config/cluster-demo-simulator/files/cluster-demo-simulator.service b/_to_remove/recipes-config/cluster-demo-simulator/files/cluster-demo-simulator.service new file mode 100644 index 000000000..04d41c6cf --- /dev/null +++ b/_to_remove/recipes-config/cluster-demo-simulator/files/cluster-demo-simulator.service @@ -0,0 +1,13 @@ +[Unit] +Description=Cluster demo driving simulator +After=sllin-demo.service sllin-demo-virtual.service cluster-lin-bridging.service +Requires=sllin-demo.service sllin-demo-virtual.service cluster-lin-bridging.service + +[Service] +Type=simple +Restart=always +RestartSec=1 +ExecStart=/usr/bin/python3 /usr/sbin/simple_can_simulator.py + +[Install] +WantedBy=multi-user.target diff --git a/_to_remove/recipes-config/cluster-demo-simulator/files/simple_can_simulator.py b/_to_remove/recipes-config/cluster-demo-simulator/files/simple_can_simulator.py new file mode 100755 index 000000000..83f88706e --- /dev/null +++ b/_to_remove/recipes-config/cluster-demo-simulator/files/simple_can_simulator.py @@ -0,0 +1,381 @@ +#!/usr/bin/env python3 +# Copyright (c) 2016 Alex Bencz +# Copyright (c) 2019 Konsulko Group, smurray@konsulko.com +# Copyright (c) 2020 The Linux Foundation, jsmoeller@linuxfoundation.org +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of +# this software and associated documentation files (the "Software"), to deal in +# the Software without restriction, including without limitation the rights to +# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +# of the Software, and to permit persons to whom the Software is furnished to do +# so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +# +# CANSocket from: +# +# https://github.com/abencz/python_socketcan/blob/master/python_socketcan_example.py +# + +import sys +import socket +import argparse +import struct +import errno +import threading +import time + +class CANSocket(object): + FORMAT = "<IB3x8s" + FD_FORMAT = "<IB3x64s" + + def __init__(self, interface=None): + self.sock = socket.socket(socket.PF_CAN, socket.SOCK_RAW, socket.CAN_RAW) + if interface is not None: + self.bind(interface) + + def bind(self, interface): + self.sock.bind((interface,)) + self.sock.setsockopt(socket.SOL_CAN_RAW, socket.CAN_RAW_FD_FRAMES, 1) + + def send(self, can_id, data, flags=0): + can_id = can_id | flags + can_pkt = struct.pack(self.FORMAT, can_id, len(data), data) + self.sock.send(can_pkt) + + def sendfd(self, can_id, data, flags=0): + can_id = can_id | flags + datafd = data.ljust(64, b'\x00'); + can_pkt = struct.pack(self.FD_FORMAT, can_id, len(datafd), datafd) + self.sock.send(can_pkt) + + def recv(self, flags=0): + can_pkt = self.sock.recv(72) + + if len(can_pkt) == 16: + can_id, length, data = struct.unpack(self.FORMAT, can_pkt) + else: + can_id, length, data = struct.unpack(self.FD_FORMAT, can_pkt) + + can_id &= socket.CAN_EFF_MASK + return (can_id, data[:length]) + +class VehicleSimulator(object): + DEFAULT_IDLE_RPM = 600 + + def __init__(self): + self.CRUISEMODE = False + self.CRUISEACTIVE = False + self.CRUISESPEED = 0 + self.CRUISERPM = 0 + self.freq = 10 + self.vehicle_speed = 0 + self.engine_speed = self.DEFAULT_IDLE_RPM + self.thread = threading.Thread(target=self.run, daemon=True) + self.lock = threading.Lock() + + def reset(self): + with self.lock: + self.vehicle_speed = 0 + self.engine_speed = self.DEFAULT_IDLE_RPM + + def start(self): + self.thread.start() + + def get_engine_speed(self): + with self.lock: + return int(self.engine_speed) + + def get_vehicle_speed(self): + with self.lock: + return int(self.vehicle_speed) + + def accelerate(self, target_speed, target_rpm, duration, bycruise = False): + if target_speed <= self.vehicle_speed: + return + v = (target_speed - self.vehicle_speed) / (duration * self.freq) + r = (target_rpm - self.engine_speed) / (duration * self.freq) + while self.vehicle_speed < target_speed and (not self.CRUISEACTIVE or bycruise): + with self.lock: + self.vehicle_speed += v; + self.engine_speed += r; + time.sleep(1 / self.freq) + + def brake(self, target_speed, target_rpm, duration, bycruise = False): + if target_speed >= self.vehicle_speed: + return + v = (self.vehicle_speed - target_speed) / (duration * self.freq) + r = (self.engine_speed - target_rpm) / (duration * self.freq) + while self.vehicle_speed > target_speed and (not self.CRUISEACTIVE or bycruise): + with self.lock: + self.vehicle_speed -= v; + self.engine_speed -= r; + time.sleep(1 / self.freq) + + def increase(self, bycruise = True): + if self.CRUISEACTIVE: + target_speed = self.vehicle_speed + 5 + target_rpm = self.engine_speed * 1.1 + self.accelerate(target_speed, target_rpm, 2, bycruise) + + def decrease(self, bycruise = True): + if self.CRUISEACTIVE: + target_speed = self.vehicle_speed - 5 + target_rpm = self.engine_speed * 0.9 + self.brake(target_speed, target_rpm, 2, bycruise) + + def resume(self, bycruise = True): + target_speed = self.CRUISESPEED + target_rpm = self.CRUISERPM + current_speed = self.get_vehicle_speed() + if target_speed > current_speed: + self.accelerate(target_speed, target_rpm, 2, bycruise) + else: + self.brake(target_speed, target_rpm, 2, bycruise) + + def run(self): + while True: + if not self.CRUISEACTIVE: + self.accelerate(80, 3000, 5) + self.accelerate(104, 4000, 3) + self.brake(80, 3000, 3) + self.accelerate(104, 4000, 6) + self.brake(40, 2000, 4) + self.accelerate(90, 3000, 5) + self.brake(1, 650, 5) + if not self.CRUISEACTIVE: + self.reset() + time.sleep(5) + +class DiagnosticMessageHandler(object): + def __init__(self, can_sock, simulator, verbose=False): + self.can_sock = can_sock + self.simulator = simulator + self.verbose = verbose + self.thread = threading.Thread(target=self.run, daemon=True) + + def start(self): + self.thread.start() + + def run(self): + while True: + can_id, data = self.can_sock.recv() + #print('%03X#%s' % (can_id, ''.join(format(x, '02X') for x in data))) + if can_id == 0x7df: + # OBD-II request + if data[1] == 0x01 and data[2] == 0x0C: + # Engine speed + speed = self.simulator.get_engine_speed() + #print('engine speed = %d' % speed) + if speed > 16383.75: + speed = 16383.75 + reply = [ 0x04, 0x41, 0x0C ] + reply.append(4 * speed // 256) + reply.append(4 * speed % 256) + # pad remaining bytes to make 8 + reply.append(0) + reply.append(0) + reply.append(0) + self.can_sock.send(0x7e8, bytes(reply), 0) + elif data[1] == 0x01 and data[2] == 0x0D: + # Vehicle speed + speed = int(self.simulator.get_vehicle_speed()) % 256 + #print('vehicle speed = %d' % speed) + reply = [ 0x03, 0x41, 0x0D ] + reply.append(speed) + # pad remaining bytes to make 8 + reply.append(0) + reply.append(0) + reply.append(0) + reply.append(0) + self.can_sock.send(0x7e8, bytes(reply), 0) + +class SteeringWheelMessageHandler(object): + def __init__(self, can_sock, simulator, verbose=False): + self.can_sock = can_sock + self.simulator = simulator + self.verbose = verbose + self.thread = threading.Thread(target=self.run, daemon=True) + self.buttonpressed = False + self.buttonenabled = False + self.buttoncancel = False + self.buttondec = False + self.buttoninc = False + self.cruisemode = False + self.cruiseactive = False + + def start(self): + self.thread.start() + + def run(self): + while True: + can_id, data = self.can_sock.recv() + #print('%03X#%s' % (can_id, ''.join(format(x, '02X') for x in data))) + if can_id == 0x21: + #print('%03X#%s' % (can_id, ''.join(format(x, '02X') for x in data))) + if data: + #if data[6]: + #print('data6: %02X' % (data[6])) + if data[6] == 0x80 and not self.buttonpressed: + # we do skip any further lin messages + # two buttons at the same time won't work + # (aka unlikely w/o twisting fingers) + self.buttonpressed = True + self.buttonenabled = True + if data[6] == 0x08 and not self.buttonpressed: + self.buttonpressed = True + self.buttoncancel = True + if data[6] == 0x10 and not self.buttonpressed: + self.buttonpressed = True + self.buttondec = True + if data[6] == 0x40 and not self.buttonpressed: + self.buttonpressed = True + self.buttoninc = True + if data[6] == 0x00 and self.buttonpressed: + #now handle it as the button was released + if self.buttonenabled: + self.buttonenabled = False + self.cruisemode = not self.cruisemode + #print("set cruisemode to %s" % self.cruisemode) + self.simulator.CRUISEMODE = self.cruisemode + # disable/reset all if going off + if not self.cruisemode: + self.cruiseactive = False + self.simulator.CRUISEACTIVE = self.cruiseactive + self.simulator.CRUISESPEED = 0 + self.simulator.CRUISERPM = 0 + #print("set cruiseactive to %s" % self.cruiseactive) + if self.buttoncancel: + self.buttoncancel = False + self.simulator.CRUISESPEED = self.simulator.get_vehicle_speed() + self.simulator.CRUISERPM = self.simulator.get_engine_speed() + #print("set cruisespeed to %d" % self.simulator.CRUISESPEED ) + #print("set cruiserpm to %d" % self.simulator.CRUISERPM ) + self.cruiseactive = False + #print("set cruiseactive to %s" % self.cruiseactive ) + self.simulator.CRUISEACTIVE = self.cruiseactive + if self.buttondec: + self.buttondec = False + if self.cruiseactive: + #print("decrease") + self.simulator.decrease() + else: + # set speed + #print("set speed") + self.simulator.CRUISESPEED = self.simulator.get_vehicle_speed() + self.simulator.CRUISERPM = self.simulator.get_engine_speed() + #print("set cruisespeed to %d" % self.simulator.CRUISESPEED ) + #print("set cruiserpm to %d" % self.simulator.CRUISERPM ) + self.cruiseactive = not self.cruiseactive + #print("set cruiseactive to %s" % self.cruiseactive ) + self.simulator.CRUISEACTIVE = self.cruiseactive + if self.buttoninc: + self.buttoninc = False + if self.cruiseactive: + #print("increase") + self.simulator.increase() + else: + if self.simulator.CRUISESPEED > 0: + # resume + self.cruiseactive = not self.cruiseactive + self.simulator.CRUISEACTIVE = self.cruiseactive + #print("set cruiseactive to %s" % self.cruiseactive ) + #print("resume") + self.simulator.resume() + self.buttonpressed = False + + +class StatusMessageSender(object): + def __init__(self, can_sock, simulator, verbose=False): + self.can_sock = can_sock + self.simulator = simulator + self.verbose = verbose + self.thread = threading.Thread(target=self.run, daemon=True) + + def start(self): + self.thread.start() + + def run(self): + while True: + # Engine speed + speed = self.simulator.get_engine_speed() + if self.verbose: + print('engine speed = %d' % speed) + if speed > 16383.75: + speed = 16383.75 + # Message is 1 byte unknown, 1 byte fuel level, 2 bytes engine speed (4x), fuel low @ bit 55 + msg = [ 0, 0 ] + speed *= 4 + msg.append(speed // 256) + msg.append(speed % 256) + # pad remaining bytes to make 8 + msg.append(0) + msg.append(0) + msg.append(0) + msg.append(0) + self.can_sock.send(0x3d9, bytes(msg), 0) + + # Vehicle speed + speed = int(self.simulator.get_vehicle_speed()) % 256 + if self.verbose: + print('vehicle speed = %d' % speed) + # Message is 15 bits speed (64x), left aligned + msg = [ ] + # Note: extra 2x to yield required left-alignment + speed *= 128 + msg.append(speed // 256) + msg.append(speed % 256) + # pad remaining bytes to make 8 + msg.append(0) + msg.append(0) + msg.append(0) + msg.append(0) + msg.append(0) + msg.append(0) + self.can_sock.send(0x3e9, bytes(msg), 0) + + # Sleep 100 ms + time.sleep(0.1) + +def main(): + parser = argparse.ArgumentParser(description='Simple CAN vehicle simulator.') + parser.add_argument('interface', type=str, help='interface name (e.g. vcan0)') + parser.add_argument('-v', '--verbose', help='increase output verbosity', action='store_true') + args = parser.parse_args() + + try: + can_sock = CANSocket(args.interface) + diag_can_sock = CANSocket(args.interface) + steeringwheel_can_sock = CANSocket(args.interface) + except OSError as e: + sys.stderr.write('Could not listen on interface {0}\n'.format(args.interface)) + sys.exit(e.errno) + + print('Using {0}'.format(args.interface)) + sim = VehicleSimulator() + status_sender = StatusMessageSender(can_sock, sim, args.verbose) + diag_handler = DiagnosticMessageHandler(diag_can_sock, sim, args.verbose) + steeringwheel_handler = SteeringWheelMessageHandler(steeringwheel_can_sock, sim, args.verbose) + sim.start() + status_sender.start() + diag_handler.start() + steeringwheel_handler.start() + try: + while True: + time.sleep(60) + except (KeyboardInterrupt, SystemExit): + #sim.stop() + sys.exit(0) + +if __name__ == '__main__': + main() diff --git a/_to_remove/recipes-config/cluster-lin-bridging-config/cluster-lin-bridging-config.bb b/_to_remove/recipes-config/cluster-lin-bridging-config/cluster-lin-bridging-config.bb new file mode 100644 index 000000000..5366f2d0b --- /dev/null +++ b/_to_remove/recipes-config/cluster-lin-bridging-config/cluster-lin-bridging-config.bb @@ -0,0 +1,28 @@ +DESCRIPTION = "Configure LIN to external CAN bridging" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +SRC_URI = "\ + file://cluster-lin-bridging.service \ +" + +inherit systemd + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE:${PN} = "cluster-lin-bridging.service" +SYSTEMD_AUTO_ENABLE:${PN} = "enable" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +do_install() { + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/cluster-lin-bridging.service ${D}${systemd_system_unitdir} +} + +FILES:${PN} += "${systemd_system_unitdir}" + +RDEPENDS:${PN} = " \ + can-utils \ + sllin \ +" diff --git a/_to_remove/recipes-config/cluster-lin-bridging-config/files/cluster-lin-bridging.service b/_to_remove/recipes-config/cluster-lin-bridging-config/files/cluster-lin-bridging.service new file mode 100644 index 000000000..1dde33786 --- /dev/null +++ b/_to_remove/recipes-config/cluster-lin-bridging-config/files/cluster-lin-bridging.service @@ -0,0 +1,11 @@ +[Unit] +Description=LIN to CAN bridging +After=sllin-demo.service sllin-demo-virtual.service +Requires=sllin-demo.service sllin-demo-virtual.service + +[Service] +Type=simple +ExecStart=/usr/bin/candump -s 2 -B can0 sllin0 + +[Install] +WantedBy=multi-user.target diff --git a/_to_remove/recipes-config/dev-mapping/dev-mapping-ci/dev-mapping.conf.ci b/_to_remove/recipes-config/dev-mapping/dev-mapping-ci/dev-mapping.conf.ci new file mode 100644 index 000000000..bd5c2135a --- /dev/null +++ b/_to_remove/recipes-config/dev-mapping/dev-mapping-ci/dev-mapping.conf.ci @@ -0,0 +1,7 @@ +; Default CAN device mapping +; Format has to follow ini rules key="value", notice " around value. + +[CANbus-mapping] +hs="vcan0" +ls="vcan0" +j1939="vcan0" diff --git a/_to_remove/recipes-config/dev-mapping/dev-mapping-ci_1.0.bb b/_to_remove/recipes-config/dev-mapping/dev-mapping-ci_1.0.bb new file mode 100644 index 000000000..7b40e40c6 --- /dev/null +++ b/_to_remove/recipes-config/dev-mapping/dev-mapping-ci_1.0.bb @@ -0,0 +1,18 @@ +SUMMARY = "AGL demo device mapping configuration file" +DESCRIPTION = "This provides a default dev-mapping.conf file \ + that defines mapping between kernel device and logical name \ + used in the low-can binding for the AGL CI setup." + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +SRC_URI += "file://dev-mapping.conf.ci" + +inherit allarch + +do_install() { + install -d ${D}${sysconfdir} + install -m 0644 ${WORKDIR}/dev-mapping.conf.ci ${D}${sysconfdir}/dev-mapping.conf +} + +RPROVIDES:${PN} = "virtual/low-can-dev-mapping" diff --git a/_to_remove/recipes-config/dev-mapping/dev-mapping-demo/dev-mapping.conf.demo b/_to_remove/recipes-config/dev-mapping/dev-mapping-demo/dev-mapping.conf.demo new file mode 100644 index 000000000..1fd12ad03 --- /dev/null +++ b/_to_remove/recipes-config/dev-mapping/dev-mapping-demo/dev-mapping.conf.demo @@ -0,0 +1,7 @@ +; Default CAN device mapping +; Format has to follow ini rules key="value", notice " around value. + +[CANbus-mapping] +hs="can0" +ls="sllin0" +j1939="can0" diff --git a/_to_remove/recipes-config/dev-mapping/dev-mapping-demo_1.0.bb b/_to_remove/recipes-config/dev-mapping/dev-mapping-demo_1.0.bb new file mode 100644 index 000000000..23fdc078a --- /dev/null +++ b/_to_remove/recipes-config/dev-mapping/dev-mapping-demo_1.0.bb @@ -0,0 +1,18 @@ +SUMMARY = "AGL demo device mapping configuration file" +DESCRIPTION = "This provide default dev-mapping.conf file \ + that defines mapping between kernel device and logical name \ + used in low-can binding for the AGL demo setup." + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +SRC_URI += "file://dev-mapping.conf.demo" + +inherit allarch + +do_install() { + install -d ${D}${sysconfdir} + install -m 0644 ${WORKDIR}/dev-mapping.conf.demo ${D}${sysconfdir}/dev-mapping.conf +} + +RPROVIDES:${PN} = "virtual/low-can-dev-mapping" diff --git a/_to_remove/recipes-config/dev-mapping/dev-mapping/dev-mapping.conf.default b/_to_remove/recipes-config/dev-mapping/dev-mapping/dev-mapping.conf.default new file mode 100644 index 000000000..8519a5873 --- /dev/null +++ b/_to_remove/recipes-config/dev-mapping/dev-mapping/dev-mapping.conf.default @@ -0,0 +1,7 @@ +; Default CAN device mapping +; Format has to follow ini rules key="value", notice " around value. + +[CANbus-mapping] +hs="can0" +ls="can0" +j1939="can0" diff --git a/_to_remove/recipes-config/dev-mapping/dev-mapping_0.1.bb b/_to_remove/recipes-config/dev-mapping/dev-mapping_0.1.bb new file mode 100644 index 000000000..f880d39d8 --- /dev/null +++ b/_to_remove/recipes-config/dev-mapping/dev-mapping_0.1.bb @@ -0,0 +1,18 @@ +SUMMARY = "AGL Device mapping configuration file" +DESCRIPTION = "This provide default dev-mapping.conf file \ + that defines mapping between kernel device and logical name \ + used in low-can binding by example." + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +SRC_URI += "file://dev-mapping.conf.default" + +inherit allarch + +do_install() { + install -d ${D}${sysconfdir} + install -m 0644 ${WORKDIR}/dev-mapping.conf.default ${D}${sysconfdir}/dev-mapping.conf +} + +RPROVIDES:${PN} = "virtual/low-can-dev-mapping" diff --git a/_to_remove/recipes-config/systemd-sync/systemd-agl-sync_1.0.bb b/_to_remove/recipes-config/systemd-sync/systemd-agl-sync_1.0.bb new file mode 100644 index 000000000..0b2dc4e4d --- /dev/null +++ b/_to_remove/recipes-config/systemd-sync/systemd-agl-sync_1.0.bb @@ -0,0 +1,39 @@ +SUMMARY = "Systemd synchronization script" +DESCRIPTION = "\ +Systemd synchronization script \ +reload daemon at the first boot. \ +" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +#This script should be the last to be execute at the first boot +POST_INSTALL_LEVEL = "X0" +POST_INSTALL_SCRIPT ?= "${POST_INSTALL_LEVEL}-${PN}.sh" + +do_install() { + install -d ${D}/${sysconfdir}/agl-postinsts + cat > ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} <<EOF +#!/bin/sh -e +echo "restart daemon ..." +result=0 +systemctl daemon-reload +if [ \$? -ne 0 ]; then + result=1 +fi +systemctl restart sockets.target +if [ \$? -ne 0 ]; then + result=1 +fi + +if [ \$result -eq 0 ]; then + echo "restart daemon OK" + exit \$result +else + echo "restart daemon failed" + exit \$result +fi +EOF + chmod a+x ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} +} + +FILES:${PN} = "${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT}" diff --git a/_to_remove/recipes-config/unicens-config/files/55-inic.rules b/_to_remove/recipes-config/unicens-config/files/55-inic.rules new file mode 100644 index 000000000..2da65cb80 --- /dev/null +++ b/_to_remove/recipes-config/unicens-config/files/55-inic.rules @@ -0,0 +1,4 @@ +# OS81118 devices for Microchip UNICENS +KERNEL=="inic-usb-crx", SUBSYSTEM=="most_cdev_aim", GROUP="audio", SECLABEL{smack}="*" +KERNEL=="inic-usb-ctx", SUBSYSTEM=="most_cdev_aim", GROUP="audio", SECLABEL{smack}="*" +KERNEL=="inic-usb-itx1", SUBSYSTEM=="most_cdev_aim", GROUP="audio", SECLABEL{smack}="*" diff --git a/_to_remove/recipes-config/unicens-config/files/unicens-config.service b/_to_remove/recipes-config/unicens-config/files/unicens-config.service new file mode 100644 index 000000000..43c8a1673 --- /dev/null +++ b/_to_remove/recipes-config/unicens-config/files/unicens-config.service @@ -0,0 +1,11 @@ +[Unit] +Description=Driver configuration for Unicens2 +After=systemd-modules-load.service +Requires=systemd-modules-load.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/unicens-config.sh + +[Install] +WantedBy=multi-user.target diff --git a/_to_remove/recipes-config/unicens-config/files/unicens-config.sh b/_to_remove/recipes-config/unicens-config/files/unicens-config.sh new file mode 100644 index 000000000..1f7fd3906 --- /dev/null +++ b/_to_remove/recipes-config/unicens-config/files/unicens-config.sh @@ -0,0 +1,143 @@ +#!/bin/bash + +########################################################################## +# NOTE: This script is intentended to be used with the MOST starter-kit[1] +# in conjuction with the agl-service-unicens widget only. For other setups +# this script and also the UNICENS config settings need to be adapted +# accordingly. +# +# An optional approach to configure the driver is provided by the +# default_conf.ko kernel module that can be found in +# /lib/modules/`uname -r`/extra +# +# +# [1]: The starter-kit consists of one Network Interface Controller and +# three slim amplifier modules) +########################################################################## + + +########################################## +# interface: mdev0 +# chip: Vantage +# aim: cdev +# name: inic-usb-crx +echo rx > /sys/devices/virtual/most/mostcore/devices/mdev0/ep8f/set_direction 2>/dev/null +echo control > /sys/devices/virtual/most/mostcore/devices/mdev0/ep8f/set_datatype 2>/dev/null +echo 16 > /sys/devices/virtual/most/mostcore/devices/mdev0/ep8f/set_number_of_buffers 2>/dev/null +echo 64 > /sys/devices/virtual/most/mostcore/devices/mdev0/ep8f/set_buffer_size 2>/dev/null + +echo mdev0:ep8f:inic-usb-crx > /sys/devices/virtual/most/mostcore/aims/cdev/add_link 2>/dev/null + +#aim: cdev +#name: inic-usb-ctx +echo tx > /sys/devices/virtual/most/mostcore/devices/mdev0/ep0f/set_direction 2>/dev/null +echo control > /sys/devices/virtual/most/mostcore/devices/mdev0/ep0f/set_datatype 2>/dev/null +echo 16 > /sys/devices/virtual/most/mostcore/devices/mdev0/ep0f/set_number_of_buffers 2>/dev/null +echo 64 > /sys/devices/virtual/most/mostcore/devices/mdev0/ep0f/set_buffer_size 2>/dev/null + +echo mdev0:ep0f:inic-usb-ctx > /sys/devices/virtual/most/mostcore/aims/cdev/add_link 2>/dev/null + +########################################## +# interface: mdev1 +#aim: networking +#name: inic-usb-arx +echo rx > /sys/devices/virtual/most/mostcore/devices/mdev1/ep8e/set_direction 2>/dev/null +echo async > /sys/devices/virtual/most/mostcore/devices/mdev1/ep8e/set_datatype 2>/dev/null +echo 20 > /sys/devices/virtual/most/mostcore/devices/mdev1/ep8e/set_number_of_buffers 2>/dev/null +echo 1522 > /sys/devices/virtual/most/mostcore/devices/mdev1/ep8e/set_buffer_size 2>/dev/null + +echo mdev1:ep8e:inic-usb-arx > /sys/devices/virtual/most/mostcore/aims/networking/add_link 2>/dev/null +#aim: networking +#name: inic-usb-atx +echo tx > /sys/devices/virtual/most/mostcore/devices/mdev1/ep0e/set_direction 2>/dev/null +echo async > /sys/devices/virtual/most/mostcore/devices/mdev1/ep0e/set_datatype 2>/dev/null +echo 20 > /sys/devices/virtual/most/mostcore/devices/mdev1/ep0e/set_number_of_buffers 2>/dev/null +echo 1522 > /sys/devices/virtual/most/mostcore/devices/mdev1/ep0e/set_buffer_size 2>/dev/null + +echo mdev1:ep0e:inic-usb-atx > /sys/devices/virtual/most/mostcore/aims/networking/add_link 2>/dev/null +########################################### +## interface: mdev0 +## chip: Durango +##aim: cdev +##name: inic-usb-crx +echo rx > /sys/devices/virtual/most/mostcore/devices/mdev0/ep87/set_direction 2>/dev/null +echo control > /sys/devices/virtual/most/mostcore/devices/mdev0/ep87/set_datatype 2>/dev/null +echo 16 > /sys/devices/virtual/most/mostcore/devices/mdev0/ep87/set_number_of_buffers 2>/dev/null +echo 64 > /sys/devices/virtual/most/mostcore/devices/mdev0/ep87/set_buffer_size 2>/dev/null + +echo mdev0:ep87:inic-usb-crx > /sys/devices/virtual/most/mostcore/aims/cdev/add_link 2>/dev/null +#aim: cdev +#name: inic-usb-ctx +echo tx > /sys/devices/virtual/most/mostcore/devices/mdev0/ep07/set_direction 2>/dev/null +echo control > /sys/devices/virtual/most/mostcore/devices/mdev0/ep07/set_datatype 2>/dev/null +echo 16 > /sys/devices/virtual/most/mostcore/devices/mdev0/ep07/set_number_of_buffers 2>/dev/null +echo 64 > /sys/devices/virtual/most/mostcore/devices/mdev0/ep07/set_buffer_size 2>/dev/null + +echo mdev0:ep07:inic-usb-ctx > /sys/devices/virtual/most/mostcore/aims/cdev/add_link 2>/dev/null +########################################### +## interface: mdev1 +## chip: Durango +## aim: networking +##name: inic-usb-arx +echo rx > /sys/devices/virtual/most/mostcore/devices/mdev1/ep86/set_direction 2>/dev/null +echo async > /sys/devices/virtual/most/mostcore/devices/mdev1/ep86/set_datatype 2>/dev/null +echo 20 > /sys/devices/virtual/most/mostcore/devices/mdev1/ep86/set_number_of_buffers 2>/dev/null +echo 1522 > /sys/devices/virtual/most/mostcore/devices/mdev1/ep86/set_buffer_size 2>/dev/null + +echo mdev1:ep86:inic-usb-arx > /sys/devices/virtual/most/mostcore/aims/networking/add_link 2>/dev/null +#aim: networking +#name: inic-usb-atx +echo tx > /sys/devices/virtual/most/mostcore/devices/mdev1/ep06/set_direction 2>/dev/null +echo async > /sys/devices/virtual/most/mostcore/devices/mdev1/ep06/set_datatype 2>/dev/null +echo 20 > /sys/devices/virtual/most/mostcore/devices/mdev1/ep06/set_number_of_buffers 2>/dev/null +echo 1522 > /sys/devices/virtual/most/mostcore/devices/mdev1/ep06/set_buffer_size 2>/dev/null + +echo mdev1:ep06:inic-usb-atx > /sys/devices/virtual/most/mostcore/aims/networking/add_link 2>/dev/null + +########################################## +# interface: mdev2 +#aim: sound +#name: ep01-6ch.6x16 +echo tx > /sys/devices/virtual/most/mostcore/devices/mdev2/ep01/set_direction 2>/dev/null +echo sync > /sys/devices/virtual/most/mostcore/devices/mdev2/ep01/set_datatype 2>/dev/null +echo 16 > /sys/devices/virtual/most/mostcore/devices/mdev2/ep01/set_number_of_buffers 2>/dev/null +echo 1008 > /sys/devices/virtual/most/mostcore/devices/mdev2/ep01/set_buffer_size 2>/dev/null +echo 12 > /sys/devices/virtual/most/mostcore/devices/mdev2/ep01/set_subbuffer_size 2>/dev/null +echo 42 > /sys/devices/virtual/most/mostcore/devices/mdev2/ep01/set_packets_per_xact 2>/dev/null + +echo mdev2:ep01:ep01-6ch.6x16 > /sys/devices/virtual/most/mostcore/aims/sound/add_link 2>/dev/null + +# interface: mdev2 +# aim: sound +# name: ep81-1ch.1x16 +echo rx > /sys/devices/virtual/most/mostcore/devices/mdev2/ep81/set_direction 2>/dev/null +echo sync > /sys/devices/virtual/most/mostcore/devices/mdev2/ep81/set_datatype 2>/dev/null +echo 8 > /sys/devices/virtual/most/mostcore/devices/mdev2/ep81/set_number_of_buffers 2>/dev/null +echo 2048 > /sys/devices/virtual/most/mostcore/devices/mdev2/ep81/set_buffer_size 2>/dev/null +echo 2 > /sys/devices/virtual/most/mostcore/devices/mdev2/ep81/set_subbuffer_size 2>/dev/null +echo 256 > /sys/devices/virtual/most/mostcore/devices/mdev2/ep81/set_packets_per_xact 2>/dev/null + +echo mdev2:ep81:ep81-1ch.1x16 > /sys/devices/virtual/most/mostcore/aims/sound/add_link 2>/dev/null + +# interface: mdev2 +# aim: sound +# name: ep82-1ch.1x16 +echo rx > /sys/devices/virtual/most/mostcore/devices/mdev2/ep82/set_direction 2>/dev/null +echo sync > /sys/devices/virtual/most/mostcore/devices/mdev2/ep82/set_datatype 2>/dev/null +echo 8 > /sys/devices/virtual/most/mostcore/devices/mdev2/ep82/set_number_of_buffers 2>/dev/null +echo 2048 > /sys/devices/virtual/most/mostcore/devices/mdev2/ep82/set_buffer_size 2>/dev/null +echo 2 > /sys/devices/virtual/most/mostcore/devices/mdev2/ep82/set_subbuffer_size 2>/dev/null +echo 256 > /sys/devices/virtual/most/mostcore/devices/mdev2/ep82/set_packets_per_xact 2>/dev/null + +echo mdev2:ep82:ep82-1ch.1x16 > /sys/devices/virtual/most/mostcore/aims/sound/add_link 2>/dev/null + +##aim: cdev +##name: inic-usb-itx1 +echo tx > /sys/devices/virtual/most/mostcore/devices/mdev2/ep02/set_direction 2>/dev/null +echo isoc > /sys/devices/virtual/most/mostcore/devices/mdev2/ep02/set_datatype 2>/dev/null +echo 8 > /sys/devices/virtual/most/mostcore/devices/mdev2/ep02/set_number_of_buffers 2>/dev/null +echo 7520 > /sys/devices/virtual/most/mostcore/devices/mdev2/ep02/set_buffer_size 2>/dev/null +echo 188 > /sys/devices/virtual/most/mostcore/devices/mdev2/ep02/set_subbuffer_size 2>/dev/null +echo 2 > /sys/devices/virtual/most/mostcore/devices/mdev2/ep02/set_packets_per_xact 2>/dev/null + +echo mdev2:ep02:inic-usb-itx1 > /sys/devices/virtual/most/mostcore/aims/cdev/add_link 2>/dev/null diff --git a/_to_remove/recipes-config/unicens-config/unicens-config.bb b/_to_remove/recipes-config/unicens-config/unicens-config.bb new file mode 100644 index 000000000..57b93a76f --- /dev/null +++ b/_to_remove/recipes-config/unicens-config/unicens-config.bb @@ -0,0 +1,31 @@ +DESCRIPTION = "Configure MOST driver" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" + +RDEPENDS:${PN} = "bash" + +SRC_URI = "\ + file://unicens-config.service \ + file://unicens-config.sh \ + file://55-inic.rules \ +" + + +inherit systemd + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE:${PN} = "unicens-config.service" +SYSTEMD_AUTO_ENABLE:${PN} = "enable" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +do_install() { + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/unicens-config.service ${D}${systemd_system_unitdir} + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/unicens-config.sh ${D}${bindir} + install -D -m 0644 ${WORKDIR}/55-inic.rules ${D}${sysconfdir}/udev/rules.d/55-inic.rules +} + +FILES:${PN} += "${systemd_system_unitdir}" |