Package: release.debian.org
Severity: normal
Tags: stretch
User: [email protected]
Usertags: pu
X-Debbugs-Cc: [email protected]

Hello,

Several blind users have reported that the Debian Installer speech
synthesis was not working on their computer, thus making it unusable
for them. It happens that this is due to odd numbering of sound cards
by ALSA on those computers. We have fixed this in buster, it has been
successfully tested on the reported systems, so I propose to include the
fix in Stretch too, I have attached the diff. I'm also Cc-ing Kibi for
his opinion on this.

Samuel

-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 
'testing-debug'), (500, 'stable-debug'), (500, 'oldoldstable'), (500, 
'buildd-unstable'), (500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1, 
'experimental-debug'), (1, 'buildd-experimental'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.14.0 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), 
LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
diff --git a/debian/changelog b/debian/changelog
index a908870..7a19a8d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+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.
+  * 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

Reply via email to