diff options
Diffstat (limited to 'ATTIC')
40 files changed, 1948 insertions, 0 deletions
diff --git a/ATTIC/agl-audio-4a-framework/50_bblayers.conf.inc b/ATTIC/agl-audio-4a-framework/50_bblayers.conf.inc new file mode 100644 index 00000000..a4889083 --- /dev/null +++ b/ATTIC/agl-audio-4a-framework/50_bblayers.conf.inc @@ -0,0 +1,5 @@ + +BBLAYERS =+ " \ + ${METADIR}/meta-agl-devel/meta-audio-4a-framework \ + " + diff --git a/ATTIC/agl-audio-4a-framework/50_local.conf.inc b/ATTIC/agl-audio-4a-framework/50_local.conf.inc new file mode 100644 index 00000000..91d4c863 --- /dev/null +++ b/ATTIC/agl-audio-4a-framework/50_local.conf.inc @@ -0,0 +1,2 @@ +#see meta-agl-devel/meta-audio-4a-framework/conf/include/agl-audio-4a-framework.inc +require conf/include/agl-audio-4a-framework.inc diff --git a/ATTIC/meta-audio-4a-framework/README.md b/ATTIC/meta-audio-4a-framework/README.md new file mode 100644 index 00000000..37dd360a --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/README.md @@ -0,0 +1,3 @@ +Collection of recipes for first integration of 4A (Advanced AGL Audio Architecture). + +This layer should disappear and recipes merged into meta-agl. diff --git a/ATTIC/meta-audio-4a-framework/classes/afb-system-cmake.bbclass b/ATTIC/meta-audio-4a-framework/classes/afb-system-cmake.bbclass new file mode 100644 index 00000000..67ad7260 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/classes/afb-system-cmake.bbclass @@ -0,0 +1,6 @@ +inherit afb-system + +DEPENDS += "alsa-lib json-c systemd af-binder cmake-apps-module-native" +inherit cmake pkgconfig + +EXTRA_OECMAKE_append = " -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX}" diff --git a/ATTIC/meta-audio-4a-framework/classes/afb-system.bbclass b/ATTIC/meta-audio-4a-framework/classes/afb-system.bbclass new file mode 100644 index 00000000..b553d621 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/classes/afb-system.bbclass @@ -0,0 +1 @@ +INSTALL_PREFIX = "${libexecdir}/agl" diff --git a/ATTIC/meta-audio-4a-framework/conf/include/agl-audio-4a-framework.inc b/ATTIC/meta-audio-4a-framework/conf/include/agl-audio-4a-framework.inc new file mode 100644 index 00000000..12711f66 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/conf/include/agl-audio-4a-framework.inc @@ -0,0 +1,24 @@ +# In order to enable the audio-4a-framework features , +# enables the following line: +# +DISTRO_FEATURES_append = " agl-audio-4a-framework " + +# asound.conf is provided by the 4a-hal-config (and not by asound.state) +#VIRTUAL-RUNTIME_alsa-state = "4a-hal-config" +VIRTUAL_RUNTIME_alsa-state = "" +# additionally there is a bug in alsa-utils-alsactl where it pulls in alsa-state directly +RRECOMMENDS_pn-alsa-utils-alsactl = "VIRTUAL-RUNTIME_alsa-state" + +# why should a config package have -dev ... I'll leave that answer to you. +PACKAGES_pn-alsa-state_remove = "alsa-state-dev" +PACKAGES_pn-alsa-state_remove = "alsa-states-dev" +PACKAGES_pn-alsa-state = "alsa-state alsa-states" + +PREFERRED_PROVIDER_virtual/mixer ?= "4a-mixer" +PREFERRED_RPROVIDER_virtual/mixer ?= "4a-mixer" + +PREFERRED_VERSION_alsa-lib = "1.1.6" +PREFERRED_VERSION_alsa-plugins = "1.1.6" +PREFERRED_VERSION_alsa-tools = "1.1.6" +PREFERRED_VERSION_alsa-utils = "1.1.6" +PREFERRED_VERSION_alsa-utils-scripts = "1.1.6" diff --git a/ATTIC/meta-audio-4a-framework/conf/layer.conf b/ATTIC/meta-audio-4a-framework/conf/layer.conf new file mode 100644 index 00000000..dc190b66 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/conf/layer.conf @@ -0,0 +1,23 @@ +# We have a conf and classes directory, add to BBPATH +BBPATH .= ":${LAYERDIR}" + +# Fix for SPEC-1588 +# Let us add layer-specific bbappends which are only applied when that +# layer is included in our configuration - +# e.g. only add layers if a bsp is present. +# This is based on the BBFILE_COLLECTIONS name of the layer. +BBFILES += "${@' '.join('${LAYERDIR}/meta-%s/recipes*/*/*.bbappend' % layer \ + for layer in BBFILE_COLLECTIONS.split())}" +BBFILES += "${@' '.join('${LAYERDIR}/meta-%s/recipes*/*/*.bb' % layer \ + for layer in BBFILE_COLLECTIONS.split())}" + + +# We have recipes-* directories, add to BBFILES +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend" + +BBFILE_COLLECTIONS += "4a-framework" +BBFILE_PATTERN_4a-framework = "^${LAYERDIR}/" +BBFILE_PRIORITY_4a-framework = "8" + +LAYERSERIES_COMPAT_4a-framework = "thud" diff --git a/ATTIC/meta-audio-4a-framework/meta-agl-demo/recipes-multimedia/4a-mixer/4a-mixer_git.bb b/ATTIC/meta-audio-4a-framework/meta-agl-demo/recipes-multimedia/4a-mixer/4a-mixer_git.bb new file mode 100644 index 00000000..f87d4d20 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/meta-agl-demo/recipes-multimedia/4a-mixer/4a-mixer_git.bb @@ -0,0 +1,27 @@ +SUMMARY = "Mixer for CES2017 AGL Demonstration" +DESCRIPTION = "AGL HMI application for control of PulseAudio mixer elements" +HOMEPAGE = "https://gerrit.automotivelinux.org/gerrit/#/admin/projects/apps/mixer" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=ae6497158920d9524cf208c09cc4c984" + +SRC_URI = "gitsm://gerrit.automotivelinux.org/gerrit/apps/mixer;protocol=https;branch=${AGL_BRANCH}" +SRCREV = "${AGL_APP_REVISION}" + +PV = "1.0+git${SRCPV}" +S = "${WORKDIR}/git" + +# build-time dependencies +DEPENDS += "qtquickcontrols2 \ + qtwebsockets \ + qtaglextras \ + libafb-helpers-qt \ +" + +PROVIDES += "virtual/mixer" +RPROVIDES_${PN} += "virtual/mixer" + +inherit cmake_qt5 aglwgt + +OECMAKE_CXX_FLAGS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'agl-devel', '' , '-DQT_NO_DEBUG_OUTPUT', d)}" diff --git a/ATTIC/meta-audio-4a-framework/recipes-connectivity/bluez-alsa/bluez-alsa/0001-build-and-link-with-a-shared-library.patch b/ATTIC/meta-audio-4a-framework/recipes-connectivity/bluez-alsa/bluez-alsa/0001-build-and-link-with-a-shared-library.patch new file mode 100644 index 00000000..53ee3ad0 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-connectivity/bluez-alsa/bluez-alsa/0001-build-and-link-with-a-shared-library.patch @@ -0,0 +1,853 @@ +From 7625b67a687b7a365d9d758a86ed05e84b2b3a61 Mon Sep 17 00:00:00 2001 +From: Thierry Bultel <thierry.bultel@iot.bzh> +Date: Mon, 3 Dec 2018 14:29:07 +0100 +Subject: [PATCH 1/3] build and link with a shared library + +Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh> +--- + configure.ac | 4 +- + includes/bluealsa/bluealsa.h | 21 ++++++ + {src/shared => includes/bluealsa}/ctl-client.h | 2 +- + {src/shared => includes/bluealsa}/ctl-proto.h | 0 + {src/shared => includes/bluealsa}/defs.h | 0 + {src/shared => includes/bluealsa}/ffb.h | 0 + {src/shared => includes/bluealsa}/log.h | 0 + {src/shared => includes/bluealsa}/rt.h | 0 + src/Makefile.am | 11 ++- + src/asound/Makefile.am | 15 ++-- + src/asound/bluealsa-ctl.c | 6 +- + src/asound/bluealsa-pcm.c | 10 +-- + src/at.c | 4 +- + src/bluealsa.h | 2 +- + src/bluealsalib/Makefile.am | 50 ++++++++++++++ + src/bluealsalib/bluealsa.pc.in | 12 ++++ + src/bluez-a2dp.c | 2 +- + src/bluez.c | 2 +- + src/ctl.c | 4 +- + src/ctl.h | 2 +- + src/io.c | 8 +-- + src/main.c | 4 +- + src/ofono.c | 2 +- + src/rfcomm.c | 4 +- + src/shared/ctl-client.c | 4 +- + src/shared/ffb.c | 2 +- + src/shared/log.c | 4 +- + src/shared/rt.c | 2 +- + src/transport.c | 2 +- + src/utils.c | 2 +- + test/Makefile.am | 10 ++- + test/server-mock.c | 3 - + test/test-at.c | 1 - + test/test-bluealsalib.c | 96 ++++++++++++++++++++++++++ + test/test-io.c | 3 - + test/test-utils.c | 8 +-- + utils/Makefile.am | 11 ++- + utils/aplay.c | 8 +-- + utils/rfcomm.c | 4 +- + 39 files changed, 252 insertions(+), 73 deletions(-) + create mode 100644 includes/bluealsa/bluealsa.h + rename {src/shared => includes/bluealsa}/ctl-client.h (98%) + rename {src/shared => includes/bluealsa}/ctl-proto.h (100%) + rename {src/shared => includes/bluealsa}/defs.h (100%) + rename {src/shared => includes/bluealsa}/ffb.h (100%) + rename {src/shared => includes/bluealsa}/log.h (100%) + rename {src/shared => includes/bluealsa}/rt.h (100%) + create mode 100644 src/bluealsalib/Makefile.am + create mode 100644 src/bluealsalib/bluealsa.pc.in + create mode 100644 test/test-bluealsalib.c + +diff --git a/configure.ac b/configure.ac +index 0bb9452..6323d60 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -152,8 +152,10 @@ AC_CONFIG_FILES([ + Makefile + src/Makefile + src/asound/Makefile ++ src/bluealsalib/Makefile + utils/Makefile +- test/Makefile]) ++ test/Makefile ++ src/bluealsalib/bluealsa.pc]) + AC_OUTPUT + + # warn user that alsa-lib thread-safety makes troubles +diff --git a/includes/bluealsa/bluealsa.h b/includes/bluealsa/bluealsa.h +new file mode 100644 +index 0000000..062856a +--- /dev/null ++++ b/includes/bluealsa/bluealsa.h +@@ -0,0 +1,21 @@ ++/* ++ * BlueALSA - bluealsa.h ++ * Copyright (c) 2018 Thierry Bultel ++ * ++ * This file is a part of bluez-alsa. ++ * ++ * This project is licensed under the terms of the MIT license. ++ * ++ */ ++ ++#ifndef BLUEALSA_H ++#define BLUEALSA_H ++ ++#include <bluealsa/ctl-client.h> ++#include <bluealsa/defs.h> ++ ++typedef int (*transport_update_cb) (struct ba_msg_transport *transports); ++ ++extern int bluelsa_register_transport_update_cb(const char * interfance, transport_update_cb cb); ++ ++#endif +diff --git a/src/shared/ctl-client.h b/includes/bluealsa/ctl-client.h +similarity index 98% +rename from src/shared/ctl-client.h +rename to includes/bluealsa/ctl-client.h +index 3dc93a6..b8af154 100644 +--- a/src/shared/ctl-client.h ++++ b/includes/bluealsa/ctl-client.h +@@ -12,7 +12,7 @@ + #define BLUEALSA_SHARED_CTLCLIENT_H_ + + #include <stdbool.h> +-#include "shared/ctl-proto.h" ++#include <bluealsa/ctl-proto.h> + + int bluealsa_open(const char *interface); + +diff --git a/src/shared/ctl-proto.h b/includes/bluealsa/ctl-proto.h +similarity index 100% +rename from src/shared/ctl-proto.h +rename to includes/bluealsa/ctl-proto.h +diff --git a/src/shared/defs.h b/includes/bluealsa/defs.h +similarity index 100% +rename from src/shared/defs.h +rename to includes/bluealsa/defs.h +diff --git a/src/shared/ffb.h b/includes/bluealsa/ffb.h +similarity index 100% +rename from src/shared/ffb.h +rename to includes/bluealsa/ffb.h +diff --git a/src/shared/log.h b/includes/bluealsa/log.h +similarity index 100% +rename from src/shared/log.h +rename to includes/bluealsa/log.h +diff --git a/src/shared/rt.h b/includes/bluealsa/rt.h +similarity index 100% +rename from src/shared/rt.h +rename to includes/bluealsa/rt.h +diff --git a/src/Makefile.am b/src/Makefile.am +index fb1241d..5626ae5 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -2,12 +2,9 @@ + # Copyright (c) 2016-2018 Arkadiusz Bokowy + + bin_PROGRAMS = bluealsa +-SUBDIRS = asound ++SUBDIRS = bluealsalib asound + + bluealsa_SOURCES = \ +- shared/ffb.c \ +- shared/log.c \ +- shared/rt.c \ + at.c \ + bluealsa.c \ + bluez.c \ +@@ -34,7 +31,8 @@ AM_CFLAGS = \ + @APTX_CFLAGS@ \ + @LDAC_CFLAGS@ \ + @LDAC_ABR_CFLAGS@ \ +- @SBC_CFLAGS@ ++ @SBC_CFLAGS@ \ ++ -I$(top_srcdir)/includes + + LDADD = \ + @BLUEZ_LIBS@ \ +@@ -44,4 +42,5 @@ LDADD = \ + @APTX_LIBS@ \ + @LDAC_LIBS@ \ + @LDAC_ABR_LIBS@ \ +- @SBC_LIBS@ ++ @SBC_LIBS@ \ ++ bluealsalib/libbluealsa.la +diff --git a/src/asound/Makefile.am b/src/asound/Makefile.am +index 923d884..24618f1 100644 +--- a/src/asound/Makefile.am ++++ b/src/asound/Makefile.am +@@ -5,32 +5,35 @@ EXTRA_DIST = 20-bluealsa.conf + + asound_module_ctl_LTLIBRARIES = libasound_module_ctl_bluealsa.la + asound_module_pcm_LTLIBRARIES = libasound_module_pcm_bluealsa.la ++ + asound_module_conf_DATA = 20-bluealsa.conf + + libasound_module_ctl_bluealsa_la_SOURCES = \ +- ../shared/ctl-client.c \ +- ../shared/log.c \ + bluealsa-ctl.c ++ + libasound_module_pcm_bluealsa_la_SOURCES = \ +- ../shared/ctl-client.c \ +- ../shared/log.c \ +- ../shared/rt.c \ + bluealsa-pcm.c + + asound_module_ctldir = @ALSA_PLUGIN_DIR@ + asound_module_pcmdir = @ALSA_PLUGIN_DIR@ ++ + asound_module_confdir = @ALSA_CONF_DIR@ + + AM_CFLAGS = \ + -I$(top_srcdir)/src \ ++ -I$(top_srcdir)/includes \ + @ALSA_CFLAGS@ \ + @BLUEZ_CFLAGS@ \ + @GLIB2_CFLAGS@ + +-AM_LDFLAGS = -module -avoid-version ++AM_LDFLAGS = \ ++ -module \ ++ -avoid-version \ ++ ../bluealsalib/libbluealsa.la + + libasound_module_ctl_bluealsa_la_LIBADD = \ + @ALSA_LIBS@ ++ + libasound_module_pcm_bluealsa_la_LIBADD = \ + @ALSA_LIBS@ \ + @BLUEZ_LIBS@ +diff --git a/src/asound/bluealsa-ctl.c b/src/asound/bluealsa-ctl.c +index f4a0181..1b9d124 100644 +--- a/src/asound/bluealsa-ctl.c ++++ b/src/asound/bluealsa-ctl.c +@@ -19,9 +19,9 @@ + #include <alsa/asoundlib.h> + #include <alsa/control_external.h> + +-#include "shared/ctl-client.h" +-#include "shared/ctl-proto.h" +-#include "shared/log.h" ++#include <bluealsa/ctl-client.h> ++#include <bluealsa/ctl-proto.h> ++#include <bluealsa/log.h> + + + enum ctl_elem_type { +diff --git a/src/asound/bluealsa-pcm.c b/src/asound/bluealsa-pcm.c +index 258aebd..42cb61d 100644 +--- a/src/asound/bluealsa-pcm.c ++++ b/src/asound/bluealsa-pcm.c +@@ -23,11 +23,11 @@ + #include <alsa/asoundlib.h> + #include <alsa/pcm_external.h> + +-#include "shared/ctl-client.h" +-#include "shared/ctl-proto.h" +-#include "shared/defs.h" +-#include "shared/log.h" +-#include "shared/rt.h" ++#include <bluealsa/ctl-client.h> ++#include <bluealsa/ctl-proto.h> ++#include <bluealsa/defs.h> ++#include <bluealsa/log.h> ++#include <bluealsa/rt.h> + + + struct bluealsa_pcm { +diff --git a/src/at.c b/src/at.c +index e3d1703..bda2255 100644 +--- a/src/at.c ++++ b/src/at.c +@@ -16,8 +16,8 @@ + #include <stdio.h> + #include <string.h> + +-#include "shared/defs.h" +-#include "shared/log.h" ++#include <bluealsa/defs.h> ++#include <bluealsa/log.h> + + + /** +diff --git a/src/bluealsa.h b/src/bluealsa.h +index 7968ba9..7eee34f 100644 +--- a/src/bluealsa.h ++++ b/src/bluealsa.h +@@ -27,7 +27,7 @@ + #include "bluez.h" + #include "bluez-a2dp.h" + #include "transport.h" +-#include "shared/ctl-proto.h" ++#include <bluealsa/ctl-proto.h> + + struct ba_config { + +diff --git a/src/bluealsalib/Makefile.am b/src/bluealsalib/Makefile.am +new file mode 100644 +index 0000000..11d9e00 +--- /dev/null ++++ b/src/bluealsalib/Makefile.am +@@ -0,0 +1,50 @@ ++# BlueALSA - Makefile.am ++# Copyright (c) 2018 Thiery Bultel (thierry.bultel@iot.bzh) ++ ++bluealsalib_LTLIBRARIES = libbluealsa.la ++ ++libbluealsa_la_SOURCES = \ ++ ../shared/ctl-client.c \ ++ ../shared/ffb.c \ ++ ../shared/log.c \ ++ ../shared/rt.c ++ ++EXTRA_DIST=bluealsa.pc.in ++ ++pkgconfigdir = $(libdir)/pkgconfig ++pkgconfig_DATA = bluealsa.pc ++ ++AM_CFLAGS = \ ++ -I$(top_srcdir)/src \ ++ -I$(top_srcdir)/includes \ ++ @ALSA_CFLAGS@ \ ++ @BLUEZ_CFLAGS@ \ ++ @GLIB2_CFLAGS@ ++ ++libbluealsa_la_LIBADD = \ ++ @ALSA_LIBS@ \ ++ @BLUEZ_LIBS@ ++ ++libbluealsa_la_LDFLAGS = \ ++ $(AM_LDFLAGS) \ ++ -version-info 1:0:0 ++ ++bluealsalibdir = $(libdir) ++ ++# install path for published headers ++bluealsalibincludedir=$(includedir)/bluealsa ++ ++bluealsalib_headers_dir=../../includes/bluealsa ++ ++bluealsalib_headers = \ ++ $(bluealsalib_headers_dir)/bluealsa.h \ ++ $(bluealsalib_headers_dir)/ctl-client.h \ ++ $(bluealsalib_headers_dir)/ctl-proto.h \ ++ $(bluealsalib_headers_dir)/defs.h \ ++ $(bluealsalib_headers_dir)/ffb.h \ ++ $(bluealsalib_headers_dir)/log.h \ ++ $(bluealsalib_headers_dir)/rt.h ++ ++libbluealsa_la_SOURCES += $(bluealsalib_headers) ++ ++bluealsalibinclude_HEADERS = $(bluealsalib_headers) +diff --git a/src/bluealsalib/bluealsa.pc.in b/src/bluealsalib/bluealsa.pc.in +new file mode 100644 +index 0000000..93c3c4a +--- /dev/null ++++ b/src/bluealsalib/bluealsa.pc.in +@@ -0,0 +1,12 @@ ++prefix=@prefix@ ++exec_prefix=@exec_prefix@ ++libdir=@libdir@ ++includedir=@includedir@ ++ ++Name: alsa ++Description: Bluez-Alsa - Library ++Version: @VERSION@ ++Requires: ++Libs: -L${libdir} -lbluealsa ++#Libs.private: @ALSA_DEPLIBS@ ++Cflags: -I${includedir}/bluealsa +diff --git a/src/bluez-a2dp.c b/src/bluez-a2dp.c +index 5f81e6e..4c7b07b 100644 +--- a/src/bluez-a2dp.c ++++ b/src/bluez-a2dp.c +@@ -13,7 +13,7 @@ + #endif + + #include "bluez-a2dp.h" +-#include "shared/defs.h" ++#include <bluealsa/defs.h> + + static const a2dp_sbc_t a2dp_sbc = { + .frequency = +diff --git a/src/bluez.c b/src/bluez.c +index 537f0fe..591fdce 100644 +--- a/src/bluez.c ++++ b/src/bluez.c +@@ -24,7 +24,7 @@ + #include "ctl.h" + #include "transport.h" + #include "utils.h" +-#include "shared/log.h" ++#include <bluealsa/log.h> + + + /** +diff --git a/src/ctl.c b/src/ctl.c +index ae2b812..dd3ab45 100644 +--- a/src/ctl.c ++++ b/src/ctl.c +@@ -32,8 +32,8 @@ + #include "hfp.h" + #include "transport.h" + #include "utils.h" +-#include "shared/defs.h" +-#include "shared/log.h" ++#include <bluealsa/defs.h> ++#include <bluealsa/log.h> + + /* Special PCM type for internal usage only. */ + #define BA_PCM_TYPE_RFCOMM 0x1F +diff --git a/src/ctl.h b/src/ctl.h +index 0e3c46b..593a9fd 100644 +--- a/src/ctl.h ++++ b/src/ctl.h +@@ -11,7 +11,7 @@ + #ifndef BLUEALSA_CTL_H_ + #define BLUEALSA_CTL_H_ + +-#include "shared/ctl-proto.h" ++#include <bluealsa/ctl-proto.h> + + /* Indexes of special file descriptors in the poll array. */ + #define CTL_IDX_SRV 0 +diff --git a/src/io.c b/src/io.c +index b3d7ac9..f81eeb0 100644 +--- a/src/io.c ++++ b/src/io.c +@@ -44,10 +44,10 @@ + #include "bluealsa.h" + #include "transport.h" + #include "utils.h" +-#include "shared/defs.h" +-#include "shared/ffb.h" +-#include "shared/log.h" +-#include "shared/rt.h" ++#include <bluealsa/defs.h> ++#include <bluealsa/ffb.h> ++#include <bluealsa/log.h> ++#include <bluealsa/rt.h> + + + /** +diff --git a/src/main.c b/src/main.c +index 35e6702..9cef402 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -37,8 +37,8 @@ + #endif + #include "transport.h" + #include "utils.h" +-#include "shared/defs.h" +-#include "shared/log.h" ++#include <bluealsa/defs.h> ++#include <bluealsa/log.h> + + + static char *get_a2dp_codecs( +diff --git a/src/ofono.c b/src/ofono.c +index 902d099..bfd4e39 100644 +--- a/src/ofono.c ++++ b/src/ofono.c +@@ -27,7 +27,7 @@ + #include "ctl.h" + #include "ofono-iface.h" + #include "transport.h" +-#include "shared/log.h" ++#include <bluealsa/log.h> + + #define OFONO_FAKE_DEV_ID 0xffff + +diff --git a/src/rfcomm.c b/src/rfcomm.c +index a86ae61..2d76725 100644 +--- a/src/rfcomm.c ++++ b/src/rfcomm.c +@@ -17,11 +17,11 @@ + #include <string.h> + #include <unistd.h> + ++#include <bluealsa/defs.h> + #include "bluealsa.h" + #include "ctl.h" + #include "utils.h" +-#include "shared/defs.h" +-#include "shared/log.h" ++#include <bluealsa/log.h> + + + /** +diff --git a/src/shared/ctl-client.c b/src/shared/ctl-client.c +index 6cf9402..2da9a54 100644 +--- a/src/shared/ctl-client.c ++++ b/src/shared/ctl-client.c +@@ -8,7 +8,7 @@ + * + */ + +-#include "shared/ctl-client.h" ++#include <bluealsa/ctl-client.h> + + #include <errno.h> + #include <fcntl.h> +@@ -19,7 +19,7 @@ + #include <sys/types.h> + #include <sys/un.h> + +-#include "shared/log.h" ++#include <bluealsa/log.h> + + + /** +diff --git a/src/shared/ffb.c b/src/shared/ffb.c +index b31d7d1..ab50f4a 100644 +--- a/src/shared/ffb.c ++++ b/src/shared/ffb.c +@@ -8,7 +8,7 @@ + * + */ + +-#include "shared/ffb.h" ++#include "../../includes/bluealsa/ffb.h" + + + /** +diff --git a/src/shared/log.c b/src/shared/log.c +index 65f0fea..884540c 100644 +--- a/src/shared/log.c ++++ b/src/shared/log.c +@@ -8,7 +8,7 @@ + * + */ + +-#include "shared/log.h" ++#include <bluealsa/log.h> + + #include <pthread.h> + #include <stdarg.h> +@@ -17,7 +17,7 @@ + #include <string.h> + #include <syslog.h> + +-#include "shared/rt.h" ++#include <bluealsa/rt.h> + + + /* internal logging identifier */ +diff --git a/src/shared/rt.c b/src/shared/rt.c +index edcbebc..40bd721 100644 +--- a/src/shared/rt.c ++++ b/src/shared/rt.c +@@ -8,7 +8,7 @@ + * + */ + +-#include "shared/rt.h" ++#include <bluealsa/rt.h> + + #include <stdlib.h> + +diff --git a/src/transport.c b/src/transport.c +index 7253925..1617dd1 100644 +--- a/src/transport.c ++++ b/src/transport.c +@@ -34,7 +34,7 @@ + #include "io.h" + #include "rfcomm.h" + #include "utils.h" +-#include "shared/log.h" ++#include <bluealsa/log.h> + + + static const char *transport_type_to_string(enum ba_transport_type type) { +diff --git a/src/utils.c b/src/utils.c +index 70d069e..27459d2 100644 +--- a/src/utils.c ++++ b/src/utils.c +@@ -24,7 +24,7 @@ + + #include "a2dp-codecs.h" + #include "bluez.h" +-#include "shared/log.h" ++#include <bluealsa/log.h> + + + /** +diff --git a/test/Makefile.am b/test/Makefile.am +index 104dc63..8f7b2eb 100644 +--- a/test/Makefile.am ++++ b/test/Makefile.am +@@ -6,7 +6,8 @@ TESTS = \ + test-ctl \ + test-io \ + test-pcm \ +- test-utils ++ test-utils \ ++ test-bluealsalib + + check_PROGRAMS = \ + server-mock \ +@@ -14,7 +15,8 @@ check_PROGRAMS = \ + test-ctl \ + test-io \ + test-pcm \ +- test-utils ++ test-utils \ ++ test-bluealsalib + + check_LTLIBRARIES = \ + aloader.la +@@ -25,6 +27,7 @@ aloader_la_LDFLAGS = \ + + AM_CFLAGS = \ + -I$(top_srcdir)/src \ ++ -I$(top_srcdir)/includes \ + @AAC_CFLAGS@ \ + @ALSA_CFLAGS@ \ + @APTX_CFLAGS@ \ +@@ -46,4 +49,5 @@ LDADD = \ + @GLIB2_LIBS@ \ + @LDAC_ABR_LIBS@ \ + @LDAC_LIBS@ \ +- @SBC_LIBS@ ++ @SBC_LIBS@ \ ++ ../src/bluealsalib/libbluealsa.la +diff --git a/test/server-mock.c b/test/server-mock.c +index 8c3a90e..c88fa35 100644 +--- a/test/server-mock.c ++++ b/test/server-mock.c +@@ -31,9 +31,6 @@ + #include "../src/rfcomm.c" + #include "../src/transport.c" + #include "../src/utils.c" +-#include "../src/shared/ffb.c" +-#include "../src/shared/log.c" +-#include "../src/shared/rt.c" + + static const a2dp_sbc_t cconfig = { + .frequency = SBC_SAMPLING_FREQ_44100, +diff --git a/test/test-at.c b/test/test-at.c +index 8cff264..a847c22 100644 +--- a/test/test-at.c ++++ b/test/test-at.c +@@ -11,7 +11,6 @@ + #include <check.h> + + #include "../src/at.c" +-#include "../src/shared/log.c" + + START_TEST(test_at_build) { + +diff --git a/test/test-bluealsalib.c b/test/test-bluealsalib.c +new file mode 100644 +index 0000000..d5fa3ff +--- /dev/null ++++ b/test/test-bluealsalib.c +@@ -0,0 +1,96 @@ ++/* ++ * test-bluealsalib.c ++ * Copyright (c) 2018 Thierry Bultel ++ * ++ * This file is a part of bluez-alsa. ++ * ++ * This project is licensed under the terms of the MIT license. ++ * ++ */ ++ ++// TODO monitor all available interfaces ++const char * ba_interface = "hci0"; ++ ++#include <bluealsa/bluealsa.h> ++#include <bluealsa/log.h> ++#include <pthread.h> ++#include <errno.h> ++#include <poll.h> ++ ++ ++static void * monitor_thread_entry(void* arg) { ++ debug("..."); ++ ++ int ba_fd, ba_event_fd; ++ enum ba_event transport_mask = BA_EVENT_TRANSPORT_ADDED | BA_EVENT_TRANSPORT_CHANGED|BA_EVENT_TRANSPORT_REMOVED; ++ ++ if ((ba_fd = bluealsa_open(ba_interface)) == -1) { ++ error("BlueALSA connection failed: %s", strerror(errno)); ++ goto fail; ++ } ++ ++ if ((ba_event_fd = bluealsa_open(ba_interface)) == -1) { ++ error("BlueALSA connection failed: %s", strerror(errno)); ++ goto fail; ++ } ++ ++ if (bluealsa_subscribe(ba_event_fd, transport_mask) == -1) { ++ error("BlueALSA subscription failed: %s", strerror(errno)); ++ goto fail; ++ } ++ ++goto init; ++ ++ while (true) { ++ ++ struct ba_msg_event event; ++ struct ba_msg_transport *transports; ++ ssize_t ret; ++ size_t i; ++ ++ struct pollfd pfds[] = {{ ba_event_fd, POLLIN, 0 }}; ++ if (poll(pfds, ARRAYSIZE(pfds), -1) == -1 && errno == EINTR) ++ continue; ++ ++ while ((ret = recv(ba_event_fd, &event, sizeof(event), MSG_DONTWAIT)) == -1 && errno == EINTR) ++ continue; ++ if (ret != sizeof(event)) { ++ error("Couldn't read event: %s", strerror(ret == -1 ? errno : EBADMSG)); ++ goto fail; ++ } ++ ++init: ++ debug("Fetching available transports"); ++ if ((ret = bluealsa_get_transports(ba_fd, &transports)) == -1) { ++ error("Couldn't get transports: %s", strerror(errno)); ++ goto fail; ++ } ++ ++ debug("Got %d transports", ret); ++ ++ for (int ix=0; ix<ret; ix++) { ++ char addr[18]; ++ struct ba_msg_transport * transport = &transports[ix]; ++ ba2str(&transport->addr, addr); ++ info("Transport %d: type %d, dev %s", ix, transport->type, addr); ++ } ++ ++ } ++ ++fail: ++ info("exit"); ++ return NULL; ++} ++ ++int main(int argc, char * argv[]) { ++ printf("%s... !\n", argv[0]); ++ ++ pthread_t monitor; ++ if (pthread_create(&monitor, NULL, monitor_thread_entry, NULL) == -1) { ++ debug("failed to create the monitor thread"); ++ goto fail; ++ } ++ pthread_join(monitor, NULL); ++fail: ++ return 0; ++} +diff --git a/test/test-io.c b/test/test-io.c +index d913d2f..8ebb1d8 100644 +--- a/test/test-io.c ++++ b/test/test-io.c +@@ -21,9 +21,6 @@ + #include "../src/rfcomm.c" + #include "../src/transport.c" + #include "../src/utils.c" +-#include "../src/shared/ffb.c" +-#include "../src/shared/log.c" +-#include "../src/shared/rt.c" + + static const a2dp_sbc_t config_sbc_44100_stereo = { + .frequency = SBC_SAMPLING_FREQ_44100, +diff --git a/test/test-utils.c b/test/test-utils.c +index b704b42..46475f1 100644 +--- a/test/test-utils.c ++++ b/test/test-utils.c +@@ -10,11 +10,11 @@ + + #include <check.h> + ++#include <bluealsa/defs.h> ++#include <bluealsa/ffb.h> ++#include <bluealsa/rt.h> ++ + #include "../src/utils.c" +-#include "../src/shared/defs.h" +-#include "../src/shared/ffb.c" +-#include "../src/shared/log.c" +-#include "../src/shared/rt.c" + + START_TEST(test_dbus_profile_object_path) { + +diff --git a/utils/Makefile.am b/utils/Makefile.am +index 256689a..a6d132c 100644 +--- a/utils/Makefile.am ++++ b/utils/Makefile.am +@@ -6,32 +6,31 @@ bin_PROGRAMS = + if ENABLE_APLAY + bin_PROGRAMS += bluealsa-aplay + bluealsa_aplay_SOURCES = \ +- ../src/shared/ctl-client.c \ +- ../src/shared/ffb.c \ +- ../src/shared/log.c \ + aplay.c + bluealsa_aplay_CFLAGS = \ + -I$(top_srcdir)/src \ ++ -I$(top_srcdir)/includes \ + @ALSA_CFLAGS@ \ + @BLUEZ_CFLAGS@ \ + @GIO2_CFLAGS@ + bluealsa_aplay_LDADD = \ + @ALSA_LIBS@ \ + @BLUEZ_LIBS@ \ +- @GIO2_LIBS@ ++ @GIO2_LIBS@ \ ++ ../src/bluealsalib/libbluealsa.la + endif + + if ENABLE_RFCOMM + bin_PROGRAMS += bluealsa-rfcomm + bluealsa_rfcomm_SOURCES = \ +- ../src/shared/ctl-client.c \ +- ../src/shared/log.c \ + rfcomm.c + bluealsa_rfcomm_CFLAGS = \ + -I$(top_srcdir)/src \ ++ -I$(top_srcdir)/includes \ + @BLUEZ_CFLAGS@ + bluealsa_rfcomm_LDADD = \ + @BLUEZ_LIBS@ \ ++ ../src/bluealsalib/libbluealsa.la \ + -lreadline + endif + +diff --git a/utils/aplay.c b/utils/aplay.c +index f792ce6..4b1372e 100644 +--- a/utils/aplay.c ++++ b/utils/aplay.c +@@ -25,10 +25,10 @@ + #include <alsa/asoundlib.h> + #include <gio/gio.h> + +-#include "shared/ctl-client.h" +-#include "shared/defs.h" +-#include "shared/ffb.h" +-#include "shared/log.h" ++#include <bluealsa/ctl-client.h> ++#include <bluealsa/defs.h> ++#include <bluealsa/ffb.h> ++#include <bluealsa/log.h> + + struct pcm_worker { + struct ba_msg_transport transport; +diff --git a/utils/rfcomm.c b/utils/rfcomm.c +index cc31f46..38e3b30 100644 +--- a/utils/rfcomm.c ++++ b/utils/rfcomm.c +@@ -24,8 +24,8 @@ + #include <readline/readline.h> + #include <readline/history.h> + +-#include "shared/ctl-client.h" +-#include "shared/log.h" ++#include <bluealsa/ctl-client.h> ++#include <bluealsa/log.h> + + static char *strtrim(char *str) { + while (isspace(*str)) +-- +2.16.4 + diff --git a/ATTIC/meta-audio-4a-framework/recipes-connectivity/bluez-alsa/bluez-alsa/0002-log-add-calling-function-name.patch b/ATTIC/meta-audio-4a-framework/recipes-connectivity/bluez-alsa/bluez-alsa/0002-log-add-calling-function-name.patch new file mode 100644 index 00000000..8ed7e0b6 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-connectivity/bluez-alsa/bluez-alsa/0002-log-add-calling-function-name.patch @@ -0,0 +1,26 @@ +From 3a7400da79678e749381306e33163ca2c005cb3b Mon Sep 17 00:00:00 2001 +From: Thierry Bultel <thierry.bultel@iot.bzh> +Date: Mon, 3 Dec 2018 14:31:31 +0100 +Subject: [PATCH 2/3] log: add calling function name + +Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh> +--- + includes/bluealsa/log.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/includes/bluealsa/log.h b/includes/bluealsa/log.h +index 39663fb..6d4cec3 100644 +--- a/includes/bluealsa/log.h ++++ b/includes/bluealsa/log.h +@@ -31,7 +31,7 @@ void info(const char *format, ...) __attribute__ ((format(printf, 1, 2))); + + #if DEBUG + void _debug(const char *format, ...) __attribute__ ((format(printf, 1, 2))); +-# define debug(M, ARGS ...) _debug("%s:%d: " M, __FILE__, __LINE__, ## ARGS) ++# define debug(M, ARGS ...) _debug("%s:%d:%s: " M, __FILE__, __LINE__,__func__, ## ARGS) + #else + # define debug(M, ARGS ...) do {} while (0) + #endif +-- +2.16.4 + diff --git a/ATTIC/meta-audio-4a-framework/recipes-connectivity/bluez-alsa/bluez-alsa/0003-dbus-request-a-name-on-startup.patch b/ATTIC/meta-audio-4a-framework/recipes-connectivity/bluez-alsa/bluez-alsa/0003-dbus-request-a-name-on-startup.patch new file mode 100644 index 00000000..1ef59296 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-connectivity/bluez-alsa/bluez-alsa/0003-dbus-request-a-name-on-startup.patch @@ -0,0 +1,153 @@ +From 4c14fffbd20a6dd9e6ceca1eb1726ceaafab7410 Mon Sep 17 00:00:00 2001 +From: Thierry Bultel <thierry.bultel@iot.bzh> +Date: Fri, 18 Jan 2019 11:45:29 +0100 +Subject: [PATCH 3/3] dbus: request a name on startup + +When the service thread is ready, ask a name to dbus +The advantage of doing that is that client applications +can check dbus for bluez-alsa presence, without having +to implement any kinf of polling logic. Also, this +way, they can be notified on the service exit, to +perform any needed cleanup. +Since there must be an instance of bluealsa daemon +per hci device, the dbus name will be +'org.bluez-alsa.hci0', 'org.bluez-alsa.hci1' ... +and so on. + +Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh> +--- + configure.ac | 10 ++++++++++ + src/Makefile.am | 3 +++ + src/bluez-alsa.conf | 14 ++++++++++++++ + src/main.c | 32 ++++++++++++++++++++++++++++++++ + 4 files changed, 59 insertions(+) + create mode 100644 src/bluez-alsa.conf + +diff --git a/configure.ac b/configure.ac +index 6323d60..d4ec7d4 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -130,6 +130,16 @@ AC_ARG_WITH([alsaconfdir], + [alsaconfdir="$sysconfdir/alsa/conf.d"], + [alsaconfdir="$datadir/alsa/alsa.conf.d"])]) + ++AC_ARG_WITH(dbusconfdir, AC_HELP_STRING([--with-dbusconfdir=PATH], ++ [path to D-Bus config directory]), [path_dbusconf=${withval}], ++ [path_dbusconf="`$PKG_CONFIG --variable=sysconfdir dbus-1`"]) ++if (test -z "${path_dbusconf}"); then ++ DBUS_CONFDIR="${sysconfdir}/dbus-1/system.d" ++else ++ DBUS_CONFDIR="${path_dbusconf}/dbus-1/system.d" ++fi ++AC_SUBST(DBUS_CONFDIR) ++ + test "x$prefix" = xNONE && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix=$prefix + +diff --git a/src/Makefile.am b/src/Makefile.am +index 5626ae5..c501f2e 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -23,6 +23,9 @@ bluealsa_SOURCES += \ + ofono-iface.c + endif + ++dbusconfdir = @DBUS_CONFDIR@ ++dist_dbusconf_DATA = bluez-alsa.conf ++ + AM_CFLAGS = \ + @BLUEZ_CFLAGS@ \ + @GLIB2_CFLAGS@ \ +diff --git a/src/bluez-alsa.conf b/src/bluez-alsa.conf +new file mode 100644 +index 0000000..6b999d6 +--- /dev/null ++++ b/src/bluez-alsa.conf +@@ -0,0 +1,14 @@ ++<!-- This configuration file specifies the required security policies ++ for bluez-alsa core daemon to work. --> ++ ++<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" ++ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> ++<busconfig> ++ ++ <!-- ../system.conf have denied everything, so we just punch some holes --> ++ ++ <policy user="root"> ++ <allow own_prefix="org.bluez-alsa"/> ++ </policy> ++ ++</busconfig> +diff --git a/src/main.c b/src/main.c +index 9cef402..9183978 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -12,6 +12,7 @@ + # include "config.h" + #endif + ++#define _GNU_SOURCE + #include <errno.h> + #include <getopt.h> + #include <signal.h> +@@ -58,6 +59,20 @@ static char *get_a2dp_codecs( + return g_strjoinv(", ", (char **)tmp); + } + ++static void name_acquired_handler( ++ GDBusConnection *connection, ++ const gchar *name, ++ gpointer user_data) { ++ debug("Acquired name: %s", name); ++} ++ ++static void name_lost_handler( ++ GDBusConnection *connection, ++ const gchar *name, ++ gpointer user_data) { ++ debug("Lost name: %s", name); ++} ++ + static GMainLoop *loop = NULL; + static void main_loop_stop(int sig) { + /* Call to this handler restores the default action, so on the +@@ -318,6 +333,7 @@ int main(int argc, char **argv) { + GError *err; + + err = NULL; ++ + address = g_dbus_address_get_for_bus_sync(G_BUS_TYPE_SYSTEM, NULL, NULL); + if ((config.dbus = g_dbus_connection_new_for_address_sync(address, + G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT | +@@ -336,6 +352,19 @@ int main(int argc, char **argv) { + ofono_register(); + #endif + ++ char * name_on_bus = NULL; ++ asprintf(&name_on_bus, "org.bluez-alsa.%s", config.hci_dev.name); ++ ++ guint g_dbusid; ++ g_dbusid = g_bus_own_name_on_connection(config.dbus, ++ name_on_bus, ++ G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | ++ G_BUS_NAME_OWNER_FLAGS_REPLACE, ++ name_acquired_handler, ++ name_lost_handler, ++ NULL, ++ NULL); ++ + /* In order to receive EPIPE while writing to the pipe whose reading end + * is closed, the SIGPIPE signal has to be handled. For more information + * see the io_thread_write_pcm() function. */ +@@ -359,5 +388,8 @@ int main(int argc, char **argv) { + bluealsa_ctl_free(); + bluealsa_config_free(); + ++ g_bus_unown_name (g_dbusid); ++ free(name_on_bus); ++ + return EXIT_SUCCESS; + } +-- +2.16.4 + diff --git a/ATTIC/meta-audio-4a-framework/recipes-connectivity/bluez-alsa/bluez-alsa/0004-bluealsa-pcm-bump-the-trigger-after-pcm-prepare.patch b/ATTIC/meta-audio-4a-framework/recipes-connectivity/bluez-alsa/bluez-alsa/0004-bluealsa-pcm-bump-the-trigger-after-pcm-prepare.patch new file mode 100644 index 00000000..7befe733 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-connectivity/bluez-alsa/bluez-alsa/0004-bluealsa-pcm-bump-the-trigger-after-pcm-prepare.patch @@ -0,0 +1,35 @@ +From ba292e82928a6a0ea663039ba2d5c030c4cfa80d Mon Sep 17 00:00:00 2001 +From: Thierry Bultel <thierry.bultel@iot.bzh> +Date: Fri, 8 Feb 2019 10:21:55 +0100 +Subject: [PATCH] bluealsa-pcm: bump the trigger after pcm prepare + +When a sound application recovers from a EPIPE by calling +snd_pcm_prepare, and goes immediately after to a call to poll, +it would be stuck forever unless the internal event trigger +is bumped. + +Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh> +--- + src/asound/bluealsa-pcm.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/asound/bluealsa-pcm.c b/src/asound/bluealsa-pcm.c +index 42cb61d..4ccbf0d 100644 +--- a/src/asound/bluealsa-pcm.c ++++ b/src/asound/bluealsa-pcm.c +@@ -351,6 +351,12 @@ static int bluealsa_prepare(snd_pcm_ioplug_t *io) { + pcm->io_ptr = 0; + + debug("Prepared: %d", pcm->fd); ++ ++ /* When the sound application calls poll just after snd_pcm_prepare, ++ * it would block forever unless the internal trigger is bumped ++ * */ ++ eventfd_write(pcm->event_fd, 1); ++ + return 0; + } + +-- +2.16.4 + diff --git a/ATTIC/meta-audio-4a-framework/recipes-connectivity/bluez-alsa/bluez-alsa_git.bbappend b/ATTIC/meta-audio-4a-framework/recipes-connectivity/bluez-alsa/bluez-alsa_git.bbappend new file mode 100644 index 00000000..ece43824 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-connectivity/bluez-alsa/bluez-alsa_git.bbappend @@ -0,0 +1,19 @@ +# This brings some mandatory patches for the softmixer and hal-manager. +# +# - patch 1 makes a communication library for hal-manager to get +# the list of audio transports from bluez-alsa +# - patch 2 makes the "debug" macro always display the caller name +# - patch 3 asks dbus for a name like 'org.bluez-alsa.hciX' where hciX +# - patch 4 is a bug fix +# name of the HCI interface that the bluealsa daemon instance is handling +# +# Notice that patch 2 will very likely be replaced by a full dbus interface +# in the future. +# + +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +SRC_URI += "file://0001-build-and-link-with-a-shared-library.patch" +SRC_URI += "file://0002-log-add-calling-function-name.patch" +SRC_URI += "file://0003-dbus-request-a-name-on-startup.patch" +SRC_URI += "file://0004-bluealsa-pcm-bump-the-trigger-after-pcm-prepare.patch" diff --git a/ATTIC/meta-audio-4a-framework/recipes-core/packagegroups/packagegroup-agl-audio.bb b/ATTIC/meta-audio-4a-framework/recipes-core/packagegroups/packagegroup-agl-audio.bb new file mode 100644 index 00000000..bc236ff6 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-core/packagegroups/packagegroup-agl-audio.bb @@ -0,0 +1,24 @@ +SUMMARY = "AGL Audio packages" +DESCRIPTION = "The set of packages required by the AGL Audio" +LICENSE = "MIT" + +inherit packagegroup + +PACKAGES = "\ + packagegroup-agl-audio \ + " + +RDEPENDS_${PN} += "\ + 4a-alsa-core \ + agl-service-audio-4a \ + VIRTUAL-RUNTIME_alsa-state \ + agl-service-unicens \ + bluez-alsa \ + 4a-softmixer \ + 4a-hal-generic \ + 4a-hal-unicens \ + snd-avirt \ + ${@bb.utils.contains('DISTRO_FEATURES', 'agl-devel', '4a-tools', '' , d)} \ +" +# FIXME: Disable for now due to compilation issues against PulseAudio 12.x +# ${@bb.utils.contains('DISTRO_FEATURES', 'pulseaudio', 'pulseaudio-module-4a-client', '' , d)} diff --git a/ATTIC/meta-audio-4a-framework/recipes-kernel/snd-avirt/files/0001-snd-avirt-backport-kernel-4.12-api.patch b/ATTIC/meta-audio-4a-framework/recipes-kernel/snd-avirt/files/0001-snd-avirt-backport-kernel-4.12-api.patch new file mode 100644 index 00000000..fa737cb4 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-kernel/snd-avirt/files/0001-snd-avirt-backport-kernel-4.12-api.patch @@ -0,0 +1,40 @@ +From 2fc07fedd17650f64f9bfcdb8682b55dad75cccd Mon Sep 17 00:00:00 2001 +From: Mark Farrugia <mark.farrugia@fiberdyne.com.au> +Date: Mon, 8 Apr 2019 16:38:13 +1000 +Subject: [PATCH] 0001-snd-avirt-backport-kernel-4.12-api + +--- + core.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/core.c b/core.c +index c2e32c5..2bb6616 100644 +--- a/core.c ++++ b/core.c +@@ -219,9 +219,8 @@ int snd_avirt_stream_try_complete(struct snd_avirt_stream *stream) + /* Set PCM ops for the Audio Path*/ + PCM_OPS_SET(pcm_ops_ap, &stream->pcm_ops, pointer); + PCM_OPS_SET(pcm_ops_ap, &stream->pcm_ops, get_time_info); +- PCM_OPS_SET(pcm_ops_ap, &stream->pcm_ops, fill_silence); +- PCM_OPS_SET(pcm_ops_ap, &stream->pcm_ops, copy_user); +- PCM_OPS_SET(pcm_ops_ap, &stream->pcm_ops, copy_kernel); ++ PCM_OPS_SET(pcm_ops_ap, &stream->pcm_ops, silence); ++ PCM_OPS_SET(pcm_ops_ap, &stream->pcm_ops, copy); + PCM_OPS_SET(pcm_ops_ap, &stream->pcm_ops, mmap); + PCM_OPS_SET(pcm_ops_ap, &stream->pcm_ops, ack); + +@@ -331,9 +330,9 @@ snd_avirt_route_endpoint_copy(struct snd_pcm_substream *substream, + + switch (endpoint) { + case SND_AVIRT_ROUTE_SOURCE: +- return endpoint_ap->pcm_capture_ops->copy_kernel; ++ return endpoint_ap->pcm_capture_ops->copy; + case SND_AVIRT_ROUTE_SINK: +- return endpoint_ap->pcm_playback_ops->copy_kernel; ++ return endpoint_ap->pcm_playback_ops->copy; + } + + return NULL; +-- +2.17.1 + diff --git a/ATTIC/meta-audio-4a-framework/recipes-kernel/snd-avirt/files/0002-snd-avirt-backport-kernel-4.9-api.patch b/ATTIC/meta-audio-4a-framework/recipes-kernel/snd-avirt/files/0002-snd-avirt-backport-kernel-4.9-api.patch new file mode 100644 index 00000000..fa944da0 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-kernel/snd-avirt/files/0002-snd-avirt-backport-kernel-4.9-api.patch @@ -0,0 +1,63 @@ +From fe7fc04e4f685c72b4f971ca0e23b10d683cffe0 Mon Sep 17 00:00:00 2001 +From: Mark Farrugia <mark.farrugia@fiberdyne.com.au> +Date: Fri, 16 Nov 2018 16:10:12 +1100 +Subject: [PATCH] snd-avirt-backport-kernel-4.9-api + +--- + dummy/dummy.c | 6 +++--- + loopback/loopback.c | 6 +++--- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/dummy/dummy.c b/dummy/dummy.c +index f683b92..c37be09 100644 +--- a/dummy/dummy.c ++++ b/dummy/dummy.c +@@ -125,9 +125,9 @@ static int dummy_systimer_prepare(struct snd_pcm_substream *substream) + return 0; + } + +-static void dummy_systimer_callback(struct timer_list *t) ++static void dummy_systimer_callback(unsigned long data) + { +- struct dummy_systimer_pcm *dpcm = from_timer(dpcm, t, timer); ++ struct dummy_systimer_pcm *dpcm = (struct dummy_systimer_pcm *)data; + unsigned long flags; + int elapsed = 0; + +@@ -162,7 +162,7 @@ static int dummy_systimer_create(struct snd_pcm_substream *substream) + if (!dpcm) + return -ENOMEM; + substream->runtime->private_data = dpcm; +- timer_setup(&dpcm->timer, dummy_systimer_callback, 0); ++ setup_timer(&dpcm->timer, dummy_systimer_callback, (unsigned long)dpcm); + spin_lock_init(&dpcm->lock); + dpcm->substream = substream; + return 0; +diff --git a/loopback/loopback.c b/loopback/loopback.c +index 4181392..6667a69 100644 +--- a/loopback/loopback.c ++++ b/loopback/loopback.c +@@ -498,9 +498,9 @@ unlock: + return running; + } + +-static void loopback_timer_function(struct timer_list *t) ++static void loopback_timer_function(unsigned long data) + { +- struct loopback_pcm *dpcm = from_timer(dpcm, t, timer); ++ struct loopback_pcm *dpcm = (struct loopback_pcm *)data; + unsigned long flags; + + spin_lock_irqsave(&dpcm->cable->lock, flags); +@@ -652,7 +652,7 @@ static int loopback_open(struct snd_pcm_substream *substream) + } + dpcm->loopback = loopback; + dpcm->substream = substream; +- timer_setup(&dpcm->timer, loopback_timer_function, 0); ++ setup_timer(&dpcm->timer, loopback_timer_function, (unsigned long)dpcm); + + cable = loopback->cables[substream->pcm->device]; + if (!cable) { +-- +2.17.1 + diff --git a/ATTIC/meta-audio-4a-framework/recipes-kernel/snd-avirt/snd-avirt.bb b/ATTIC/meta-audio-4a-framework/recipes-kernel/snd-avirt/snd-avirt.bb new file mode 100644 index 00000000..006f9c51 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-kernel/snd-avirt/snd-avirt.bb @@ -0,0 +1,14 @@ +DESCRIPTION = "Build SND_AVIRT driver" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" + +inherit module + +PV = "0.1" + +SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/avirt;protocol=https;branch=${AGL_BRANCH}" + +S = "${WORKDIR}/git" +SRCREV = "12c6dc3159cc14cb3456d6d504398ba779538fb3" + +KERNEL_MODULE_AUTOLOAD += "snd-avirt-core snd-avirt-ap-loopback" diff --git a/ATTIC/meta-audio-4a-framework/recipes-kernel/snd-avirt/snd-avirt.bbappend b/ATTIC/meta-audio-4a-framework/recipes-kernel/snd-avirt/snd-avirt.bbappend new file mode 100644 index 00000000..3c9fea0e --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-kernel/snd-avirt/snd-avirt.bbappend @@ -0,0 +1,22 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +def prep_version (d) : + KV = d.getVar('KERNEL_VERSION', True) + if not KV : + return "4.12" + else: + return KV + +ORIG_KERN_VER = "${@prep_version(d)}" + +VANILLA_KERNEL_VERSION = "${@str(ORIG_KERN_VER.split("-")[0].split(".")[0]+ORIG_KERN_VER.split("-")[0].split(".")[1])}" + +APPLY_0001 = "${@str('no' if ${VANILLA_KERNEL_VERSION} > 412 else 'yes')}" +APPLY_0002 = "${@str('no' if ${VANILLA_KERNEL_VERSION} > 49 else 'yes')}" + +SRC_URI_append = " \ + file://0001-snd-avirt-backport-kernel-4.12-api.patch;apply=${APPLY_0001} \ + file://0002-snd-avirt-backport-kernel-4.9-api.patch;apply=${APPLY_0002} \ + " +# Make sure we can expose KERNEL_VERSION ... +do_patch[depends] += "virtual/kernel:do_populate_sysroot" diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-alsa-core/4a-alsa-core_git.bb b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-alsa-core/4a-alsa-core_git.bb new file mode 100644 index 00000000..b94eff21 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-alsa-core/4a-alsa-core_git.bb @@ -0,0 +1,25 @@ +SUMMARY = "4A - Low Level Alsa Binding" +DESCRIPTION = "Low Level Alsa Binding for 4A (AGL Advanced Audio Agent)" +HOMEPAGE = "https://git.automotivelinux.org/src/4a-alsa-core/" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +SRC_URI = "gitsm://gerrit.automotivelinux.org/gerrit/src/4a-alsa-core;protocol=https;branch=${AGL_BRANCH}" +SRCREV = "9b71be04ea600189e390bb111624ad5c2d248a4c" + +DEPENDS += "libafb-helpers" + +PV = "0.1+git${SRCPV}" +S = "${WORKDIR}/git" + +inherit afb-system-cmake + +# FIXME: Remove once CMake+ninja issues are resolved +OECMAKE_GENERATOR = "Unix Makefiles" + +FILES_${PN}-dev += "${INSTALL_PREFIX}/4a-alsa-core/htdocs" + +FILES_${PN} += "${INSTALL_PREFIX}/4a-alsa-core" +FILES_${PN} += "${INSTALL_PREFIX}/lib" diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/4a-hal-config.bb b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/4a-hal-config.bb new file mode 100644 index 00000000..fc648a1d --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/4a-hal-config.bb @@ -0,0 +1,24 @@ +SUMMARY = "4A - HAL Configuration" +DESCRIPTION = "Configuration files for HALs used in 4A (AGL Advanced Audio Agent)" +HOMEPAGE = "https://git.automotivelinux.org/src/4a-hal-reference/" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +SRC_URI = "file://asound.conf.template \ + " + +PV = "0.1" + +RPROVIDES_${PN} += "VIRTUAL-RUNTIME_alsa-state" + +inherit afb-system + +do_install () { + install -d ${D}/${sysconfdir} + install -m 0755 ${WORKDIR}/asound.conf.template ${D}/${sysconfdir}/asound.conf + sed -i "s|@INSTALL_PREFIX@|${INSTALL_PREFIX}|g" ${D}/${sysconfdir}/asound.conf +} + +FILES_${PN} += "${sysconfdir}/asound.conf" diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/asound.conf.template b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/asound.conf.template new file mode 100644 index 00000000..5a265db0 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/asound.conf.template @@ -0,0 +1,3 @@ +# +#4A pcm configuration is now dynamic, please check hal configuration files in @INSTALL_PREFIX@/4a-hal/etc +# diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config-alternatives.README b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config-alternatives.README new file mode 100644 index 00000000..689f9bf8 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config-alternatives.README @@ -0,0 +1,3 @@ +This is a sample on how the update-alternative system can be used to select +the highest priority hal given. +Downside ... always only one file is possible in the etc folder. No HAL_LIST. diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config-alternatives.bbexample b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config-alternatives.bbexample new file mode 100644 index 00000000..3bafc3bb --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config-alternatives.bbexample @@ -0,0 +1,57 @@ +SUMMARY = "4A - Generic HAL device configuration" +DESCRIPTION = "Generic HAL device configuration in 4A (AGL Advanced Audio Agent)" +HOMEPAGE = "https://git.automotivelinux.org/src/4a-hal-configs/" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" + +SRC_URI = "gitsm://gerrit.automotivelinux.org/gerrit/src/4a-hal-configs;protocol=https;branch=${AGL_BRANCH}" +SRCREV = "45f205076573a858348c10a52d31382f31deaf55" + +PV = "0.1+git${SRCPV}" +S = "${WORKDIR}/git" + +# The package is machine-specific due to variable config content +PACKAGE_ARCH = "${MACHINE_ARCH}" + +inherit afb-system update-alternative +# This defines INSTALL_PREFIX = "/usr/libexec/agl/" + +# no configure needed +do_configure[noexec] = "1" +# no compile needed +do_compile[noexec] = "1" + + +# when no specific HAL is defined, use a generic usb one +4A_DEFAULT_HAL ??= "2ch-generic-usb" + +# for specific machines, activate only known HAL +4A_DEFAULT_HAL_m3ulcb ?= "rcar-m3" +# Downside: only one file at a time! +4A_DEFAULT_HAL_h3ulcb ?= "rcar-m3" +4A_DEFAULT_HAL_intel-corei7-64 ?= "intel-minnow" +4A_DEFAULT_HAL_qemux86-64 ?= "intel-qemu" + +# Due to bug SPEC-1610, default hal for RPI3 is not active yet +# 4A_DEFAULT_HAL_raspberrypi3 ?= "raspberry-pi-3" + +do_install () { + # get pkgdir for 4a-hal + PKGDIR=${D}/${INSTALL_PREFIX}/4a-hal + + install -d -m 0755 ${PKGDIR}/etc.available + cp -ar ${S}/*/*.json ${PKGDIR}/etc.available/ + chown -R root:root ${PKGDIR}/ +} + +# we define a '4a-default-hal' alternative with a low default priority +# you can deploy your own hal with a higher prio +ALTERNATIVE_${PN} = "4a-default-hal" +ALTERNATIVE_PRIORITY = "10" +ALTERNATIVE_LINK_NAME[4a-default-hal] = "${INSTALL_PREFIX}/4a-hal/etc/4a-default-hal.json" +ALTERNATIVE_TARGET[4a-default-hal] = "${INSTALL_PREFIX}/4a-hal/etc.available/hal-4a-${4A_DEFAULT_HAL}.json" + + +RPROVIDES_${PN} += "virtual/4a-default-hal"
\ No newline at end of file diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config.README b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config.README new file mode 100644 index 00000000..602486a4 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config.README @@ -0,0 +1,4 @@ +To keep it simple. + +Just expose 4A_HAL_LIST as-is to conf/local.conf so the user can actually choose any json file. + diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config.bb b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config.bb new file mode 100644 index 00000000..e504c3da --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-device-config.bb @@ -0,0 +1,58 @@ +SUMMARY = "4A - Generic HAL device configuration" +DESCRIPTION = "Generic HAL device configuration in 4A (AGL Advanced Audio Agent)" +HOMEPAGE = "https://git.automotivelinux.org/src/4a-hal-configs/" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" + +SRC_URI = "gitsm://gerrit.automotivelinux.org/gerrit/src/4a-hal-configs;protocol=https;branch=${AGL_BRANCH}" +SRCREV = "fdf0e3c4c67ceb5ddc77c9c1f27d85c1be2055a6" + +PV = "0.1+git${SRCPV}" +S = "${WORKDIR}/git" + +# The package is machine-specific due to variable config content +PACKAGE_ARCH = "${MACHINE_ARCH}" + +inherit afb-system +# This defines INSTALL_PREFIX = "/usr/libexec/agl/" + +# no configure needed +do_configure[noexec] = "1" + +# no compile needed +do_compile[noexec] = "1" + +# when no specific HAL is defined, use a generic usb one +4A_HAL_LIST ??= "2ch-generic-usb" + +# for specific machines, activate only known HALs +4A_HAL_LIST_m3ulcb ?= "rcar-m3 rcar-m3kf" +4A_HAL_LIST_h3ulcb ?= "rcar-m3 rcar-m3kf" +4A_HAL_LIST_intel-corei7-64 ?= "intel-minnow intel-upsquared-hdmi" +4A_HAL_LIST_qemux86-64 ?= "intel-qemu" + +# Due to bug SPEC-1610, default hal for RPI3 is not active yet +# 4A_HAL_LIST_raspberrypi3 ?= "raspberry-pi-3" + +do_install () { + + # get pkgdir for 4a-hal + PKGDIR=${D}/${INSTALL_PREFIX}/4a-hal + + install -d -m 0755 ${PKGDIR} + install -d -m 0755 ${PKGDIR}/etc + install -d -m 0755 ${PKGDIR}/etc.available + + cp -ar ${S}/*/*.json ${PKGDIR}/etc.available/ + chown -R root:root ${PKGDIR}/etc.available + + for x in ${4A_HAL_LIST}; do + hal=hal-4a-$x.json + cp -v $PKGDIR/etc.available/${hal} $PKGDIR/etc/ + done +} + + +RPROVIDES_${PN} += "virtual/4a-default-hal" diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-vendor-config.README b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-vendor-config.README new file mode 100644 index 00000000..29531ccd --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-vendor-config.README @@ -0,0 +1,3 @@ +This is a sample how a vendor can: +- inject his own hal (as file hal-4a-myhal.json) +- set PREFERRED_RPROVIDER_virtual/4a-default-hal = "4a-hal-vendor-config" on conf/local.conf diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-vendor-config.bbexample b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-vendor-config.bbexample new file mode 100644 index 00000000..105ab1fa --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/4a-hal-vendor-config.bbexample @@ -0,0 +1,46 @@ +SUMMARY = "4A - Vendor HAL device configuration" +DESCRIPTION = "Vendor HAL device configuration in 4A (AGL Advanced Audio Agent)" +HOMEPAGE = "https://example.com/" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" + +SRC_URI = "file://hal-4a-myhal.json" + +PV = "0.1" +S = "${WORKDIR}/" + +# The package is machine-specific due to variable config content +PACKAGE_ARCH = "${MACHINE_ARCH}" + +inherit afb-system +# This defines INSTALL_PREFIX = "/usr/libexec/agl/" + +# no configure needed +do_configure[noexec] = "1" + +# no compile needed +do_compile[noexec] = "1" + +# use our local hal +4A_HAL_LIST = "myhal" + +do_install () { + + # get pkgdir for 4a-hal + PKGDIR=${D}/${INSTALL_PREFIX}/4a-hal + + install -d -m 0755 ${PKGDIR}/etc.available + + cp -ar ${S}/*.json ${PKGDIR}/etc.available/ + chown -R root:root ${PKGDIR}/etc.available + + for x in ${4A_HAL_LIST}; do + hal=hal-4a-$x.json + cp -v $PKGDIR/etc.available/${hal} $PKGDIR/etc/ + done +} + + +RPROVIDES_${PN} += "virtual/4a-default-hal"
\ No newline at end of file diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/files/deploy-hal-udev.sh b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/files/deploy-hal-udev.sh new file mode 100755 index 00000000..f031d58b --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/files/deploy-hal-udev.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +rm /usr/libexec/agl/4a-hal/etc/* +cp /usr/libexec/agl/4a-hal/etc.available/$i /usr/libexec/agl/4a-hal/etc/ diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/files/udev-sample-rule.rules b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/files/udev-sample-rule.rules new file mode 100644 index 00000000..d2d16a17 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-device-config/files/udev-sample-rule.rules @@ -0,0 +1 @@ +ACTION=="add", SUBSYSTEM=="usb", SOMEOTHERMATCH="bar", RUN+="/usr/bin/deploy-hal-udev.sh hal-4a-greenbox.json" diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-generic/4a-hal-generic_git.bb b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-generic/4a-hal-generic_git.bb new file mode 100644 index 00000000..8b20b83d --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-generic/4a-hal-generic_git.bb @@ -0,0 +1,30 @@ +SUMMARY = "4A - Generic HAL" +DESCRIPTION = "Generic HAL in 4A (AGL Advanced Audio Agent)" +HOMEPAGE = "https://git.automotivelinux.org/src/4a-hal-generic/" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" + +SRC_URI = "gitsm://gerrit.automotivelinux.org/gerrit/src/4a-hal-generic;protocol=https;branch=${AGL_BRANCH}" +SRCREV = "0c4921b83a13bcb96bf03fb0e7a0733c3e202474" + +DEPENDS += "lua bluez-alsa liburcu libafb-helpers libappcontroller" + +PV = "0.1+git${SRCPV}" +S = "${WORKDIR}/git" + +inherit afb-system-cmake + +# FIXME: Remove once CMake+ninja issues are resolved +OECMAKE_GENERATOR = "Unix Makefiles" + +do_install_append () { + # get pkgdir - note that '4a-hal' comes from project ${project_git_repo}/conf.d/cmake/config.cmake + PKGDIR=${D}/${INSTALL_PREFIX}/4a-hal + + # transition: provided by separate package + rm -rf $PKGDIR/etc +} + +RDEPENDS_${PN} += "virtual/4a-default-hal bluez-alsa" diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-unicens/4a-hal-unicens_git.bb b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-unicens/4a-hal-unicens_git.bb new file mode 100644 index 00000000..058d20bb --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-hal-unicens/4a-hal-unicens_git.bb @@ -0,0 +1,32 @@ +SUMMARY = "4A - Unicens (MOST) Binding" +DESCRIPTION = "Unicens binding (MOST audio network support) for 4A (AGL Advanced Audio Agent)" +HOMEPAGE = "https://git.automotivelinux.org/src/4a-hal-unicens/" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=e385f6075dcdf3ad6ff0056fca58a129" + +DEPENDS += "lua libafb-helpers libappcontroller" + +SRC_URI = "gitsm://gerrit.automotivelinux.org/gerrit/src/4a-hal-unicens;protocol=https;branch=${AGL_BRANCH}" +SRCREV = "9228c9da5b85f0fdd6b01f0309e57b846618be63" + + +PV = "0.1+git${SRCPV}" +S = "${WORKDIR}/git" + +inherit afb-system-cmake + +# FIXME: Remove once CMake+ninja issues are resolved +OECMAKE_GENERATOR = "Unix Makefiles" + +do_install_append () { + # installation folder for this plugin is '4a-hal' + # get pkgdir - note that '4a-hal' comes from project ${project_git_repo}/conf.d/cmake/config.cmake + PKGDIR=${D}/${INSTALL_PREFIX}/4a-hal + + # transition: provided by separate package + rm -rf $PKGDIR/etc +} + + diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-softmixer/4a-softmixer_git.bb b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-softmixer/4a-softmixer_git.bb new file mode 100644 index 00000000..908809b6 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-softmixer/4a-softmixer_git.bb @@ -0,0 +1,25 @@ +SUMMARY = "4A - Softmixer" +DESCRIPTION = "4A Softmixer (AGL Advanced Audio Agent)" +HOMEPAGE = "https://git.automotivelinux.org/src/4a-softmixer/" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" + +SRC_URI = "gitsm://gerrit.automotivelinux.org/gerrit/src/4a-softmixer.git;protocol=https;branch=${AGL_BRANCH}" +SRCREV = "1a75612274f883aed09d198575582abdc0c9fe0f" + +DEPENDS += "lua liburcu libafb-helpers libappcontroller libavirt" + +PV = "0.1+git${SRCPV}" +S = "${WORKDIR}/git" + +inherit afb-system-cmake + +# FIXME: Remove once CMake+ninja issues are resolved +OECMAKE_GENERATOR = "Unix Makefiles" + +#FIXME : +#FILES_${PN}-dev += "${INSTALL_PREFIX}/4a-softmixer/htdocs" +#FILES_${PN} += "${INSTALL_PREFIX}/afb-aaaa" +#FILES_${PN} += "${INSTALL_PREFIX}/lib" diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-tools/4a-tools_git.bb b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-tools/4a-tools_git.bb new file mode 100644 index 00000000..ae1117ad --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/4a-tools/4a-tools_git.bb @@ -0,0 +1,22 @@ +SUMMARY = "4A - Tools" +DESCRIPTION = "Tools, utilities, scripts and data related to 4A" +HOMEPAGE = "https://github.com/iotbzh/4a-tools/" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" + +SRC_URI = "gitsm://github.com/iotbzh/4a-tools;protocol=https;branch=${AGL_BRANCH}" +SRCREV = "flounder_5.99.2" +#SRCREV = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + +PV = "0.1+git${SRCPV}" +S = "${WORKDIR}/git" + + +do_install() { + oe_runmake install DESTDIR=${D}${prefix} +} + +RDEPENDS_${PN} += "bash python3-websockets" +FILES_${PN} += "${datadir}/4a/media/*" diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/agl-service-audio-4a/agl-service-audio-4a_git.bb b/ATTIC/meta-audio-4a-framework/recipes-multimedia/agl-service-audio-4a/agl-service-audio-4a_git.bb new file mode 100644 index 00000000..014fe119 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/agl-service-audio-4a/agl-service-audio-4a_git.bb @@ -0,0 +1,58 @@ +SUMMARY = "4A - High Level Audio API Service" +DESCRIPTION = "High Level Audio API service used in 4A (AGL Advanced Audio Agent)" +HOMEPAGE = "https://git.automotivelinux.org/apps/agl-service-audio-4a/" +SECTION = "apps" + +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +SRC_URI = "git://gerrit.automotivelinux.org/gerrit/apps/agl-service-audio-4a;protocol=https;branch=${AGL_BRANCH}" +SRCREV = "${AGL_APP_REVISION}" + +PV = "0.1+git${SRCPV}" +S = "${WORKDIR}/git" + +inherit cmake aglwgt pkgconfig + +DEPENDS += "alsa-lib json-c systemd af-binder glib-2.0 lua libappcontroller" + +do_aglwgt_deploy_append() { + cat <<'EOF' >${D}/${sysconfdir}/agl-postinsts/99_4A_service_patch.sh +N=600 +svcfile="/usr/local/lib/systemd/*/afm-service-agl-service-audio-4a*.service" +set -x +echo "-- TMP 4A INSTALL FIX from meta-agl/meta-app-framework/recipes-multimedia/agl-service-audio-4a/agl-service-audio-4a_git.bb - MUST BE REMOVED !!!" +while ! ls $svcfile > /dev/null; do + if [ $N = 0 ]; then echo "-- TMP 4A INSTALL NOT FIXED"; exit 0; fi + echo . + sleep 0.2 + N=$(expr $N - 1) +done +sed -i '/\[Unit\]/ a Before=pulseaudio.service' $svcfile; +sed -i '/\[Unit\]/ a ConditionPathExistsGlob=/dev/snd/control*' $svcfile; +sed -i '/ExecStartPre=/ a Environment=LIBASOUND_THREAD_SAFE=0' $svcfile; + +sed -i -e 's|/usr/bin/afb-daemon\>|& --ldpath=/usr/libexec/agl/4a-alsa-core/lib:/usr/libexec/agl/4a-hal/lib:/usr/libexec/agl/smixer/lib|' $svcfile + +# binder name matters: it must match "afbd-4a-*" => the config file (controller json file) that will be searched will be "policy-4a-*.json" +sed -i -e 's|--name afbd-agl-\(.*\)|--name afbd-4a-\1|' $svcfile + +# workaround for SPEC-1762 +sed -i -e 's|/usr/bin/afb-daemon\>|/usr/bin/4a_wait_bt.sh &|' $svcfile + +echo "-- TMP 4A INSTALL FIX END" + +EOF + chmod a+x ${D}/${sysconfdir}/agl-postinsts/99_4A_service_patch.sh +} + +############################################## +# workaround for SPEC-1762/SPEC-1763 +RDEPENDS_${PN} += "bash" +SRC_URI += "file://4a_wait_bt.sh" +do_install_append() { + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/4a_wait_bt.sh ${D}${bindir}/ +} +# +############################################## diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/agl-service-audio-4a/files/4a_wait_bt.sh b/ATTIC/meta-audio-4a-framework/recipes-multimedia/agl-service-audio-4a/files/4a_wait_bt.sh new file mode 100755 index 00000000..9dec4350 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/agl-service-audio-4a/files/4a_wait_bt.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +############################################################### +# This is a workaround for SPEC-1762/SPEC-1763 +# +# THIS SCRIPT MUST BE REMOVED ONCE THE ABOVE ISSUES ARE SOLVED +# +# Source recipe is: +# +# meta-audio-4a-framework/ +# recipes-multimedia/ +# agl-service-audio-4a/ +# agl-service-audio-4a_git.bb +# +# Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh> +############################################################### + +# time from script startup +LIMIT=20 +ts0=0 +function ts() { echo $(( $(date +%s) - ts0 )); } +ts0=$(ts) +function havetime() { [[ $(ts) -le ${1:-$LIMIT} ]] || return 1; } + +function waitloop() { + # ensure bt modules are loaded (delay: 5s) + while havetime 4; do + [[ -d /sys/module/bluetooth ]] && { + echo "bluetooth kernel module detected" + break + } + echo "waiting for bluetooth kernel module to be up" + sleep 0.2 + done + havetime 4 || { echo "TIMEOUT REACHED"; return 1; } + + # check that we have at least one controller + HCIDEV= + while havetime 8; do + echo "detecting hci devices..." + for x in $(ls /sys/class/bluetooth/hci* 2>/dev/null); do + [[ -z "$HCIDEV" ]] && HCIDEV=$(basename $x) + done + [[ -n "$HCIDEV" ]] && { + echo "found HCI controller: $HCIDEV" + break + } + sleep 0.2 + done + havetime 8 || { echo "TIMEOUT REACHED"; return 1; } + + # wait for controller to be up and running + while havetime 15; do + state=$(hciconfig $HCIDEV | grep -A 2 ^hci0 | tail -1) + [[ $state =~ UP ]] && [[ $state =~ RUNNING ]] && { + echo "HCI controller $HCIDEV state: $state" + break + } + echo "HCI controller $HCIDEV state: $state ... waiting for UP RUNNING" + sleep 0.2 + done + havetime 15 || { echo "TIMEOUT REACHED"; return 1; } + echo "HCI device up and running after $(ts) seconds" + + # wait for bluetooth-service to return something + while havetime; do + res=$(afb-client-demo -d unix:/run/user/$UID/apis/ws/Bluetooth-Manager adapter_state true) + [[ "$res" =~ \"response\":(.*)}$ ]] && res=${BASH_REMATCH[1]} + [[ "$res" =~ \"powered\":true ]] && { + echo "Bluetooth-Manager/power: $res" + break + } + echo "Bluetooth-Manager/power: not ready yet ($res)" + sleep 0.2 + done + echo "Bluetooth-Manager ready after $(ts) seconds" + + echo "4A now starting..." +} + +waitloop 2>&1 | sed 's/^/4AWAITBT /' >&2 +exec "$@" + diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/alsa/alsa-plugins_%.bbappend b/ATTIC/meta-audio-4a-framework/recipes-multimedia/alsa/alsa-plugins_%.bbappend new file mode 100644 index 00000000..5109a314 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/alsa/alsa-plugins_%.bbappend @@ -0,0 +1,7 @@ +# Remove PulseAudio plugin configuration files + +do_install_append() { + rm -f ${D}${datadir}/alsa/alsa.conf.d/*pulseaudio* +} + +FILES_${PN}-pulseaudio-conf = "${datadir}/alsa/alsa.conf.d" diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/libavirt/libavirt_git.bb b/ATTIC/meta-audio-4a-framework/recipes-multimedia/libavirt/libavirt_git.bb new file mode 100644 index 00000000..6d224e4e --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/libavirt/libavirt_git.bb @@ -0,0 +1,19 @@ +SUMMARY = "AVIRT user-space library" +DESCRIPTION = "ALSA Virtual Dynamic Sound Driver (AVIRT) user-space library for dynamic sound stream creation." +HOMEPAGE = "https://git.automotivelinux.org/src/libavirt/" +SECTION = "libs/multimedia" + +LICENSE = "GPL-2.0" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" + +SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/libavirt;protocol=https;branch=${AGL_BRANCH}" +SRCREV = "379ea3c132f53eb6f5cf26d1c8a5ca335eb32a2e" + +PV = "0.1+git${SRCPV}" +S = "${WORKDIR}/git" + +DEPENDS = "alsa-lib" + +inherit cmake + +ALLOW_EMPTY_${PN} = "1" diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/pulseaudio/files/default.pa.4a b/ATTIC/meta-audio-4a-framework/recipes-multimedia/pulseaudio/files/default.pa.4a new file mode 100644 index 00000000..0efdacc2 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/pulseaudio/files/default.pa.4a @@ -0,0 +1,77 @@ +#!/usr/bin/pulseaudio -nF +# +# This file is part of PulseAudio. +# +# PulseAudio is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# PulseAudio is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>. + +# This startup script is used only if PulseAudio is started per-user +# (i.e. not in system mode) + +.fail + +### Automatically augment property information from .desktop files +### stored in /usr/share/application +load-module module-augment-properties + +### Load several protocols +.ifexists module-esound-protocol-unix.so +load-module module-esound-protocol-unix +.endif +load-module module-native-protocol-unix + +### Network access (may be configured with paprefs, so leave this commented +### here if you plan to use paprefs) +#load-module module-esound-protocol-tcp +#load-module module-native-protocol-tcp + +### Load the RTP receiver module (also configured via paprefs, see above) +#load-module module-rtp-recv + +### Load the RTP sender module (also configured via paprefs, see above) +#load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP Multicast Sink'" +#load-module module-rtp-send source=rtp.monitor + +.ifexists module-4a-client.so +load-module module-null-sink sink_name=aaaa_null_sink sink_properties="device.description='4A Null Output'" +set-default-sink aaaa_null_sink +load-module module-4a-client +.else +load-module module-udev-detect +.endif + +### Automatically move streams to the default sink if the sink they are +### connected to dies, similar for sources +load-module module-rescue-streams + +### Make sure we always have a sink around, even if it is a null sink. +load-module module-always-sink + +### Automatically suspend sinks/sources that become idle for too long +load-module module-suspend-on-idle + +### If autoexit on idle is enabled we want to make sure we only quit +### when no local session needs us anymore. +.ifexists module-console-kit.so +load-module module-console-kit +.endif +.ifexists module-systemd-login.so +load-module module-systemd-login +.endif + +### Modules to allow autoloading of filters (such as echo cancellation) +### on demand. module-filter-heuristics tries to determine what filters +### make sense, and module-filter-apply does the heavy-lifting of +### loading modules and rerouting streams. +load-module module-filter-heuristics +load-module module-filter-apply diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/pulseaudio/pulseaudio-module-4a-client_git.bb b/ATTIC/meta-audio-4a-framework/recipes-multimedia/pulseaudio/pulseaudio-module-4a-client_git.bb new file mode 100644 index 00000000..b5e9e011 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/pulseaudio/pulseaudio-module-4a-client_git.bb @@ -0,0 +1,20 @@ +SUMMARY = "pulseaudio 4A client module" +DESCRIPTION = "pulseaudio module to work with 4A (AGL Advanced Audio Agent)" +HOMEPAGE = "https://git.automotivelinux.org/src/pulseaudio-module-4a" +SECTION = "plugins" + +LICENSE = "LGPL-2.1+" +LIC_FILES_CHKSUM = "file://LICENSE;md5=4fbd65380cdd255951079008b364516c" + +SRC_URI = "gitsm://gerrit.automotivelinux.org/gerrit/src/pulseaudio-module-4a.git;protocol=https;branch=${AGL_BRANCH}" +SRCREV = "9cd72ed153f6615ed826b048e1c344bf4640bd2b" + +PV = "0.1+git${SRCPV}" +S = "${WORKDIR}/git" + +inherit cmake pkgconfig + +DEPENDS += "af-binder systemd json-c pulseaudio" +RDEPENDS_${PN} = "pulseaudio-module-alsa-sink" + +FILES_${PN} += "${libdir}/pulse-*/modules/module-4a-client.so" diff --git a/ATTIC/meta-audio-4a-framework/recipes-multimedia/pulseaudio/pulseaudio_%.bbappend b/ATTIC/meta-audio-4a-framework/recipes-multimedia/pulseaudio/pulseaudio_%.bbappend new file mode 100644 index 00000000..d8a84990 --- /dev/null +++ b/ATTIC/meta-audio-4a-framework/recipes-multimedia/pulseaudio/pulseaudio_%.bbappend @@ -0,0 +1,7 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI += "file://default.pa.4a" + +do_install_append () { + cp ${WORKDIR}/default.pa.4a ${D}${sysconfdir}/pulse/default.pa +} |