Hello,

root[/home/didier]# lspci -knn|grep -A2 Audio
00:1b.0 Audio device [0403]: Intel Corporation 6 Series/C200 Series Chipset 
Family High Definition Audio Controller [8086:1c20] (rev 04)
        Subsystem: Lenovo 6 Series/C200 Series Chipset Family High Definition 
Audio Controller [17aa:21cf]
        Kernel driver in use: snd_hda_intel
        Kernel modules: snd_hda_intel

Weekly image ISO: debian-testing-amd64-DVD-1.iso (dated 14 June IIRC).

I would expect that /lib/debian-installer-startup.d/S38espeakup detects
one sound card, so just starts espeakup.

Instead, it is stuck in the 30 seconds loop then give up.

I attach S38espeakup and the Slint script probe_sound_cars with the same
purpose but that does detect the card.

However I don't know if the difference comes from the script or on how
/sys is populated or from any other reason.

I will provide additional information upon request.

Best regards,

Didier

PS additionally the 'sleep' from BusyBox doesn't accept a 0.1 argument, but 
that's minor.
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 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
                        /usr/bin/espeakup -V en > /var/log/espeakup.log 2>&1
                        ;;
                *)
                        # Several cards, make the user choose
                        CARD=none
                        while [ "$CARD" = none ]
                        do
                                for ID in $IDS
                                do
                                        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
                                        done
                                        pid=$(cat /var/run/espeakup.pid)
                                        answer=none
                                        echo Please type enter to use this 
sound board
                                        read -t 5 answer
                                        kill $pid
                                        while [ -r /var/run/espeakup.pid ]
                                        do
                                                sleep 0.1
                                        done
                                        if [ "$answer" != none ]
                                        then
                                                CARD=$i
                                                break
                                        fi
                                done
                        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

                break
        done
fi
BASE=/sys/class/sound

if [ ! -d /sys/class/sound ]; then
        touch /tmp/noespeakup
        exit
fi

strip () {
        cardid=${1#$BASE/card}
        echo ${cardid%/id}
}

if ! grep -q speakup /proc/cmdline; then
        # Give drivers some time to detect boards :/
        sleep 2
        IDS=$(echo $BASE/card*/id)
        N=$(echo $IDS | wc -w)
        case $N in
                0)
                        touch /tmp/noespeakup
                        exit
                        ;;
                1)
                        # Just one card, can not be wrong
                        /usr/bin/espeakup -V $(cat /tmp/speech) > 
/tmp/espeakup.log 2>&1
                        echo "/usr/bin/espeakup -V $(cat /tmp/speech)" >> 
/tmp/report
                        ;;
                *)
                        # Several cards, make the user choose
                        CARD=none
                        while [ "$CARD" = none ]; do
                                for ID in $IDS; do
                                        i=$(strip $ID)
                                        ALSA_CARD=$(cat 
/sys/class/sound/card$i/id)
                                        ALSA_CARD=$ALSA_CARD /usr/bin/espeakup 
-V $(cat /tmp/speech) >> /tmp/espeakup.log 2>&1
                                        echo "ALSA_CARD=$ALSA_CARD 
/usr/bin/espeakup -V $(cat /tmp/speech)" >> /tmp/report
                                        echo $ALSA_CARD >/tmp/alsacard
                                        echo "defaults.pcm.card $i" 
>/tmp/asound.conf
                                        echo "defaults.ctl.card $i" 
>>/tmp/asound.conf
                                        answer=none
                                        echo "Please type enter to use the 
sound board $ALSA_CARD"
                                        echo
                                        read -t 7 dummy
                                        answer=$?
                                        if [ $answer -eq 0 ]; then
                                                CARD=$i
                                                echo "Card chosen: $i" >> 
/tmp/cards 
                                                break
                                        fi
                                        PID=$(ps -C espeakup --noheaders -o pid)
                                        kill -s 9 $PID
                                        sleep 1
                                done
                                if [ "$CARD" = none ]; then
                                        echo "No card was selected. Speech will 
not be provided."
                                        touch /tmp/noespeakup
                                        rm /tmp/alsacard
                                        rm /tmp/asound.conf
                                        echo "No sound card selected" >> 
/tmp/report
                                        exit
                                fi
                        done
        esac
fi

Reply via email to