From ac2bf5f638e470c60b812b20af54b296aab8ab27 Mon Sep 17 00:00:00 2001 From: turmary Date: Wed, 30 Sep 2020 10:39:23 +0800 Subject: [PATCH 1/2] Move: dkms module removing to the position before kernel update --- install.sh | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/install.sh b/install.sh index 4e76a45..ac6ebc7 100755 --- a/install.sh +++ b/install.sh @@ -201,11 +201,34 @@ function install_kernel() { } } +function uninstall_module { + src=$1 + mod=$2 + + if [[ -d /var/lib/dkms/$mod/$ver/$marker ]]; then + rmdir /var/lib/dkms/$mod/$ver/$marker + fi + + if [[ -e /usr/src/$mod-$ver || -e /var/lib/dkms/$mod/$ver ]]; then + dkms remove --force -m $mod -v $ver --all + rm -rf /usr/src/$mod-$ver + fi + + return 0 +} + # update and install required packages -which apt &>/dev/null -if [[ $? -eq 0 ]]; then +which apt &>/dev/null; r=$? +if [[ $r -eq 0 ]]; then + echo -e "\n### Install required tool packages" apt update -y apt-get -y install dkms git i2c-tools libasound2-plugins +fi + +echo -e "\n### Uninstall previous dkms module" +uninstall_module "./" "seeed-voicecard" + +if [[ $r -eq 0 ]]; then echo -e "\n### Install required kernel package" install_kernel # rpi-update checker @@ -232,15 +255,6 @@ function install_module { src=$1 mod=$2 - if [[ -d /var/lib/dkms/$mod/$ver/$marker ]]; then - rmdir /var/lib/dkms/$mod/$ver/$marker - fi - - if [[ -e /usr/src/$mod-$ver || -e /var/lib/dkms/$mod/$ver ]]; then - dkms remove --force -m $mod -v $ver --all - rm -rf /usr/src/$mod-$ver - fi - mkdir -p /usr/src/$mod-$ver cp -a $src/* /usr/src/$mod-$ver/ @@ -261,7 +275,6 @@ function install_module { echo -e "\n### Install sound card driver" install_module "./" "seeed-voicecard" - # install dtbos echo -e "\n### Install device tree overlays" cp -v seeed-2mic-voicecard.dtbo $OVERLAYS From 8cce4e8ffa77e1e2b89812e5e2ccf6cfbc1086cf Mon Sep 17 00:00:00 2001 From: turmary Date: Wed, 30 Sep 2020 15:04:47 +0800 Subject: [PATCH 2/2] Add: document about "query sound card number" --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index dcd158e..e884227 100644 --- a/README.md +++ b/README.md @@ -196,7 +196,22 @@ plughw:CARD=seeed8micvoicec,DEV=0 In contrast to 6-Mics Circular Array Kit for Raspberry Pi, the difference is only first 4 input channels are valid capture data. + ### Usage: + +```bash +#Query sound card number +# The sound card number used as arecord/aplay argument, +# ( like '-D hw:N' and '-D plughw:N', where N is the number ) +# could be found by command: + aplay -l +#or + arecord -l +# Find the line in the command output which near below form: +card 1: seeed2micvoicec [seeed-2mic-voicecard], device 0: ... +# The number between first word `card` and char `:` is the Sound Card Number, here it's 1. +``` + ```bash #for ReSpeaker 2-mic #It will capture sound an playback on hw:1