[BRLTTY] How-to properly configure brltty shipped in a Linux distribution?

Didier Spaier didier at slint.fr
Thu Jan 14 16:44:36 EST 2016


Didier

Hi developers,

I will ship brltty version 5.3.1 in the upcoming Slint version 14.2

Unfortunately I am neither a user nor a developer.

I tried to understand the output of ./configure --help but that just
increased my perplexity.

So, please give me advises for a proper configuration, i.e. one that
would be able to deal with all kinds of hardware, connection mode (usb,
Bluetooth, serial line), languages, both in the installer and in the
installed system.

I attach what I have at present:
_ the script that builds the regular package
_ the script that builds the package in the installer (is it too much
  stripped down?)
_ the script that manage the daemon in the installed system (BSD style
  ala Slackware)
_ the script that manage the daemon
_ the script that modify /etc/rc.d/rc.S to possibly start the daemon

In the installer I somehow mimic what is (or at least was some time
ago) done in Debian. If a brltty setting is found in the command line I
record it in brltty.conf with bp2cf.

In the installed system, at startup /etc/rc.d/rc.S starts the daemon
through "/etc/rc.d/rc.brltty start" if rc.brltty is executable.

What configure options would you advise me to use, both in the installer
and the installed system? What other enhancements should I bring,
especially to deal with connections with serial line or Blueetooth (I
have no idea if they can work as is by lack of testers).

Of course if there are already Slackware users following this list who
use a Braille display connected through Bluetooth or a serial line I
will be more that happy to provide binary packages for test.

Thanks for your time,

Didier
-------------- next part --------------
#!/bin/sh
#
# Copyright 2010, 2012, 2013  Patrick J. Volkerding, Sebeka, Minnesota, USA
# Copyright 2014 Didier Spaier, Paris, France
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Set initial variables:
ROOT=`dirname "$0"`
ROOT=`( cd "$ROOT" && cd ../.. && pwd )`
PRGNAM=brltty
TAG="_slint"
CWD=`pwd`
TMP=$(mktemp -d) || exit 1
PKG=$TMP/package-$PRGNAM
DEST=$ROOT/packages
VERSION=5.3.1
BUILD=${BUILD:-1}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) export ARCH=i486 ;;
    arm*) export ARCH=arm ;;
    # Unless $ARCH is already set, use uname -m for all other archs:
       *) export ARCH=$( uname -m ) ;;
  esac
fi
if [ "$ARCH" = "x86_64" ]; then
  LIBDIRSUFFIX="64"
else
  LIBDIRSUFFIX=""
fi
PKGNAME=${PRGNAM}-${VERSION}-${ARCH}-${BUILD}$TAG
rm -rf $PKG
mkdir -p $PKG
cd $TMP
rm -rf brltty-$VERSION
tar xvf $CWD/brltty-$VERSION.tar.?z* || exit 1
cd brltty-$VERSION
# Is this patch really needed? Ask Pat.
zcat $CWD/brltty.brlapi.pyx.diff.gz | patch -p1 --verbose || exit 1

chown -R root:root .
find . -perm 775 -exec chmod 755 {} \;
find . -perm 700 -exec chmod 755 {} \;
find . -perm 744 -exec chmod 755 {} \;
find . -perm 664 -exec chmod 644 {} \;
find . -perm 600 -exec chmod 644 {} \;
./configure \
  --prefix=/usr \
  --bindir=/bin \
  --sbindir=/sbin \
  --libdir=/lib${LIBDIRSUFFIX} \
  --infodir=/usr/info \
  --mandir=/usr/man \
  --sysconfdir=/etc \
  --localstatedir=/var \
  --disable-java-bindings \
  --build=$ARCH-slackware-linux
