/usr/sbin/talkwith is in speakup-tools 1:0.0~git20121016.1-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | #!/bin/sh
#
# talkwith -- switches speakup synthesizers on the fly
#
# Copyright (c) 2009 by the Speakup Team
# Copyright (c) 2008, 2009 by Charles Hallenbeck
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Requirements: Linux speakup 3.1.0 or later
#
# To install, copy this script to a directory on the execution path
# e.g. /usr/sbin, or /usr/local/sbin.
# This script should be run as root.
# be sure we are root
if [ $(id -ru) -gt "0" ]; then
echo "$(basename $0) must be run as root."
exit
fi
# Define some variables
SPEAKUPDIR="/sys/accessibility/speakup"
# make sure speakup is loaded
if [ ! -d $SPEAKUPDIR ]; then
echo "Speakup does not seem to be installed."
exit
fi
# Check the command line for options
if [ "$1" = "" ]; then
echo
echo "Usage: $(basename $0) <synth> <daemon> [options]"
echo
echo "synth - any synthesizer supported by speakup"
echo
echo "daemon - for the 'soft' synthesizer, this should be either"
echo "spd for speechd-up, or espeakup to run espeakup."
echo "For the other synthesizers, this is ignored."
echo
echo "options - for a software synthesizer, the rest of the command line"
echo "is passed on to the daemon; otherwise it is ignored."
echo
echo "Talkwith does not install or remove modules, so make sure any"
echo "required driver modules are installed or built into the kernel"
echo "before running talkwith."
echo
exit
fi
NEWMOD=$1
shift
# for backward compatibility
if [ "$NEWMOD" = "spd" -o "$NEWMOD" = "espeakup" ]; then
DAEMON=$NEWMOD
NEWMOD=soft
fi
if [ "$NEWMOD" = "soft" ]; then
if which espeakup > /dev/null 2>&1 ; then
HAVE_ESPEAKUP=1
fi
if which speechd-up > /dev/null 2>&1 ; then
HAVE_SPD=1
fi
if [ -z "$HAVE_ESPEAKUP" -a -z "$HAVE_SPD" ]; then
echo "no software speech synthesizers are installed."
exit
fi
if [ -z "$DAEMON" ]; then
DAEMON=$1
shift
fi
if [ -z "$DAEMON" -a ! -z "$HAVE_ESPEAKUP" ]; then
DAEMON="espeakup"
elif [ -z "$DAEMON" -a ! -z "$HAVE_SPD" ]; then
DAEMON="spd"
fi
if [ "$DAEMON" = "espeakup" -a -z "$HAVE_ESPEAKUP" ]; then
echo "espeakup does not appear to be available."
exit
elif [ "$DAEMON" = "spd" -a -z "$HAVE_SPD" ]; then
echo "speechd-up does not appear to be available."
exit
fi
fi
OLDMOD="$(cat $SPEAKUPDIR/synth)"
echo "$NEWMOD" > $SPEAKUPDIR/synth 2> /dev/null
if [ $? != 0 ]; then
echo "Unable to switch to the $NEWMOD synthesizer."
echo "This means that the driver is not built in, the module"
echo "is not loaded, or $NEWMOD is not a valid synthesizer."
exit 1
fi
if [ "$OLDMOD" = "soft" ]; then
if [ -f /var/run/espeakup.pid ]; then
kill $(cat /var/run/espeakup.pid) 2> /dev/null
if [ -f /var/run/espeakup.pid ]; then
rm -f /var/run/espeakup.pid
fi
fi
if [ -f /var/run/speechd-up.pid ]; then
kill $(cat /var/run/speechd-up.pid) 2> /dev/null
if [ -f /var/run/speechd-up.pid ]; then
rm -f /var/run/speechd-up.pid
fi
fi
sleep 2
fi
if [ "$NEWMOD" = "none" ]; then
exit
elif [ "$NEWMOD" = "soft" ]; then
if [ "$DAEMON" = "espeakup" ]; then
espeakup $*
elif [ "$DAEMON" = "spd" ]; then
nice -n 5 speechd-up $*
fi
fi
|