-if checkbootparam swspeak ; then
- if [ -d /proc/speakup/ ] ; then
- einfo "Bootoption swspeak found. Kernel supports speakup." ; eend 0
- eindent
- if [ -x /etc/init.d/speech-dispatcher ] ; then
- einfo "Starting speech-dispatcher."
- /etc/init.d/speech-dispatcher start 1>>DEBUG ; eend $?
- einfo "Activating sftsyn in Kernel."
- echo sftsyn >/proc/speakup/synth_name ; eend $?
- einfo "Just run swspeak if you want to use software synthesizer via speakup."
- flite -o play -t "Finished activating software speakup. Just run swspeak when booting finished."
- else
- eerror "speech-dispatcher not available. swspeak will not work without it." ; eend 1
- flite -o play -t "speech-dispatcher not available. speakup will not work without it."
+ if checkbootparam swspeak ; then
+ einfo "Bootoption swspeak found."
+
+ if [ ! -d /proc/speakup/ ] && ! grep -q speakup_soft /proc/modules ; then
+ ewarn "Kernel does not support software speakup - trying to load kernel module:" ; eend 0
+ eindent
+ einfo "Loading speakup_soft"
+ if modprobe speakup_soft ; then
+ eend 0
+ else
+ flitewrapper "Fatal error setting up software speakup"
+ eend 1
+ return 1
+ fi
+ eoutdent
+ fi
+
+ if [ -d /proc/speakup/ ] || grep -q speakup_soft /proc/modules ; then
+ einfo "Kernel supports speakup." ; eend 0
+ eindent
+ einfo "Just run swspeak if you want to use software synthesizer via speakup."
+ flitewrapper "Finished activating software speakup. Just run swspeak when booting finished."
+ eoutdent
+ else
+ eerror "Kernel does not seem to support speakup. Skipping swspeak." ; eend 1
+ flitewrapper "Kernel does not seem to support speakup. Sorry."
+ fi
+ fi
+}
+# }}}
+
+# {{{ support hardware synthesizer via speakup
+config_hwspeak(){
+ if checkbootparam hwspeak ; then
+ einfo "Bootoption hwspeak found."
+
+ if [ ! -d /proc/speakup/ ] && ! grep -q speakup /proc/modules ; then
+ ewarn" Kernel does not support hardware speakup - trying to load kernel modules:" ; eend 0
+ eindent
+ for module in $(find "/lib/modules/${KERNEL}/extra/speakup/" -name \*.ko | \
+ sed 's#.*speakup/##g ; s#.ko$##g' | \
+ grep -ve speakup_soft -ve speakup_dummy | sort -u) ; do
+ einfo "Trying to load $module"
+ modprobe $module
+ eend $?
+ done
+ eoutdent
+ fi
+
+ if [ -d /proc/speakup/ ] || grep -q speakup /proc/modules ; then
+ einfo "Kernel should support speakup now." ; eend 0
+ flitewrapper "Kernel should support speakup now."
+ else
+ eerror "Kernel or hardware do not seem to support speakup. Skipping hwspeak." ; eend 1
+ flitewrapper "Kernel or hardware do not seem to support speakup. Sorry."
+ fi