make -j2 || exit 1
make install INSTALL_ROOT=$PKG || exit 1
chmod 755 $PKG/bin/* $PKG/lib${LIBDIRSUFFIX}/brltty/*

( cd $PKG
  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)
mkdir -p $PKG/usr/sbin
cp Bootdisks/bp2cf $PKG/usr/sbin
chmod 755 $PKG/usr/sbin/bp2cf
chown root:root $PKG/usr/sbin/bp2cf
mkdir -p $PKG/etc/rc.d
cp -a Documents/brltty.conf $PKG/etc/brltty.conf.new
cp -a $CWD/rc.brltty $PKG/etc/rc.d/rc.brltty.new
chmod 755 $PKG/etc/rc.d/rc.brltty.new
chown root:root $PKG/etc/rc.d/rc.brltty.new
# We will ship the udev rules that start brltty with a proper driver
# when a terminal connected via USB is plugged-in.
mkdir -p $PKG/lib/udev/rules.d
cat Autostart/Udev/udev.rules > $PKG/lib/udev/rules.d/40-usb-brltty.rules
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh

cd $PKG
makepkg -l y -c n $DEST/${PKGNAME}.txz
chown -R `stat -c %U:%G ${ROOT}` $DEST/${PKGNAME}.txz
rm -r $TMP
-------------- next part --------------
#!/bin/sh
#
# Copyright 2010, 2012, 2013  Patrick J. Volkerding, Sebeka, Minnesota, USA
# Copyright 2014 Didier Spaier, Paris, France
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Set initial variables:
ROOT=`dirname "$0"`
ROOT=`( cd "$ROOT" && cd ../.. && pwd )`
PRGNAM=brltty_for_installer
TAG="_slint"
CWD=`pwd`
TMP=$(mktemp -d) || exit 1
PKG=$TMP/package-$PRGNAM
VERSION=5.3.1
BUILD=${BUILD:-1}
DEST=$ROOT/packages
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) export ARCH=i486 ;;
    arm*) export ARCH=arm ;;
    # Unless $ARCH is already set, use uname -m for all other archs:
       *) export ARCH=$( uname -m ) ;;
  esac
fi
if [ "$ARCH" = "x86_64" ]; then
  LIBDIRSUFFIX="64"
else
  LIBDIRSUFFIX=""
fi
PKGNAME=${PRGNAM}-${VERSION}-${ARCH}-${BUILD}$TAG
rm -rf $PKG
mkdir -p $PKG
cd $TMP
rm -rf brltty-$VERSION
tar xvf $CWD/brltty-$VERSION.tar.?z* || exit 1
cd brltty-$VERSION

chown -R root:root .
find . -perm 775 -exec chmod 755 {} \;
find . -perm 700 -exec chmod 755 {} \;
find . -perm 744 -exec chmod 755 {} \;
find . -perm 664 -exec chmod 644 {} \;
find . -perm 600 -exec chmod 644 {} \;
./configure \
  --prefix=/usr \
  --bindir=/bin \
  --sbindir=/sbin \
  --libdir=/lib${LIBDIRSUFFIX} \
  --infodir=/usr/info \
  --mandir=/usr/man \
  --sysconfdir=/etc \
  --localstatedir=/var \
  --disable-java-bindings \
  --disable-api \
  --disable-lisp-bindings \
  --disable-ocaml-bindings \
  --disable-python-bindings \
  --disable-tcl-bindings \
  --disable-x \
  --disable-contracted-braille \
  --disable-gpm \
  --disable-speech-support \
  --build=$ARCH-slackware-linux
make -j2 || exit 1
make install INSTALL_ROOT=$PKG || exit 1
chmod 755 $PKG/bin/* $PKG/lib${LIBDIRSUFFIX}/brltty/*

( cd $PKG
  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  rm /usr/man/man1/*api*
)
# bp2cf comes handy to customize the config file. This one comes from git
# as of 201412 because the version in the source tarball is not adapted
# to the new format of the config file, hence doesn't work.
mkdir -p $PKG/usr/sbin
cp Bootdisks/bp2cf $PKG/usr/sbin
chmod 755 $PKG/usr/sbin/bp2cf
chown root:root $PKG/usr/sbin/bp2cf
mkdir -p $PKG/etc/rc.d
cp -a Documents/brltty.conf $PKG/etc/brltty.conf.new
cp -a $CWD/rc.brltty $PKG/etc/rc.d/rc.brltty.new
chmod 755 $PKG/etc/rc.d/rc.brltty.new
chown root:root $PKG/etc/rc.d/rc.brltty.new
# We will ship the udev rules that start brltty with a proper driver
# when a terminal connected via USB is plugged-in.
mkdir -p $PKG/lib/udev/rules.d
cat Autostart/Udev/udev.rules > $PKG/lib/udev/rules.d/40-usb-brltty.rules
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh

cd $PKG
makepkg -l y -c n $DEST/${PKGNAME}.txz
chown -R `stat -c %U:%G ${ROOT}` $DEST/${PKGNAME}.txz
rm -r $TMP
-------------- next part --------------
A non-text attachment was scrubbed...
Name: doinst.sh
Type: application/x-shellscript
Size: 690 bytes
Desc: not available
URL: <http://mielke.cc/pipermail/brltty/attachments/20160114/d2c0ea5e/attachment.bin>
-------------- next part --------------
#!/bin/sh
#
# Start/stop brltty
#
brltty_start() {
  if [ ! "`ps -C brltty --noheaders|wc -l`" = "0" ]; then
    echo "brltty is already started."
    brltty_status
    exit
  fi
  if [ -x /bin/brltty ]; then
    echo "Starting brltty daemon: /bin/brltty "
    /bin/brltty
  fi
}
brltty_stop() {
  NBPROC="`ps -C brltty --noheaders|wc -l`"
  if [  "$NBPROC" = "1" ]; then
    echo "Stopping brltty..."
    PID="`ps -C brltty --noheaders -o pid`"
    kill $PID
  elif [ "$NBPROC" = "0" ]; then    
    echo "brltty is not started."
  else
    echo "I can't stop brltty, several daemons are running:"
    brltty_status
  fi
}
brltty_status () {
  NBPROC="`ps -C brltty --noheaders|wc -l`"
  if [ "$NBPROC" = "0" ]; then
    echo "No active brltty daemon." 
  elif [ "$NBPROC" = "1" ]; then
    echo "A brltty daemon is running, PID: `ps -C brltty --no-headers -o pid`"
  else
    ps -C brltty -o pid,args
fi
}
case "$1" in
'start')
  brltty_start
  ;;
'stop')
  brltty_stop
  ;;
'restart')
  brltty_stop
  sleep 3
  brltty_start
  ;;
'status')
  brltty_status
  ;;
*)
  echo "usage $0 restart|start|status|stop|"
esac 


More information about the BRLTTY mailing list