use link to replase copy operation
This commit is contained in:
parent
8c499c2268
commit
7009515ec9
1 changed files with 15 additions and 28 deletions
|
@ -36,56 +36,43 @@ is_1a=$(i2cdetect -y 1 0x1a 0x1a | grep 1a | awk '{print $2}')
|
||||||
is_35=$(i2cdetect -y 1 0x35 0x35 | grep 35 | awk '{print $2}')
|
is_35=$(i2cdetect -y 1 0x35 0x35 | grep 35 | awk '{print $2}')
|
||||||
is_3b=$(i2cdetect -y 1 0x3b 0x3b | grep 3b | awk '{print $2}')
|
is_3b=$(i2cdetect -y 1 0x3b 0x3b | grep 3b | awk '{print $2}')
|
||||||
|
|
||||||
|
rm /etc/asound.conf
|
||||||
|
rm /var/lib/alsa/asound.state
|
||||||
|
|
||||||
if [ "x${is_1a}" == "x1a" ] && [ "x${is_35}" == "x" ] ; then
|
if [ "x${is_1a}" == "x1a" ] && [ "x${is_35}" == "x" ] ; then
|
||||||
echo "install 2mic"
|
echo "install 2mic"
|
||||||
dtoverlay seeed-2mic-voicecard
|
dtoverlay seeed-2mic-voicecard
|
||||||
sleep 1
|
sleep 1
|
||||||
hw=$(aplay -l | grep seeed2micvoicec | awk '{print $2}' | sed 's/://')
|
|
||||||
|
|
||||||
cp /etc/voicecard/asound_2mic.conf /etc/asound.conf
|
echo "create 2mic asound configure file"
|
||||||
|
ln -s /etc/voicecard/asound_2mic.conf /etc/asound.conf
|
||||||
|
|
||||||
echo "get old hw number"
|
echo "create 2mic asound status file"
|
||||||
old=$(cat /etc/asound.conf | grep hw: | awk 'NR==1 {print $2}' | sed 's/\"//g')
|
ln -s /etc/voicecard/wm8960_asound.state /var/lib/alsa/asound.state
|
||||||
|
|
||||||
echo "replace new hw:${hw},0"
|
|
||||||
sed -i -e "s/${old}/hw:${hw},0/g" /etc/asound.conf
|
|
||||||
|
|
||||||
cp /etc/voicecard/wm8960_asound.state /var/lib/alsa/asound.state
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x${is_3b}" == "x3b" ] && [ "x${is_35}" == "x" ] ; then
|
if [ "x${is_3b}" == "x3b" ] && [ "x${is_35}" == "x" ] ; then
|
||||||
echo "install 4mic"
|
echo "install 4mic"
|
||||||
dtoverlay seeed-4mic-voicecard
|
dtoverlay seeed-4mic-voicecard
|
||||||
sleep 1
|
sleep 1
|
||||||
hw=$(arecord -l | grep seeed4micvoicec | awk '{print $2}' | sed 's/://')
|
|
||||||
|
|
||||||
cp /etc/voicecard/asound_4mic.conf /etc/asound.conf
|
echo "create 4mic asound configure file"
|
||||||
|
ln -s /etc/voicecard/asound_4mic.conf /etc/asound.conf
|
||||||
|
|
||||||
echo "get slavepcm line number"
|
echo "create 4mic asound status file"
|
||||||
line=$(grep -n ac108-slavepcm /etc/asound.conf | awk '{print $1}' | sed 's/://')
|
ln -s /etc/voicecard/ac108_asound.state /var/lib/alsa/asound.state
|
||||||
|
|
||||||
echo "delete ${line} slavepcm hw number"
|
|
||||||
sed -i -e "${line}d" /etc/asound.conf
|
|
||||||
|
|
||||||
echo "insert slavepcm hw:${hw},0"
|
|
||||||
sed -i "${line}i slave.pcm \"hw:${hw},0\"" /etc/asound.conf
|
|
||||||
|
|
||||||
cp /etc/voicecard/ac108_asound.state /var/lib/alsa/asound.state
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x${is_3b}" == "x3b" ] && [ "x${is_35}" == "x35" ] ; then
|
if [ "x${is_3b}" == "x3b" ] && [ "x${is_35}" == "x35" ] ; then
|
||||||
echo "install 6mic"
|
echo "install 6mic"
|
||||||
dtoverlay seeed-8mic-voicecard
|
dtoverlay seeed-8mic-voicecard
|
||||||
sleep 1
|
sleep 1
|
||||||
hw=$(aplay -l | grep seeed8micvoicec | awk '{print $2}' | sed 's/://')
|
|
||||||
|
|
||||||
cp /etc/voicecard/asound_6mic.conf /etc/asound.conf
|
echo "create 6mic asound configure file"
|
||||||
|
ln -s /etc/voicecard/asound_6mic.conf /etc/asound.conf
|
||||||
|
|
||||||
old=$(cat /etc/asound.conf | grep hw: | awk 'NR==1 {print $2}' | sed 's/\"//g')
|
echo "create 6mic asound status file"
|
||||||
|
ln -s /etc/voicecard/ac108_6mic.state /var/lib/alsa/asound.state
|
||||||
sed -i -e "s/${old}/hw:${hw},0/g" /etc/asound.conf
|
|
||||||
|
|
||||||
cp /etc/voicecard/ac108_6mic.state /var/lib/alsa/asound.state
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
alsactl restore
|
alsactl restore
|
||||||
|
|
Loading…
Reference in a new issue