Samuel Thibault, on jeu. 21 déc. 2017 15:42:13 +0100, wrote: > Cyril Brulebois, on jeu. 21 déc. 2017 15:37:00 +0100, wrote: > > I don't think that's an issue with cherry-picking the relevant commit, > > since it doesn't seem to contain any indications the default voice is > > getting set to English? > > IIRC I had issues without it, so it was on purpose, and just missed > documenting it.
Here is the fixed patch.
diff --git a/debian/changelog b/debian/changelog index a908870..0c1d5a3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +espeakup (1:0.80-5+deb9u1) stretch; urgency=medium + + * debian/espeakup-udeb.start: Fix case where card 0 does not have an id or + where cards have non-contiguous indexes. Also make sure we load the + english language by default. + * debian/espeakup-udeb.finish-install: Use card id in installed system + to avoid issues with card detection ordering. + + -- Samuel Thibault <[email protected]> Sun, 17 Dec 2017 16:35:19 +0100 + espeakup (1:0.80-5) unstable; urgency=medium * Use canonical anonscm vcs URL. diff --git a/debian/espeakup-udeb.finish-install b/debian/espeakup-udeb.finish-install index 00e7e84..17c9182 100644 --- a/debian/espeakup-udeb.finish-install +++ b/debian/espeakup-udeb.finish-install @@ -12,4 +12,4 @@ apt-install espeakup alsa-utils || true cp /usr/share/espeakup-udeb/espeakup.default /target/etc/default/espeakup sed -i -e "s/^VOICE=.*/VOICE=$VOICE/" /target/etc/default/espeakup -[ -z "$ALSA_CARD" ] || sed -i -e "s/^# ALSA_CARD=.*/ALSA_CARD=\"$ALSA_CARD\"/" /target/etc/default/espeakup +[ -z "$ALSA_CARD" ] || sed -i -e "s/^# ALSA_CARD=.*/ALSA_CARD=\"`cat /sys/class/sound/card$ALSA_CARD/id`\"/" /target/etc/default/espeakup diff --git a/debian/espeakup-udeb.start b/debian/espeakup-udeb.start index d187d77..2f5db6a 100644 --- a/debian/espeakup-udeb.start +++ b/debian/espeakup-udeb.start @@ -1,7 +1,15 @@ +BASE=/sys/class/sound + +strip () { + cardid=${1#$BASE/card} + echo ${cardid%/id} +} + if lsmod | grep -q speakup_soft; then # Give drivers some time to detect boards :/ sleep 2 - N=$(ls /sys/class/sound/card*/id | wc -l) + IDS=$(echo $BASE/card*/id) + N=$(echo $IDS | wc -w) case $N in 0) echo No sound card detected, can not do software speech synthesis... Press enter to continue anyway. @@ -9,17 +17,18 @@ if lsmod | grep -q speakup_soft; then ;; 1) # Just one card, can not be wrong - echo 0 > /var/run/espeakup.card - /usr/bin/espeakup > /var/log/espeakup.log 2>&1 + echo $(strip $IDS) > /var/run/espeakup.card + /usr/bin/espeakup -V en > /var/log/espeakup.log 2>&1 ;; *) # Several cards, make the user choose CARD=none while [ "$CARD" = none ] do - for i in $( seq 0 $(($N-1)) ) + for ID in $IDS do - ALSA_CARD=$(cat /sys/class/sound/card$i/id) /usr/bin/espeakup >> /var/log/espeakup.log 2>&1 + i=$(strip $ID) + ALSA_CARD=$(cat /sys/class/sound/card$i/id) /usr/bin/espeakup -V en >> /var/log/espeakup.log 2>&1 while ! [ -r /var/run/espeakup.pid ] do sleep 0.1 @@ -41,6 +50,6 @@ if lsmod | grep -q speakup_soft; then done done echo "$CARD" > /var/run/espeakup.card - ALSA_CARD=$(cat /sys/class/sound/card$CARD/id) /usr/bin/espeakup >> /var/log/espeakup.log 2>&1 + ALSA_CARD=$(cat /sys/class/sound/card$CARD/id) /usr/bin/espeakup -V en >> /var/log/espeakup.log 2>&1 esac fi

