Changes to sound architecture, prepare system no longer needed

This commit is contained in:
j1nx 2021-02-05 16:10:50 +01:00
parent f6df47f452
commit 17a59feec9
20 changed files with 85 additions and 6631 deletions

View File

@ -1,5 +1,3 @@
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/prepare_system-service/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/ovos-splash/Config.in"
menu "Additional drivers, libraries and/or applications"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/alsa-plugins/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/baresip/Config.in"
@ -82,6 +80,7 @@ endmenu
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/librem/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/lottie-qml/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/ncpamixer/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/ovos-splash/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/respeaker/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/snapcast/Config.in"
source "$BR2_EXTERNAL_OPENVOICEOS_PATH/package/spotifyd/Config.in"

View File

@ -20,6 +20,7 @@ image sdcard.img {
partition boot1 {
partition-type = 0xC
partition-uuid = 9262aee5-2d23-4e09-baac-280591e2e834
partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b
bootable = "true"
image = "boot.vfat"

File diff suppressed because it is too large Load Diff

View File

@ -88,7 +88,8 @@
# OpenVoiceOS Audio Settings
resample-method = ffmpeg
default-sample-format = s24le
default-sample-rate = 48000
alternate-sample-rate = 44100
default-sample-format = s16le
default-sample-rate = 96000
default-sample-channels = 4
avoid-resampling = true
flat-volumes = no

View File

@ -88,7 +88,8 @@
# OpenVoiceOS Audio Settings
resample-method = ffmpeg
default-sample-format = s24le
default-sample-rate = 48000
alternate-sample-rate = 44100
default-sample-format = s32le
default-sample-rate = 96000
default-sample-channels = 8
avoid-resampling = true
flat-volumes = no

View File

@ -36,6 +36,7 @@ BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/raspberrypi/linux/archive/617a1c1722aeaa4d69356e18b88d569366f1ac1b.tar.gz"
BR2_LINUX_KERNEL_DEFCONFIG="bcm2711"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL)/board/raspberrypi/kernel.config"
BR2_LINUX_KERNEL_LZ4=y
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2711-rpi-4-b broadcom/bcm2711-rpi-400 broadcom/bcm2711-rpi-cm4"
@ -492,8 +493,6 @@ BR2_PACKAGE_HOST_PYTHON_SIX=y
BR2_PACKAGE_HOST_PYTHON_XLRD=y
BR2_PACKAGE_HOST_PYTHON3=y
BR2_PACKAGE_HOST_PYTHON3_SSL=y
BR2_PACKAGE_PREPARE_SYSTEM_SERVICE=y
BR2_PACKAGE_OVOS_SPLASH=y
BR2_PACKAGE_ALSA_PLUGINS=y
BR2_PACKAGE_BARESIP=y
BR2_PACKAGE_BTSPEAKER=y
@ -521,6 +520,7 @@ BR2_PACKAGE_LIBRE=y
BR2_PACKAGE_LIBREM=y
BR2_PACKAGE_LOTTIE_QML=y
BR2_PACKAGE_NCPAMIXER=y
BR2_PACKAGE_OVOS_SPLASH=y
BR2_PACKAGE_RESPEAKER=y
BR2_PACKAGE_SNAPCAST=y
BR2_PACKAGE_SNAPCAST_SERVER=y

View File

@ -4,7 +4,7 @@
#
################################################################################
MYCROFT_SKILL_OVOS_PAIRING_VERSION = 1973ad0978516f11f5217af9f8303d82831e507d
MYCROFT_SKILL_OVOS_PAIRING_VERSION = d8fea7c156fc91043d0782de94d5c348c12b71d7
MYCROFT_SKILL_OVOS_PAIRING_SITE = git://github.com/OpenVoiceOS/skill-ovos-pairing
MYCROFT_SKILL_OVOS_PAIRING_SITE_METHOD = git
MYCROFT_SKILL_OVOS_PAIRING_DIRLOCATION = opt/mycroft/skills

View File

@ -1,6 +0,0 @@
config BR2_PACKAGE_PREPARE_SYSTEM_SERVICE
bool "prepare_system-service"
help
A systemd service that prepares the system.
Used to change/move files before everything
gets loaded.

View File

@ -1,21 +0,0 @@
#!/bin/bash
#
set -x
exec 1>/var/log/$(basename $0).log 2>&1
mkdir -p /boot
mount -t vfat /dev/mmcblk0p1 /boot
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
rm /var/lib/alsa/asound.state
rm /etc/pulse/default.pa
rm /etc/pulse/system.pa
rm /etc/pulse/daemon.conf
ln -s /var/lib/alsa/default-asound.state /var/lib/alsa/asound.state
ln -s /etc/pulse/pulseaudio-default.pa /etc/pulse/default.pa
ln -s /etc/pulse/pulseaudio-system.pa /etc/pulse/system.pa
ln -s /etc/pulse/pulseaudio-daemon.conf /etc/pulse/daemon.conf
export LC_ALL="C"

View File

@ -1,19 +0,0 @@
################################################################################
#
# prepare_system-service
#
################################################################################
PREPARE_SYSTEM_SERVICE_VERSION = 0.1.0
PREPARE_SYSTEM_SERVICE_SITE = $(BR2_EXTERNAL_OPENVOICEOS_PATH)/package/prepare_system-service
PREPARE_SYSTEM_SERVICE_SITE_METHOD = local
PREPARE_SYSTEM_SERVICE_LICENSE = Apache License 2.0
PREPARE_SYSTEM_SERVICE_LICENSE_FILES = LICENSE
define PREPARE_SYSTEM_SERVICE_INSTALL_TARGET_CMDS
$(INSTALL) -m 0755 $(@D)/prepare_system $(TARGET_DIR)/usr/sbin/
$(INSTALL) -D -m 644 $(@D)/prepare_system.service \
$(TARGET_DIR)/usr/lib/systemd/system/prepare_system.service
endef
$(eval $(generic-package))

View File

@ -1,14 +0,0 @@
[Unit]
Description=System prepare run script
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-remount-fs.service
Before=sysinit.target shutdown.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/prepare_system
[Install]
WantedBy=sysinit.target

View File

@ -0,0 +1,40 @@
From 1ca3a1c09f33700eccb0277e1b0b1e809f98c00b Mon Sep 17 00:00:00 2001
From: j1nx <p.steenbergen@j1nx.nl>
Date: Thu, 4 Feb 2021 15:59:08 +0100
Subject: [PATCH 1/1] Do not build the wm8960 driver
---
Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index b9de7f4..34e3151 100644
--- a/Makefile
+++ b/Makefile
@@ -12,12 +12,12 @@ uname_r=$(shell uname -r)
ifneq ($(KERNELRELEASE),)
# $(warning KERNELVERSION=$(KERNELVERSION))
-snd-soc-wm8960-objs := wm8960.o
+#snd-soc-wm8960-objs := wm8960.o
snd-soc-ac108-objs := ac108.o ac101.o
snd-soc-seeed-voicecard-objs := seeed-voicecard.o
-obj-m += snd-soc-wm8960.o
+#obj-m += snd-soc-wm8960.o
obj-m += snd-soc-ac108.o
obj-m += snd-soc-seeed-voicecard.o
@@ -41,7 +41,7 @@ clean:
install:
sudo cp snd-soc-ac108.ko ${DEST}/sound/soc/codecs/
- sudo cp snd-soc-wm8960.ko ${DEST}/sound/soc/codecs/
+# sudo cp snd-soc-wm8960.ko ${DEST}/sound/soc/codecs/
sudo cp snd-soc-seeed-voicecard.ko ${DEST}/sound/soc/bcm/
sudo depmod -a
--
2.20.1

View File

@ -1,3 +0,0 @@
snd-soc-seeed-voicecard
snd-soc-ac108
snd-soc-wm8960

View File

@ -15,18 +15,14 @@ define RESPEAKER_INSTALL_TARGET_CMDS
$(INSTALL) -D -m 0644 $(BR2_EXTERNAL_OPENVOICEOS_PATH)/package/respeaker/seeed-voicecard.service \
$(TARGET_DIR)/usr/lib/systemd/system/seeed-voicecard.service
$(INSTALL) -D -m 0644 $(BR2_EXTERNAL_OPENVOICEOS_PATH)/package/respeaker/respeaker.conf \
$(TARGET_DIR)/etc/modules-load.d/respeaker.conf
mkdir -p $(TARGET_DIR)/etc/voicecard
$(INSTALL) -D -m 0644 $(@D)/*.state $(TARGET_DIR)/etc/voicecard
$(INSTALL) -D -m 0755 $(BR2_EXTERNAL_OPENVOICEOS_PATH)/package/respeaker/seeed-voicecard \
$(TARGET_DIR)/usr/bin
$(INSTALL) -D -m 0644 $(@D)/seeed-2mic-voicecard.dtbo $(BINARIES_DIR)/rpi-firmware/overlays/
$(INSTALL) -D -m 0644 $(@D)/seeed-4mic-voicecard.dtbo $(BINARIES_DIR)/rpi-firmware/overlays/
$(INSTALL) -D -m 0644 $(@D)/seeed-8mic-voicecard.dtbo $(BINARIES_DIR)/rpi-firmware/overlays/
$(INSTALL) -D -m 0644 $(@D)/seeed-4mic-voicecard.dtbo $(BINARIES_DIR)/overlays/
$(INSTALL) -D -m 0644 $(@D)/seeed-8mic-voicecard.dtbo $(BINARIES_DIR)/overlays/
mkdir -p $(TARGET_DIR)/usr/share/pulseaudio/alsa-mixer/profile-sets/
$(INSTALL) -D -m 0644 $(@D)/pulseaudio/pulse_config_4mic/seeed-voicecard.conf \

View File

@ -31,58 +31,33 @@ modprobe i2c-dev
#enable spi interface
dtparam -d $OVERLAYS spi=on
CONFIG=/boot/config.txt
get_overlay() {
ov=$1
if grep -q -E "^dtoverlay=$ov" $CONFIG; then
echo 0
else
echo 1
fi
}
do_overlay() {
ov=$1
RET=$2
DEFAULT=--defaultno
CURRENT=0
if [ $(get_overlay $ov) -eq 0 ]; then
DEFAULT=
CURRENT=1
fi
if [ $RET -eq $CURRENT ]; then
ASK_TO_REBOOT=1
fi
if [ $RET -eq 0 ]; then
sed $CONFIG -i -e "s/^#dtoverlay=$ov/dtoverlay=$ov/"
if ! grep -q -E "^dtoverlay=$ov" $CONFIG; then
printf "dtoverlay=$ov\n" >> $CONFIG
fi
STATUS=enabled
elif [ $RET -eq 1 ]; then
sed $CONFIG -i -e "s/^dtoverlay=$ov/#dtoverlay=$ov/"
STATUS=disabled
else
return $RET
fi
}
is_1a=$(i2cdetect -y 1 0x1a 0x1a | egrep "(1a|UU)" | awk '{print $2}')
is_35=$(i2cdetect -y 1 0x35 0x35 | egrep "(35|UU)" | awk '{print $2}')
is_3b=$(i2cdetect -y 1 0x3b 0x3b | egrep "(3b|UU)" | awk '{print $2}')
# Set default configurations
RPI_HATS="seeed-2mic-voicecard seeed-4mic-voicecard seeed-8mic-voicecard"
overlay=""
asound_state=/var/lib/alsa/default-asound.state
pulse_default=/etc/pulse/pulseaudio-system.pa
pulse_daemon=/etc/pulse/pulseaudio-daemon.conf
# Remove old configurations
rm /var/lib/alsa/asound.state
rm /etc/pulse/system.pa
rm /etc/pulse/daemon.conf
if [ "x${is_1a}" != "x" ] && [ "x${is_35}" == "x" ] ; then
echo "install 2mic"
overlay=seeed-2mic-voicecard
echo "install wm8960"
modprobe snd-soc-wm8960
overlay=wm8960-soundcard
asound_state=/etc/voicecard/wm8960_asound.state
fi
if [ "x${is_3b}" != "x" ] && [ "x${is_35}" == "x" ] ; then
echo "install 4mic"
modprobe snd-soc-seeed-voicecard
modprobe snd-soc-ac108
overlay=seeed-4mic-voicecard
asound_state=/etc/voicecard/ac108_asound.state
pulse_default=/etc/pulse/seeed-voicecard-4mic-default.pa
@ -91,6 +66,8 @@ fi
if [ "x${is_3b}" != "x" ] && [ "x${is_35}" != "x" ] ; then
echo "install 6mic"
modprobe snd-soc-seeed-voicecard
modprobe snd-soc-ac108
overlay=seeed-8mic-voicecard
asound_state=/etc/voicecard/ac108_6mic.state
pulse_default=/etc/pulse/seeed-voicecard-8mic-default.pa
@ -98,39 +75,16 @@ if [ "x${is_3b}" != "x" ] && [ "x${is_35}" != "x" ] ; then
fi
if [ "$overlay" ]; then
echo Install $overlay ...
echo Loading $overlay ...
# Remove old configuration
rm /var/lib/alsa/asound.state
rm /etc/pulse/default.pa
rm /etc/pulse/system.pa
rm /etc/pulse/daemon.conf
kernel_ver=$(uname -r)
# echo kernel_ver=$kernel_ver
# TODO: dynamic dtoverlay Bug of v4.19.x
# no DT node phandle inserted.
if [[ "$kernel_ver" =~ ^4\.19.*$ || "$kernel_ver" =~ ^5\.*$ ]]; then
for i in $RPI_HATS; do
if [ "$i" == "$overlay" ]; then
do_overlay $overlay 0
else
echo Uninstall $i ...
do_overlay $i 1
fi
done
fi
#make sure the driver loads correctly
# Make sure the driver loads correctly
dtoverlay -d $OVERLAYS $overlay || true
#install soundstate
# Install soundstate
echo "create $overlay asound status file"
ln -s $asound_state /var/lib/alsa/asound.state
#install pulseaudio files
echo "create $overlay pulse default file"
ln -s $pulse_default /etc/pulse/default.pa
# Install pulseaudio files
echo "create $overlay pulse system file"
ln -s $pulse_default /etc/pulse/system.pa
echo "create $overlay pulse daemon file"
@ -138,5 +92,3 @@ if [ "$overlay" ]; then
fi
alsactl restore
touch /var/lock/seeed-voicecard

View File

@ -1,4 +1,6 @@
# <file system> <mount pt> <type> <options> <dump> <pass>
PARTUUID=9262aee5-2d23-4e09-baac-280591e2e834 /boot vfat defaults,noatime 0 0
PARTUUID=c0932a41-44cf-463b-8152-d43188553ed4 / ext4 defaults,noatime 0 1
proc /proc proc defaults 0 0
devpts /dev/pts devpts defaults,gid=5,mode=620,ptmxmode=0666 0 0
tmpfs /dev/shm tmpfs mode=0777 0 0

View File

@ -90,6 +90,8 @@
# OpenVoiceOS Audio Settings
resample-method = ffmpeg
default-sample-format = s24le
default-sample-rate = 48000
alternate-sample-rate = 44100
default-sample-format = s16le
default-sample-rate = 44100
alternate-sample-rate = 48000
avoid-resampling = true
flat-volumes = no

View File

@ -1,152 +0,0 @@
#!/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 restore the volume of streams and devices
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore
### Automatically augment property information from .desktop files
### stored in /usr/share/application
load-module module-augment-properties
### Should be after module-*-restore but before module-*-detect
load-module module-switch-on-port-available
### Load audio drivers statically
### (it's probably better to not load these drivers manually, but instead
### use module-udev-detect -- see below -- for doing this automatically)
#load-module module-alsa-sink
#load-module module-alsa-source device=hw:1,0
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
#load-module module-null-sink
#load-module module-pipe-sink
### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
load-module module-udev-detect tsched=0
.else
### Use the static hardware detection module (for systems that lack udev support)
load-module module-detect
.endif
### Automatically connect sink and source if JACK server is present
.ifexists module-jackdbus-detect.so
.nofail
load-module module-jackdbus-detect channels=2
.fail
.endif
### Automatically load driver modules for Bluetooth hardware
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
.endif
.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
.endif
### Load several protocols
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix auth-anonymous=1
### 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 auth-ip-acl=127.0.0.1;192.168.0.0/16;172.16.0.0/12;10.0.0.0/8 auth-anonymous=1
load-module module-zeroconf-publish
### 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
### Load additional modules from GSettings. This can be configured with the paprefs tool.
### Please keep in mind that the modules configured by paprefs might conflict with manually
### loaded modules.
.ifexists module-gsettings.so
.nofail
load-module module-gsettings
.fail
.endif
### Automatically restore the default sink/source when changed by the user
### during runtime
### NOTE: This should be loaded as early as possible so that subsequent modules
### that look up the default sink/source get the right value
load-module module-default-device-restore
### 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
### Honour intended role device property
load-module module-intended-roles
### 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
### Enable positioned event sounds
load-module module-position-event-sounds
### Cork music/video streams when a phone stream is active
#load-module module-role-cork
### 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
### Make some devices default
#set-default-sink output
#set-default-source input
### OpenVoiceOS Audio Settings
unload-module module-suspend-on-idle
load-module module-role-ducking
load-module module-combine-sink sink_name=OpenVoiceOS
set-default-sink OpenVoiceOS
### Enable Echo/Noise-Cancellation
#load-module module-echo-cancel aec_method=webrtc source_name=echoCancel_source sink_name=echoCancel_sink
#set-default-source echoCancel_source
#set-default-sink echoCancel_sink

View File

@ -1,4 +1,3 @@
enable prepare_system.service
enable growdisk.service
enable hostname.service
enable sshd.service