diff -Nru espeakup-0.80/debian/changelog espeakup-0.80/debian/changelog --- espeakup-0.80/debian/changelog 2019-03-29 16:03:23.000000000 +0000 +++ espeakup-0.80/debian/changelog 2019-05-18 14:37:19.000000000 +0000 @@ -1,3 +1,9 @@ +espeakup (1:0.80-15) unstable; urgency=medium + + * debian/espeakup-udeb.start: Wait longer for sound cards... + + -- Samuel Thibault Sat, 18 May 2019 16:37:19 +0200 + espeakup (1:0.80-14) unstable; urgency=medium * rules: Restart espeakup after upgrade (Closes: Bug#925973). diff -Nru espeakup-0.80/debian/espeakup-udeb.start espeakup-0.80/debian/espeakup-udeb.start --- espeakup-0.80/debian/espeakup-udeb.start 2019-03-29 16:03:23.000000000 +0000 +++ espeakup-0.80/debian/espeakup-udeb.start 2019-05-18 14:35:42.000000000 +0000 @@ -7,14 +7,39 @@ if lsmod | grep -q speakup_soft; then # Give drivers some time to detect boards :/ - sleep 2 - 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. - read - ;; + sleep 1 + S=1 + while true + do + IDS=$(echo $BASE/card*/id) + if [ "$IDS" = "$BASE/card*/id" ]; then + if [ "$S" -ge 3 ]; then + echo "No sound card detected after $S seconds..." + fi + if [ "$S" -lt 30 ]; then + # We have seen cards taking as much as 12s to get initialized... + sleep 1 + S=$((S+1)) + continue + else + echo "Can not do software speech synthesis... Press enter to continue anyway." + read + break + fi + fi + + # Sleep again as much, in case more cards are to come :/ + echo "Waiting for $S more seconds for any other card..." + sleep $S + + . /usr/share/alsa/utils.sh + preinit_levels all + sanify_levels all + + IDS=$(echo $BASE/card*/id) + N=$(echo $IDS | wc -w) + + case $N in 1) # Just one card, can not be wrong echo $(strip $IDS) > /var/run/espeakup.card @@ -51,5 +76,8 @@ done echo "$CARD" > /var/run/espeakup.card ALSA_CARD=$(cat /sys/class/sound/card$CARD/id) /usr/bin/espeakup -V en >> /var/log/espeakup.log 2>&1 - esac + esac + + break + done fi