From f1a46d63cc8f887053b9c7c5908089ee95c8065d Mon Sep 17 00:00:00 2001 From: turmary Date: Mon, 28 Sep 2020 08:44:56 +0100 Subject: [PATCH 1/5] Add: service message direct to standard output and also /var/log/seeed-voicecard.log --- seeed-voicecard | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/seeed-voicecard b/seeed-voicecard index b94ec20..c82f973 100755 --- a/seeed-voicecard +++ b/seeed-voicecard @@ -21,7 +21,9 @@ # THE SOFTWARE. set -x -#exec 1>/var/log/$(basename $0).log 2>&1 +LOGF=/var/log/$(basename $0).log +exec 1> >(tee $LOGF) +exec 2>&1 export PATH=$PATH:/opt/vc/bin OVERLAYS=/boot/overlays From c1c2e5ca5687c092b61017b210cf91bbc0edb44f Mon Sep 17 00:00:00 2001 From: turmary Date: Mon, 28 Sep 2020 08:45:45 +0100 Subject: [PATCH 2/5] Add: clear title for each install/uninstall steps --- install.sh | 25 +++++++++++++++++-------- uninstall.sh | 41 +++++++++++++++++++++-------------------- 2 files changed, 38 insertions(+), 28 deletions(-) diff --git a/install.sh b/install.sh index e806c40..2fac40a 100755 --- a/install.sh +++ b/install.sh @@ -164,12 +164,12 @@ done if [ "X$keep_kernel" != "X" ]; then FORCE_KERNEL=$(dpkg -s raspberrypi-kernel | awk '/^Version:/{printf "%s\n",$2;}') - echo "Keep current system kernel not to change" + echo -e "\n### Keep current system kernel not to change" elif [ "X$compat_kernel" != "X" ]; then - echo "will compile with a compatible kernel..." + echo -e "\n### will compile with a compatible kernel..." else FORCE_KERNEL="" - echo "will compile with the latest kernel..." + echo -e "\n### will compile with the latest kernel..." fi [ "X$FORCE_KERNEL" != "X" ] && { echo -e "The kernel & headers use package version: $FORCE_KERNEL\r\n\r\n" @@ -202,6 +202,7 @@ which apt &>/dev/null if [[ $? -eq 0 ]]; then apt update -y apt-get -y install dkms git i2c-tools libasound2-plugins + echo -e "\n### Install required kernel package" install_kernel # rpi-update checker check_kernel_headers @@ -253,13 +254,15 @@ function install_module { mkdir -p /var/lib/dkms/$mod/$ver/$marker } +echo -e "\n### Install sound card driver" install_module "./" "seeed-voicecard" # install dtbos -cp seeed-2mic-voicecard.dtbo $OVERLAYS -cp seeed-4mic-voicecard.dtbo $OVERLAYS -cp seeed-8mic-voicecard.dtbo $OVERLAYS +echo -e "\n### Install device tree overlays" +cp -v seeed-2mic-voicecard.dtbo $OVERLAYS +cp -v seeed-4mic-voicecard.dtbo $OVERLAYS +cp -v seeed-8mic-voicecard.dtbo $OVERLAYS # install alsa plugins # we don't need this plugin now @@ -267,6 +270,7 @@ cp seeed-8mic-voicecard.dtbo $OVERLAYS rm -f /usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_pcm_ac108.so #set kernel modules +echo -e "\n### Install startup modules in /etc/modules" grep -q "^snd-soc-seeed-voicecard$" /etc/modules || \ echo "snd-soc-seeed-voicecard" >> /etc/modules grep -q "^snd-soc-ac108$" /etc/modules || \ @@ -277,6 +281,7 @@ grep -q "^snd-soc-wm8960$" /etc/modules || \ #set dtoverlays CONFIG=/boot/config.txt [ -f /boot/firmware/usercfg.txt ] && CONFIG=/boot/firmware/usercfg.txt +echo -e "\n### Found boot configuration file $CONFIG" sed -i -e 's:#dtparam=i2c_arm=on:dtparam=i2c_arm=on:g' $CONFIG || true grep -q "^dtoverlay=i2s-mmap$" $CONFIG || \ @@ -287,11 +292,13 @@ grep -q "^dtparam=i2s=on$" $CONFIG || \ echo "dtparam=i2s=on" >> $CONFIG #install config files +echo -e "\n### Install alsa and widget configuration" mkdir /etc/voicecard || true -cp *.conf /etc/voicecard -cp *.state /etc/voicecard +cp -v *.conf /etc/voicecard +cp -v *.state /etc/voicecard #create git repo +echo -e "\n### Manage alsa configuration by git" git_email=$(git config --global --get user.email) git_name=$(git config --global --get user.name) if [ "x${git_email}" == "x" ] || [ "x${git_name}" == "x" ] ; then @@ -306,6 +313,8 @@ git --git-dir=/etc/voicecard/.git --work-tree=/etc/voicecard/ add --all echo "git commit -m \"origin configures\"" git --git-dir=/etc/voicecard/.git --work-tree=/etc/voicecard/ commit -m "origin configures" +echo -e "\n### Start service seeed-voicecard" +echo -e " see /var/log/seeed-voicecard for more service information" cp seeed-voicecard /usr/bin/ cp seeed-voicecard.service /lib/systemd/system/ systemctl enable seeed-voicecard.service diff --git a/uninstall.sh b/uninstall.sh index a00f7a1..b1292fc 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -54,39 +54,40 @@ do_overlay() { RPI_HATS="seeed-2mic-voicecard seeed-4mic-voicecard seeed-8mic-voicecard" PATH=$PATH:/opt/vc/bin -echo "remove dtbos" +echo -e "\n### Remove dtbos" for i in $RPI_HATS; do dtoverlay -r $i done OVERLAYS=/boot/overlays [ -d /boot/firmware/overlays ] && OVERLAYS=/boot/firmware/overlays -rm ${OVERLAYS}/seeed-2mic-voicecard.dtbo || true -rm ${OVERLAYS}/seeed-4mic-voicecard.dtbo || true -rm ${OVERLAYS}/seeed-8mic-voicecard.dtbo || true +rm -v ${OVERLAYS}/seeed-2mic-voicecard.dtbo || true +rm -v ${OVERLAYS}/seeed-4mic-voicecard.dtbo || true +rm -v ${OVERLAYS}/seeed-8mic-voicecard.dtbo || true -echo "remove alsa configs" -rm -rf /etc/voicecard/ || true +echo -e "\n### Remove alsa configs" +rm -rfv /etc/voicecard/ || true -echo "disabled seeed-voicecard.service " +echo -e "\n### Disable seeed-voicecard.service " +systemctl stop seeed-voicecard.service systemctl disable seeed-voicecard.service -echo "remove seeed-voicecard" -rm /usr/bin/seeed-voicecard || true -rm /lib/systemd/system/seeed-voicecard.service || true +echo -e "\n### Remove seeed-voicecard" +rm -v /usr/bin/seeed-voicecard || true +rm -v /lib/systemd/system/seeed-voicecard.service || true -echo "remove dkms" -rm -rf /var/lib/dkms/seeed-voicecard || true +echo -e "\n### Remove dkms" +rm -rfv /var/lib/dkms/seeed-voicecard || true -echo "remove kernel modules" -rm /lib/modules/*/kernel/sound/soc/codecs/snd-soc-wm8960.ko || true -rm /lib/modules/*/kernel/sound/soc/codecs/snd-soc-ac108.ko || true -rm /lib/modules/*/kernel/sound/soc/bcm/snd-soc-seeed-voicecard.ko || true -rm /lib/modules/*/updates/dkms/snd-soc-wm8960.ko || true -rm /lib/modules/*/updates/dkms/snd-soc-ac108.ko || true -rm /lib/modules/*/updates/dkms/snd-soc-seeed-voicecard.ko || true +echo -e "\n### Remove kernel modules" +rm -v /lib/modules/*/kernel/sound/soc/codecs/snd-soc-wm8960.ko || true +rm -v /lib/modules/*/kernel/sound/soc/codecs/snd-soc-ac108.ko || true +rm -v /lib/modules/*/kernel/sound/soc/bcm/snd-soc-seeed-voicecard.ko || true +rm -v /lib/modules/*/updates/dkms/snd-soc-wm8960.ko || true +rm -v /lib/modules/*/updates/dkms/snd-soc-ac108.ko || true +rm -v /lib/modules/*/updates/dkms/snd-soc-seeed-voicecard.ko || true -echo "remove $CONFIG configuration" +echo -e "\n### Remove $CONFIG configuration" for i in $RPI_HATS; do echo Uninstall $i ... do_overlay $i 1 From a891e0260ecf83eeeda47583fea568d363485322 Mon Sep 17 00:00:00 2001 From: turmary Date: Mon, 28 Sep 2020 18:03:18 +0800 Subject: [PATCH 3/5] Remove: debug only or wrong widget --- ac101.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ac101.c b/ac101.c index 92b2583..2499bc1 100644 --- a/ac101.c +++ b/ac101.c @@ -772,16 +772,18 @@ static int snd_ac101_put_volsw(struct snd_kcontrol *kcontrol, static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -11925, 75, 0); +/* static const DECLARE_TLV_DB_SCALE(dac_mix_vol_tlv, -600, 600, 0); static const DECLARE_TLV_DB_SCALE(dig_vol_tlv, -7308, 116, 0); +*/ static const DECLARE_TLV_DB_SCALE(speaker_vol_tlv, -4800, 150, 0); static const DECLARE_TLV_DB_SCALE(headphone_vol_tlv, -6300, 100, 0); static struct snd_kcontrol_new ac101_controls[] = { /*DAC*/ SOC_DOUBLE_TLV("DAC volume", DAC_VOL_CTRL, DAC_VOL_L, DAC_VOL_R, 0xff, 0, dac_vol_tlv), - SOC_DOUBLE_TLV("DAC mixer gain", DAC_MXR_GAIN, DACL_MXR_GAIN, DACR_MXR_GAIN, 0xf, 0, dac_mix_vol_tlv), - SOC_SINGLE_TLV("digital volume", DAC_DBG_CTRL, DVC, 0x3f, 1, dig_vol_tlv), + /* SOC_DOUBLE_TLV("DAC Mix Gain", DAC_MXR_GAIN, DACL_MXR_GAIN, DACR_MXR_GAIN, 0xf, 0, dac_mix_vol_tlv), */ + /* SOC_SINGLE_TLV("DAC Debug Volume", DAC_DBG_CTRL, DVC, 0x3f, 1, dig_vol_tlv), */ SOC_SINGLE_TLV("speaker volume", SPKOUT_CTRL, SPK_VOL, 0x1f, 0, speaker_vol_tlv), SOC_SINGLE_TLV("headphone volume", HPOUT_CTRL, HP_VOL, 0x3f, 0, headphone_vol_tlv), }; From e1110617b2dcb06c0191234b5b643187db2d58e4 Mon Sep 17 00:00:00 2001 From: turmary Date: Mon, 28 Sep 2020 18:04:40 +0800 Subject: [PATCH 4/5] Move: volume name widget to ALSA tradition --- ac101.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ac101.c b/ac101.c index 2499bc1..eaa8831 100644 --- a/ac101.c +++ b/ac101.c @@ -781,11 +781,11 @@ static const DECLARE_TLV_DB_SCALE(headphone_vol_tlv, -6300, 100, 0); static struct snd_kcontrol_new ac101_controls[] = { /*DAC*/ - SOC_DOUBLE_TLV("DAC volume", DAC_VOL_CTRL, DAC_VOL_L, DAC_VOL_R, 0xff, 0, dac_vol_tlv), + SOC_DOUBLE_TLV("DAC Playback Volume", DAC_VOL_CTRL, DAC_VOL_L, DAC_VOL_R, 0xff, 0, dac_vol_tlv), /* SOC_DOUBLE_TLV("DAC Mix Gain", DAC_MXR_GAIN, DACL_MXR_GAIN, DACR_MXR_GAIN, 0xf, 0, dac_mix_vol_tlv), */ /* SOC_SINGLE_TLV("DAC Debug Volume", DAC_DBG_CTRL, DVC, 0x3f, 1, dig_vol_tlv), */ - SOC_SINGLE_TLV("speaker volume", SPKOUT_CTRL, SPK_VOL, 0x1f, 0, speaker_vol_tlv), - SOC_SINGLE_TLV("headphone volume", HPOUT_CTRL, HP_VOL, 0x3f, 0, headphone_vol_tlv), + SOC_SINGLE_TLV("Speaker Playback Volume", SPKOUT_CTRL, SPK_VOL, 0x1f, 0, speaker_vol_tlv), + SOC_SINGLE_TLV("Headphone Playback Volume", HPOUT_CTRL, HP_VOL, 0x3f, 0, headphone_vol_tlv), }; /* PLL divisors */ From 30ceb546fa1e6d9f3814599f2d0208253e223d85 Mon Sep 17 00:00:00 2001 From: turmary Date: Mon, 28 Sep 2020 18:14:32 +0800 Subject: [PATCH 5/5] Move: volume name in state configuration --- ac108_6mic.state | 38 ++++---------------------------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/ac108_6mic.state b/ac108_6mic.state index bdbe64a..0920cdb 100644 --- a/ac108_6mic.state +++ b/ac108_6mic.state @@ -292,7 +292,7 @@ state.seeed8micvoicec { } control.17 { iface MIXER - name 'DAC volume' + name 'DAC Playback Volume' value.0 0 value.1 0 comment { @@ -308,37 +308,7 @@ state.seeed8micvoicec { } control.18 { iface MIXER - name 'DAC mixer gain' - value.0 0 - value.1 0 - comment { - access 'read write' - type INTEGER - count 2 - range '0 - 15' - dbmin -600 - dbmax 8400 - dbvalue.0 -600 - dbvalue.1 -600 - } - } - control.19 { - iface MIXER - name 'digital volume' - value 51 - comment { - access 'read write' - type INTEGER - count 1 - range '0 - 63' - dbmin -7308 - dbmax 0 - dbvalue.0 -1392 - } - } - control.20 { - iface MIXER - name 'speaker volume' + name 'Speaker Playback Volume' value 25 comment { access 'read write' @@ -350,9 +320,9 @@ state.seeed8micvoicec { dbvalue.0 -1050 } } - control.21 { + control.19 { iface MIXER - name 'headphone volume' + name 'Headphone Playback Volume' value 52 comment { access 'read write'