MycroftOS: System changes related to sound and restoring them.

This commit is contained in:
Peter Steenbergen 2019-11-17 14:30:43 +01:00
parent fad8734ec9
commit ed27ec8fad
4 changed files with 80 additions and 2 deletions

View File

@ -3,10 +3,19 @@
set -x
exec 1>/var/log/$(basename $0).log 2>&1
mkdir -p /boot
mount -t vfat /dev/mmcblk0p1 /boot
echo performance > /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
alsactl restore

View File

@ -21,6 +21,9 @@ define RESPEAKER_INSTALL_TARGET_CMDS
$(INSTALL) -D -m 0644 $(BR2_EXTERNAL_MYCROFTOS_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_MYCROFTOS_PATH)/package/respeaker/seeed-voicecard \
$(TARGET_DIR)/usr/bin

View File

@ -22,8 +22,6 @@
set -x
exec 1>/var/log/$(basename $0).log 2>&1
mkdir -p /boot
mount -t vfat /dev/mmcblk0p1 /boot
#enable i2c interface
dtparam i2c_arm=on
@ -93,11 +91,13 @@ overlay=""
if [ "x${is_1a}" != "x" ] && [ "x${is_35}" == "x" ] ; then
echo "install 2mic"
overlay=seeed-2mic-voicecard
asound_state=/etc/voicecard/wm8960_asound.state
fi
if [ "x${is_3b}" != "x" ] && [ "x${is_35}" == "x" ] ; then
echo "install 4mic"
overlay=seeed-4mic-voicecard
asound_state=/etc/voicecard/ac108_asound.state
pulse_default=/etc/pulse/seeed-voicecard-4mic-default.pa
pulse_daemon=/etc/pulse/seeed-voicecard-4mic-daemon.conf
fi
@ -105,6 +105,7 @@ fi
if [ "x${is_3b}" != "x" ] && [ "x${is_35}" != "x" ] ; then
echo "install 6mic"
overlay=seeed-8mic-voicecard
asound_state=/etc/voicecard/ac108_6mic.state
pulse_default=/etc/pulse/seeed-voicecard-8mic-default.pa
pulse_daemon=/etc/pulse/seeed-voicecard-8mic-daemon.conf
fi
@ -113,6 +114,7 @@ if [ "$overlay" ]; then
echo Install $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
@ -135,6 +137,10 @@ if [ "$overlay" ]; then
#make sure the driver loads correctly
dtoverlay $overlay || true
#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
@ -144,4 +150,6 @@ if [ "$overlay" ]; then
ln -s $pulse_daemon /etc/pulse/daemon.conf
fi
alsactl restore
touch /var/lock/seeed-voicecard

View File

@ -0,0 +1,58 @@
state.ALSA {
control.1 {
iface MIXER
name 'PCM Playback Volume'
value -31
comment {
access 'read write'
type INTEGER
count 1
range '-10239 - 400'
dbmin -9999999
dbmax 400
dbvalue.0 -31
}
}
control.2 {
iface MIXER
name 'PCM Playback Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.3 {
iface MIXER
name 'PCM Playback Route'
value 0
comment {
access 'read write'
type INTEGER
count 1
range '0 - 3'
}
}
control.4 {
iface PCM
name 'IEC958 Playback Default'
value '0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
comment {
access 'read write'
type IEC958
count 1
}
}
control.5 {
iface PCM
name 'IEC958 Playback Con Mask'
value '0200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
comment {
access read
type IEC958
count 1
}
}
}