Blame SOURCES/brltty-5.6-add-dracut-support.patch

ce24cc
diff --git a/Headers/datafile.h b/Headers/datafile.h
ce24cc
index f22457e..eec692c 100644
ce24cc
--- a/Headers/datafile.h
ce24cc
+++ b/Headers/datafile.h
ce24cc
@@ -43,6 +43,7 @@ typedef enum {
ce24cc
 
ce24cc
 typedef struct {
ce24cc
   DataOperandsProcessor *processOperands;
ce24cc
+  void (*logFileName) (const char *name, void *data);
ce24cc
   void *data;
ce24cc
   unsigned char options;
ce24cc
 } DataFileParameters;
ce24cc
diff --git a/Initramfs/Dracut/Makefile.in b/Initramfs/Dracut/Makefile.in
ce24cc
new file mode 100644
ce24cc
index 0000000..8a7f6de
ce24cc
--- /dev/null
ce24cc
+++ b/Initramfs/Dracut/Makefile.in
ce24cc
@@ -0,0 +1,34 @@
ce24cc
+MODULE_NAME = 99brltty
ce24cc
+MODULES_DIRECTORY = /usr/lib/dracut/modules.d
ce24cc
+MODULE_DIRECTORY = $(INSTALL_ROOT)$(MODULES_DIRECTORY)/$(MODULE_NAME)
ce24cc
+
ce24cc
+install: install-module install-documentation install-configuration-files
ce24cc
+
ce24cc
+install-module: install-module-directory
ce24cc
+	for file in *.sh; \
ce24cc
+	do $(INSTALL_SCRIPT) $$file $(MODULE_DIRECTORY); \
ce24cc
+	done
ce24cc
+
ce24cc
+install-documentation: install-module-directory
ce24cc
+	$(INSTALL_DATA) README $(MODULE_DIRECTORY)
ce24cc
+
ce24cc
+install-module-directory:
ce24cc
+	$(INSTALL_DIRECTORY) $(MODULE_DIRECTORY)
ce24cc
+
ce24cc
+OPTIONS_FILE = cmdline
ce24cc
+CONFIGURATION_FILE = dracut.conf
ce24cc
+INITRAMFS_SUBDIRECTORY = Initramfs
ce24cc
+INITRAMFS_DIRECTORY = $(TABLES_DIRECTORY)/$(INITRAMFS_SUBDIRECTORY)
ce24cc
+INSTALL_INITRAMFS_DIRECTORY = $(INSTALL_ROOT)$(INITRAMFS_DIRECTORY)
ce24cc
+
ce24cc
+install-initramfs-directory:
ce24cc
+	$(INSTALL_DIRECTORY) $(INSTALL_INITRAMFS_DIRECTORY)
ce24cc
+
ce24cc
+install-configuration-files: install-initramfs-directory
ce24cc
+	$(INSTALL_DATA) $(OPTIONS_FILE) $(INSTALL_INITRAMFS_DIRECTORY)
ce24cc
+	$(INSTALL_DATA) $(CONFIGURATION_FILE) $(INSTALL_INITRAMFS_DIRECTORY)
ce24cc
+	sed -e '/^ *BRLTTY_DRACUT_LOCALE *= *"/s/".*"/"${LANG}"/' -i $(INSTALL_INITRAMFS_DIRECTORY)/$(CONFIGURATION_FILE)
ce24cc
+
ce24cc
+uninstall:
ce24cc
+	-rm -f -r  $(MODULE_DIRECTORY)
ce24cc
+
ce24cc
diff --git a/Initramfs/Dracut/README b/Initramfs/Dracut/README
ce24cc
new file mode 100644
ce24cc
index 0000000..ccf6baa
ce24cc
--- /dev/null
ce24cc
+++ b/Initramfs/Dracut/README
ce24cc
@@ -0,0 +1,215 @@
ce24cc
+Braille Support for Dracut
ce24cc
+==========================
ce24cc
+
ce24cc
+This module implements braille accessibility within the initramfs (initial
ce24cc
+ramdisk file system). If BRLTTY is installed (``/usr/bin/brltty`` exists) then
ce24cc
+it is added to the image. The braille drivers, text tables, attributes tables,
ce24cc
+contraction tables, keyboard tables, speech drivers, and preferences file
ce24cc
+configured via ``/etc/brltty.conf`` are included. Local customizations within
ce24cc
+``/etc/xdg/brltty/`` are also included.
ce24cc
+
ce24cc
+BRLTTY is started as early as possible by the initramfs so that braille
ce24cc
+accessibility will be active when (should the need arise) control is
ce24cc
+transferred to the emergency shell due to a problem preparing the root file
ce24cc
+system. Additionally, braille accessibility is active at any of the specifiable
ce24cc
+initramfs breakpoints (see the ``rd.break`` kernel parameter) except for the
ce24cc
+one named ``cmdline`` because it occurs earlier than the point at which BRLTTY
ce24cc
+is started.
ce24cc
+
ce24cc
+The braille driver can start immediately if either serial or USB communication
ce24cc
+is being used. If Bluetooth communication is being used then the braille driver
ce24cc
+won't start until the ``initqueue`` phase because the Systemd service manager
ce24cc
+isn't available until then.
ce24cc
+
ce24cc
+Bluetooth support within the initramfs is disabled by default because it's
ce24cc
+insecure. The reason for this is that the link keys for those devices that have
ce24cc
+already been paired on the full system are copied into the initramfs image so
ce24cc
+that repairing won't be necessary. If you absolutely must use Bluetooth
ce24cc
+communication, or if you just want to and this issue is of no concern to you,
ce24cc
+then enable the ``BRLTTY_DRACUT_BLUETOOTH_SUPPORT`` option within the file
ce24cc
+``dracut.conf`` (which is in ``/etc/brltty/Initramfs/``).
ce24cc
+
ce24cc
+Environment Variables
ce24cc
+---------------------
ce24cc
+
ce24cc
+A number of environment variables may be used to influence how BRLTTY is
ce24cc
+installed into the initramfs image. Their names all begin with the
ce24cc
+``BRLTTY_DRACUT_`` prefix. In addition to exporting them from the current
ce24cc
+environment, they may be defined within the optional file ``dracut.conf``
ce24cc
+(which is in ``/etc/brltty/Initramfs/``). Within this file:
ce24cc
+
ce24cc
+* Blank lines are ignored.
ce24cc
+* Lines that start with a hash [``#``] are comments.
ce24cc
+* All other lines should be simple shell-style assignments. For example::
ce24cc
+
ce24cc
+    NAME="string"
ce24cc
+
ce24cc
+The following environment variables are supported:
ce24cc
+
ce24cc
+BRLTTY_DRACUT_LOCALE
ce24cc
+  The preferred locale (used to determine the default text and contraction
ce24cc
+  tables). For example::
ce24cc
+
ce24cc
+    BRLTTY_DRACUT_LOCALE=cs_CZ.UTF-8
ce24cc
+
ce24cc
+  If needed, i.e. if the text and contraction tables haven't both been
ce24cc
+  configured via ``/etc/brltty.conf``, this information must be explicitly set
ce24cc
+  because it can't be determined from the system configuration when building
ce24cc
+  the image (see `<https://bugzilla.redhat.com/show_bug.cgi?id=1584036>`_).
ce24cc
+
ce24cc
+BRLTTY_DRACUT_BRAILLE_DRIVERS
ce24cc
+  A space-separated list of additional braille drivers to include. For
ce24cc
+  example::
ce24cc
+
ce24cc
+    BRLTTY_DRACUT_BRAILLE_DRIVERS="pm eu"
ce24cc
+
ce24cc
+BRLTTY_DRACUT_BLUETOOTH_SUPPORT
ce24cc
+  Whether or not Bluetooth support should be included within the initramfs. For
ce24cc
+  example::
ce24cc
+
ce24cc
+    BRLTTY_DRACUT_BLUETOOTH_SUPPORT=no
ce24cc
+
ce24cc
+  Set this variable to ``yes`` if communication with your braille device is via
ce24cc
+  Bluetooth. Note that this option is insecure because the link keys for all of
ce24cc
+  your paired Bluetooth devices will be stored within the initramfs image.
ce24cc
+
ce24cc
+BRLTTY_DRACUT_TEXT_TABLES
ce24cc
+  A space-separated list of additional text tables to include. For example::
ce24cc
+
ce24cc
+    BRLTTY_DRACUT_TEXT_TABLES="de fr"
ce24cc
+
ce24cc
+BRLTTY_DRACUT_ATTRIBUTES_TABLES
ce24cc
+  A space-separated list of additional attributes tables to include. For
ce24cc
+  example::
ce24cc
+
ce24cc
+    BRLTTY_DRACUT_ATTRIBUTES_TABLES="upper_lower left_right"
ce24cc
+
ce24cc
+BRLTTY_DRACUT_CONTRACTION_TABLES
ce24cc
+  A space-separated list of additional contraction tables to include. For
ce24cc
+  example::
ce24cc
+
ce24cc
+    BRLTTY_DRACUT_CONTRACTION_TABLES="de-kurzschrift fr-abrege"
ce24cc
+
ce24cc
+BRLTTY_DRACUT_KEYBOARD_TABLES
ce24cc
+  A space-separated list of additional keyboard tables to include. For
ce24cc
+  example::
ce24cc
+
ce24cc
+    BRLTTY_DRACUT_KEYBOARD_TABLES="keypad desktop"
ce24cc
+
ce24cc
+BRLTTY_DRACUT_SPEECH_DRIVERS
ce24cc
+  A space-separated list of additional speech drivers to include. For example::
ce24cc
+
ce24cc
+    BRLTTY_DRACUT_SPEECH_DRIVERS="es fl"
ce24cc
+
ce24cc
+Kernel Command Line Parameters
ce24cc
+------------------------------
ce24cc
+
ce24cc
+This module interprets kernel command line parameters that begin with the
ce24cc
+``rd.brltty.`` prefix. Explicit values for these parameters can, of course, be
ce24cc
+specified on the kernel command line (e.g. within ``grub.cfg`` or within
ce24cc
+``/etc/default/grub``). In addition, default values for them can be defined
ce24cc
+within the optional file ``cmdline`` (which is in ``/etc/brltty/Initramfs/``).
ce24cc
+
ce24cc
+The order of precedence, from lowest to highest, for a value is:
ce24cc
+
ce24cc
+* BRLTTY built-in default
ce24cc
+* ``/etc/brltty.conf``
ce24cc
+* initramfs override
ce24cc
+* ``/etc/brltty/Initramfs/cmdline``
ce24cc
+* kernel command line
ce24cc
+
ce24cc
+Blank lines are ignored. A hash [``#``] anywhere on a line begins a comment
ce24cc
+which continues till the end of that line - only those characters before it are
ce24cc
+significant. Any number of space-separated options may be specified on a line.
ce24cc
+The syntax for an option is ``name=value`` (without the ``rd.brltty.`` prefix).
ce24cc
+The ``=value`` part is optional - if there's no ``=`` then the value is
ce24cc
+``yes``.
ce24cc
+
ce24cc
+Disabling BRLTTY
ce24cc
+````````````````
ce24cc
+
ce24cc
+Given that BRLTTY is a rather complex application, there are a number of kernel
ce24cc
+parameters that can be used to selectively disable a number of its components.
ce24cc
+In all cases, if any of these parameters isn't specified then it defaults to
ce24cc
+``1`` (enabled). They are:
ce24cc
+
ce24cc
+  =========================  =========================================
ce24cc
+  Kernel Parameter           Effect
ce24cc
+  -------------------------  -----------------------------------------
ce24cc
+  ``rd.brltty=0``            Completely disable BRLTTY.
ce24cc
+  ``rd.brltty.bluetooth=0``  Disable Bluetooth support.
ce24cc
+  ``rd.brltty.sound=0``      Disable speech drivers and sound support.
ce24cc
+  ``rd.brltty.pulse=0``      Disable the Pulse Audio server.
ce24cc
+  ``rd.brltty.speechd=0``    Disable the Speech Dispatcher server.
ce24cc
+  =========================  =========================================
ce24cc
+
ce24cc
+Specifying BRLTTY options
ce24cc
+`````````````````````````
ce24cc
+
ce24cc
+All of BRLTTY's options that can be specified via environment variables (see
ce24cc
+``man brltty`` for the full list) can be specified via kernel parameters. For
ce24cc
+example, the kernel parameter ``rd.brltty.braille_driver=vo`` is mapped to the
ce24cc
+environment variable assignment ``BRLTTY_BRAILLE_DRIVER=vo``. Some of the more
ce24cc
+interesting ones are:
ce24cc
+
ce24cc
+  ================================  ===============================
ce24cc
+  Kernel Parameter                  Default Value
ce24cc
+  --------------------------------  -------------------------------
ce24cc
+  ``rd.brltty.braille_driver``      setting in ``/etc/brltty.conf``
ce24cc
+  ``rd.brltty.braille_parameters``  setting in ``/etc/brltty.conf``
ce24cc
+  ``rd.brltty.braille_device``      setting in ``/etc/brltty.conf``
ce24cc
+  ``rd.brltty.text_table``          setting in ``/etc/brltty.conf``
ce24cc
+  ``rd.brltty.attributes_table``    setting in ``/etc/brltty.conf``
ce24cc
+  ``rd.brltty.contraction_table``   setting in ``/etc/brltty.conf``
ce24cc
+  ``rd.brltty.keyboard_table``      setting in ``/etc/brltty.conf``
ce24cc
+  ``rd.brltty.speech_driver``       setting in ``/etc/brltty.conf``
ce24cc
+  ``rd.brltty.speech_parameters``   setting in ``/etc/brltty.conf``
ce24cc
+  ``rd.brltty.log_file``            ``/run/initramfs/brltty.log``
ce24cc
+  ``rd.brltty.log_level``           setting in ``/etc/brltty.conf``
ce24cc
+  ================================  ===============================
ce24cc
+
ce24cc
+Speech Drivers
ce24cc
+--------------
ce24cc
+
ce24cc
+Since speech drivers, by their very nature, require sound:
ce24cc
+
ce24cc
+* None of them can start until the ``initqueue`` hook has been executed.
ce24cc
+
ce24cc
+* None of them can start if sound has been disabled (via the rd.brltty.sound=0
ce24cc
+  kernel parameter).
ce24cc
+
ce24cc
+Speech defaults to being off even if a speech driver has been configured via
ce24cc
+``/etc/brltty.conf``. This is because your preferred speech driver may not work
ce24cc
+all that well, or may even cause problems, when used within the more primitive
ce24cc
+initramfs environment. If you'd like to use speech then you need to explicitly
ce24cc
+set the driver. While you can do so via the ``rd.brltty.speech_driver`` kernel
ce24cc
+command line parameter, the easiest way to configure a persistent setting is
ce24cc
+via the ``speech_driver`` option in ``/etc/brltty/Initramfs/cmdline``.
ce24cc
+
ce24cc
+Here's how well each of the speech drivers works:
ce24cc
+
ce24cc
+en
ce24cc
+  The ``en`` [eSpeak-NG] speech driver works.
ce24cc
+
ce24cc
+es
ce24cc
+  The ``es`` [eSpeak] speech driver works. It requires Pulse Audio, so:
ce24cc
+
ce24cc
+  * It doesn't start until the ``initqueue`` hook has been executed.
ce24cc
+
ce24cc
+  * It can't start if Pulse Audio fails to start or has been disabled (via
ce24cc
+    the rd.brltty.pulse=0 kernel parameter).
ce24cc
+
ce24cc
+fl
ce24cc
+  The ``fl`` [Festival Lite] speech driver doesn't work - it runs but doesn't
ce24cc
+  speak. This appears to be due to a bug within Festival Lite itself because
ce24cc
+  it also remains silent when tested on the full system.
ce24cc
+
ce24cc
+fv
ce24cc
+  The ``fv`` [Festival] speech driver doesn't work - it crashes. This appears
ce24cc
+  to be due to a bug within Festival itself because it also crashes when tested
ce24cc
+  on the full system.
ce24cc
+
ce24cc
+sd
ce24cc
+  The ``sd`` [Speech Dispatcher] speech driver hasn't been tested and probably
ce24cc
+  won't work.
ce24cc
+
ce24cc
diff --git a/Initramfs/Dracut/alsa-start.sh b/Initramfs/Dracut/alsa-start.sh
ce24cc
new file mode 100755
ce24cc
index 0000000..26ab4a1
ce24cc
--- /dev/null
ce24cc
+++ b/Initramfs/Dracut/alsa-start.sh
ce24cc
@@ -0,0 +1,5 @@
ce24cc
+#!/bin/bash
ce24cc
+
ce24cc
+getargbool 1 rd.brltty && getargbool 1 rd.brltty.sound && {
ce24cc
+   alsaunmute
ce24cc
+}
ce24cc
diff --git a/Initramfs/Dracut/bluetooth-start.sh b/Initramfs/Dracut/bluetooth-start.sh
ce24cc
new file mode 100755
ce24cc
index 0000000..0d574d1
ce24cc
--- /dev/null
ce24cc
+++ b/Initramfs/Dracut/bluetooth-start.sh
ce24cc
@@ -0,0 +1,7 @@
ce24cc
+#!/bin/bash
ce24cc
+
ce24cc
+getargbool 1 rd.brltty && getargbool 1 rd.brltty.bluetooth && {
ce24cc
+   systemctl -q is-active bluetooth || {
ce24cc
+      systemctl --no-block start bluetooth
ce24cc
+   }
ce24cc
+}
ce24cc
diff --git a/Initramfs/Dracut/brltty-start.sh b/Initramfs/Dracut/brltty-start.sh
ce24cc
new file mode 100755
ce24cc
index 0000000..ea51437
ce24cc
--- /dev/null
ce24cc
+++ b/Initramfs/Dracut/brltty-start.sh
ce24cc
@@ -0,0 +1,78 @@
ce24cc
+#!/bin/bash
ce24cc
+
ce24cc
+export BRLTTY_START_MESSAGE="initramfs starting"
ce24cc
+export BRLTTY_STOP_MESSAGE="initramfs finished"
ce24cc
+
ce24cc
+BRLTTY_OVERRIDE_PREFERENCE="braille-keyboard-enabled=yes"
ce24cc
+BRLTTY_OVERRIDE_PREFERENCE+=",braille-input-mode=text"
ce24cc
+export BRLTTY_OVERRIDE_PREFERENCE
ce24cc
+
ce24cc
+export BRLTTY_SCREEN_DRIVER="lx"
ce24cc
+export BRLTTY_SPEECH_DRIVER="no"
ce24cc
+
ce24cc
+export BRLTTY_WRITABLE_DIRECTORY="/run"
ce24cc
+export BRLTTY_PID_FILE="${BRLTTY_WRITABLE_DIRECTORY}/brltty.pid"
ce24cc
+export BRLTTY_LOG_FILE="${BRLTTY_WRITABLE_DIRECTORY}/initramfs/brltty.log"
ce24cc
+
ce24cc
+export BRLTTY_UPDATABLE_DIRECTORY="/etc"
ce24cc
+export BRLTTY_PREFERENCES_FILE="${BRLTTY_UPDATABLE_DIRECTORY}/brltty.prefs"
ce24cc
+
ce24cc
+brlttySetOption() {
ce24cc
+   local option="${1}"
ce24cc
+   local name="${option%%=*}"
ce24cc
+
ce24cc
+   if [ "${name}" = "${option}" ]
ce24cc
+   then
ce24cc
+      local value="yes"
ce24cc
+   else
ce24cc
+      local value="${option#*=}"
ce24cc
+   fi
ce24cc
+
ce24cc
+   [ -z "${name}" ] || {
ce24cc
+      name="${name^^?}"
ce24cc
+      export "BRLTTY_${name}=${value}"
ce24cc
+   }
ce24cc
+}
ce24cc
+
ce24cc
+brlttySetConfiguredOptions() {
ce24cc
+   local file="/etc/brltty/Initramfs/cmdline"
ce24cc
+
ce24cc
+   [ -f "${file}" ] && [ -r "${file}" ] && {
ce24cc
+      local line
ce24cc
+
ce24cc
+      while read line
ce24cc
+      do
ce24cc
+         set -- ${line%%#*}
ce24cc
+         local option
ce24cc
+
ce24cc
+         for option
ce24cc
+         do
ce24cc
+            brlttySetOption "${option}"
ce24cc
+         done
ce24cc
+      done <"${file}"
ce24cc
+   }
ce24cc
+}
ce24cc
+
ce24cc
+brlttySetExplicitOptions() {
ce24cc
+   local option
ce24cc
+
ce24cc
+   for option
ce24cc
+   do
ce24cc
+      [[ "${option}" =~ ^"rd.brltty."(.*) ]] && {
ce24cc
+         brlttySetOption "${BASH_REMATCH[1]}"
ce24cc
+      }
ce24cc
+   done
ce24cc
+}
ce24cc
+
ce24cc
+brlttySetConfiguredOptions
ce24cc
+brlttySetExplicitOptions $(getcmdline)
ce24cc
+getargbool 1 rd.brltty.sound || export BRLTTY_SPEECH_DRIVER="no"
ce24cc
+
ce24cc
+getargbool 1 rd.brltty && (
ce24cc
+   # Give the kernel a bit of time to finish creating the /dev/input/ devices
ce24cc
+   # (e.g. so that brltty can perform keyboard discovery for keyboard tables)
ce24cc
+   # without delaying the boot.
ce24cc
+
ce24cc
+   sleep 1
ce24cc
+   brltty -E +n
ce24cc
+) &
ce24cc
diff --git a/Initramfs/Dracut/brltty-stop.sh b/Initramfs/Dracut/brltty-stop.sh
ce24cc
new file mode 100755
ce24cc
index 0000000..27611ab
ce24cc
--- /dev/null
ce24cc
+++ b/Initramfs/Dracut/brltty-stop.sh
ce24cc
@@ -0,0 +1,3 @@
ce24cc
+#!/bin/bash
ce24cc
+
ce24cc
+brltty -E -C
ce24cc
diff --git a/Initramfs/Dracut/cmdline b/Initramfs/Dracut/cmdline
ce24cc
new file mode 100644
ce24cc
index 0000000..39aefd3
ce24cc
--- /dev/null
ce24cc
+++ b/Initramfs/Dracut/cmdline
ce24cc
@@ -0,0 +1,16 @@
ce24cc
+# This file is where you can specify any rd.brltty. kernel parameters that are
ce24cc
+# to be included within the initramfs image and applied as default values.
ce24cc
+
ce24cc
+# The order of precedence, from lowest to highest, for an option's value is:
ce24cc
+# * BRLTTY built-in default
ce24cc
+# * /etc/brltty.conf
ce24cc
+# * initramfs override
ce24cc
+# * this file
ce24cc
+# * kernel command line
ce24cc
+
ce24cc
+# Blank lines are ignored. A hash [#] anywhere on a line begins a comment which
ce24cc
+# continues till the end of that line - only those characters before it are
ce24cc
+# significant. Any number of space-separated options may be specified on a
ce24cc
+# line. The syntax for an option is name=value (without the rd.brltty. prefix).
ce24cc
+# The =value part is optional - if there's no = then the value is yes.
ce24cc
+
ce24cc
diff --git a/Initramfs/Dracut/dbus-start.sh b/Initramfs/Dracut/dbus-start.sh
ce24cc
new file mode 100755
ce24cc
index 0000000..fd9e210
ce24cc
--- /dev/null
ce24cc
+++ b/Initramfs/Dracut/dbus-start.sh
ce24cc
@@ -0,0 +1,7 @@
ce24cc
+#!/bin/bash
ce24cc
+
ce24cc
+getargbool 1 rd.brltty && getargbool 1 rd.brltty.bluetooth && {
ce24cc
+   systemctl -q is-active dbus || {
ce24cc
+      systemctl --no-block start dbus
ce24cc
+   }
ce24cc
+}
ce24cc
diff --git a/Initramfs/Dracut/dracut.conf b/Initramfs/Dracut/dracut.conf
ce24cc
new file mode 100644
ce24cc
index 0000000..2d03996
ce24cc
--- /dev/null
ce24cc
+++ b/Initramfs/Dracut/dracut.conf
ce24cc
@@ -0,0 +1,27 @@
ce24cc
+# The preferred locale (used to determine the default text and contraction tables).
ce24cc
+BRLTTY_DRACUT_LOCALE=""
ce24cc
+
ce24cc
+# A space-separated list of additional braille drivers to include.
ce24cc
+BRLTTY_DRACUT_BRAILLE_DRIVERS=""
ce24cc
+
ce24cc
+# Whether or not Bluetooth support should be included within the initramfs.
ce24cc
+# Set this variable to yes if communication with your braille device is via
ce24cc
+# Bluetooth. Note that this option is insecure because the link keys for all of
ce24cc
+# your paired Bluetooth devices will be stored within the initramfs image.
ce24cc
+BRLTTY_DRACUT_BLUETOOTH_SUPPORT=no
ce24cc
+
ce24cc
+# A space-separated list of additional text tables to include.
ce24cc
+BRLTTY_DRACUT_TEXT_TABLES=""
ce24cc
+
ce24cc
+# A space-separated list of additional attributes tables to include.
ce24cc
+BRLTTY_DRACUT_ATTRIBUTES_TABLES=""
ce24cc
+
ce24cc
+# A space-separated list of additional contraction tables to include.
ce24cc
+BRLTTY_DRACUT_CONTRACTION_TABLES=""
ce24cc
+
ce24cc
+# A space-separated list of additional keyboard tables to include.
ce24cc
+BRLTTY_DRACUT_KEYBOARD_TABLES=""
ce24cc
+
ce24cc
+# A space-separated list of additional speech drivers to include.
ce24cc
+BRLTTY_DRACUT_SPEECH_DRIVERS=""
ce24cc
+
ce24cc
diff --git a/Initramfs/Dracut/module-setup.sh b/Initramfs/Dracut/module-setup.sh
ce24cc
new file mode 100755
ce24cc
index 0000000..8f6e5ca
ce24cc
--- /dev/null
ce24cc
+++ b/Initramfs/Dracut/module-setup.sh
ce24cc
@@ -0,0 +1,326 @@
ce24cc
+#!/bin/bash
ce24cc
+
ce24cc
+# called by dracut
ce24cc
+check() {
ce24cc
+   require_binaries brltty brltty-lsinc || return 1
ce24cc
+   return 0
ce24cc
+}
ce24cc
+
ce24cc
+# called by dracut
ce24cc
+depends() {
ce24cc
+   return 0
ce24cc
+}
ce24cc
+
ce24cc
+# called by dracut
ce24cc
+installkernel() {
ce24cc
+   instmods pcspkr uinput
ce24cc
+   [ -d "${initdir}/etc/bluetooth" ] && instmods =drivers/bluetooth =net/bluetooth
ce24cc
+   [ -d "${initdir}/etc/alsa" ] && instmods =sound
ce24cc
+   return 0
ce24cc
+}
ce24cc
+
ce24cc
+# called by dracut
ce24cc
+install() {
ce24cc
+   brlttyImportInstallOptions
ce24cc
+   local -A includedDrivers
ce24cc
+
ce24cc
+   local BRLTTY_EXECUTABLE_PATH="/usr/bin/brltty"
ce24cc
+   inst_binary "${BRLTTY_EXECUTABLE_PATH}"
ce24cc
+   local brlttyLog="$(LC_ALL="${BRLTTY_DRACUT_LOCALE:-${LANG}}" "${BRLTTY_EXECUTABLE_PATH}" -E -v -e -ldebug 2>&1)"
ce24cc
+   
ce24cc
+   export BRLTTY_CONFIGURATION_FILE="/etc/brltty.conf"
ce24cc
+   brlttyIncludeDataFiles "${BRLTTY_CONFIGURATION_FILE}"
ce24cc
+
ce24cc
+   brlttyIncludeDataFiles $(brlttyGetProperty "including data file")
ce24cc
+   brlttyIncludeScreenDrivers lx
ce24cc
+
ce24cc
+   brlttyIncludeBrailleDrivers $(brlttyGetConfiguredDrivers braille)
ce24cc
+   brlttyIncludeBrailleDrivers ${BRLTTY_DRACUT_BRAILLE_DRIVERS}
ce24cc
+
ce24cc
+   brlttyIncludeSpeechDrivers $(brlttyGetConfiguredDrivers speech)
ce24cc
+   brlttyIncludeSpeechDrivers ${BRLTTY_DRACUT_SPEECH_DRIVERS}
ce24cc
+      
ce24cc
+   brlttyIncludeTables Text        ttb ${BRLTTY_DRACUT_TEXT_TABLES}
ce24cc
+   brlttyIncludeTables Attributes  atb ${BRLTTY_DRACUT_ATTRIBUTES_TABLES}
ce24cc
+   brlttyIncludeTables Contraction ctb ${BRLTTY_DRACUT_CONTRACTION_TABLES}
ce24cc
+   brlttyIncludeTables Keyboard    ktb ${BRLTTY_DRACUT_KEYBOARD_TABLES}
ce24cc
+
ce24cc
+   brlttyInstallPreferencesFile "/etc/brltty.prefs"
ce24cc
+   brlttyInstallDirectories "/etc/xdg/brltty"
ce24cc
+   inst_simple "/etc/brltty/Initramfs/cmdline"
ce24cc
+
ce24cc
+   if [ "${BRLTTY_DRACUT_BLUETOOTH_SUPPORT}" = "yes" ]
ce24cc
+   then
ce24cc
+      brlttyIncludeBluetoothSupport
ce24cc
+   fi
ce24cc
+
ce24cc
+   inst_hook cmdline 05 "${moddir}/brltty-start.sh"
ce24cc
+   inst_hook cleanup 95 "${moddir}/brltty-stop.sh"
ce24cc
+
ce24cc
+   dracut_need_initqueue
ce24cc
+}
ce24cc
+
ce24cc
+brlttyInstallPreferencesFile() {
ce24cc
+   local path="${1}"
ce24cc
+   local file=$(brlttyGetProperty "Preferences File")
ce24cc
+
ce24cc
+   if [ -n "${file}" ]
ce24cc
+   then
ce24cc
+      if [ "${file}" = "${file#/}" ]
ce24cc
+      then
ce24cc
+         local directory=$(brlttyGetProperty "Updatable Directory")
ce24cc
+
ce24cc
+         if [ -n "${directory}" ]
ce24cc
+         then
ce24cc
+            file="${directory}/${file}"
ce24cc
+         fi
ce24cc
+      fi
ce24cc
+
ce24cc
+      if [ -f "${file}" ]
ce24cc
+      then
ce24cc
+         inst_simple "${file}" "${path}"
ce24cc
+      fi
ce24cc
+   fi
ce24cc
+}
ce24cc
+
ce24cc
+brlttyIncludeBrailleDrivers() {
ce24cc
+   local code
ce24cc
+
ce24cc
+   for code
ce24cc
+   do
ce24cc
+      brlttyIncludeDriver b "${code}" || continue
ce24cc
+
ce24cc
+      local directory="/etc/brltty/Input/${code}"
ce24cc
+      brlttyIncludeDataFiles "${directory}/"*.ktb
ce24cc
+      inst_multiple -o "${directory}/"*.txt
ce24cc
+   done
ce24cc
+}
ce24cc
+
ce24cc
+brlttyIncludeSpeechDrivers() {
ce24cc
+   local code
ce24cc
+
ce24cc
+   for code
ce24cc
+   do
ce24cc
+      brlttyIncludeDriver s "${code}" || continue
ce24cc
+
ce24cc
+      case "${code}"
ce24cc
+      in
ce24cc
+         en)
ce24cc
+            inst_binary espeak-ng
ce24cc
+            brlttyInstallDirectories "/usr/share/espeak-ng-data"
ce24cc
+            ;;
ce24cc
+
ce24cc
+         es)
ce24cc
+            inst_binary espeak
ce24cc
+            brlttyInstallDirectories "/usr/share/espeak-data"
ce24cc
+            brlttyIncludePulseAudioSupport
ce24cc
+            ;;
ce24cc
+
ce24cc
+         fl)
ce24cc
+            inst_binary flite
ce24cc
+            ;;
ce24cc
+
ce24cc
+         fv)
ce24cc
+            inst_binary festival
ce24cc
+            brlttyInstallDirectories /etc/festival
ce24cc
+            brlttyInstallDirectories /usr/lib*/festival
ce24cc
+            brlttyInstallDirectories /usr/share/festival/lib
ce24cc
+            ;;
ce24cc
+
ce24cc
+         sd)
ce24cc
+            inst_binary speech-dispatcher
ce24cc
+            brlttyInstallDirectories /etc/speech-dispatcher
ce24cc
+            brlttyInstallDirectories /usr/lib*/speech-dispatcher
ce24cc
+            brlttyInstallDirectories /usr/lib*/speech-dispatcher-modules
ce24cc
+            brlttyInstallDirectories /usr/share/speech-dispatcher
ce24cc
+            brlttyInstallDirectories /usr/share/sounds/speech-dispatcher
ce24cc
+            brlttyInstallSystemdUnits speech-dispatcherd.service
ce24cc
+            inst_hook initqueue 98 "${moddir}/speechd-start.sh"
ce24cc
+            ;;
ce24cc
+      esac
ce24cc
+
ce24cc
+      brlttyIncludeAlsaSupport
ce24cc
+   done
ce24cc
+}
ce24cc
+
ce24cc
+brlttyIncludeScreenDrivers() {
ce24cc
+   local code
ce24cc
+
ce24cc
+   for code
ce24cc
+   do
ce24cc
+      brlttyIncludeDriver x "${code}" || continue
ce24cc
+   done
ce24cc
+}
ce24cc
+
ce24cc
+brlttyIncludeDriver() {
ce24cc
+   local type="${1}"
ce24cc
+   local code="${2}"
ce24cc
+
ce24cc
+   [ "${code}" = "no" ] && return 1
ce24cc
+   local driver="${type}${code}"
ce24cc
+
ce24cc
+   [ -n "${includedDrivers[${driver}]}" ] && return 2
ce24cc
+   includedDrivers[${driver}]=1
ce24cc
+
ce24cc
+   inst_libdir_file "brltty/libbrltty${driver}.so*"
ce24cc
+   return 0
ce24cc
+}
ce24cc
+
ce24cc
+brlttyIncludeTables() {
ce24cc
+   local subdirectory="${1}"
ce24cc
+   local extension="${2}"
ce24cc
+   shift 2
ce24cc
+   local name
ce24cc
+
ce24cc
+   for name
ce24cc
+   do
ce24cc
+      brlttyIncludeDataFiles "/etc/brltty/${subdirectory}/${name}.${extension}"
ce24cc
+   done
ce24cc
+}
ce24cc
+
ce24cc
+brlttyIncludeDataFiles() {
ce24cc
+   local file
ce24cc
+
ce24cc
+   while read -r file
ce24cc
+   do
ce24cc
+      inst_simple "${file}"
ce24cc
+   done < <(brltty-lsinc "${@}")
ce24cc
+}
ce24cc
+
ce24cc
+brlttyGetConfiguredDrivers() {
ce24cc
+   local category="${1}"
ce24cc
+   brlttyGetProperty "checking for ${category} driver"
ce24cc
+}
ce24cc
+
ce24cc
+brlttyGetProperty() {
ce24cc
+   local name="${1}"
ce24cc
+   echo "${brlttyLog}" | awk "/: *${name} *:/ {print \$NF}"
ce24cc
+}
ce24cc
+
ce24cc
+brlttyImportInstallOptions() {
ce24cc
+   local file="/etc/brltty/Initramfs/dracut.conf"
ce24cc
+   [ -f "${file}" ] && [ -r "${file}" ] && . "${file}"
ce24cc
+}
ce24cc
+
ce24cc
+brlttyIncludePulseAudioSupport() {
ce24cc
+   [ -d "${initdir}/etc/pulse" ] && return 0
ce24cc
+
ce24cc
+   brlttyInstallDirectories /etc/pulse
ce24cc
+   brlttyInstallDirectories /usr/share/pulseaudio
ce24cc
+   brlttyInstallDirectories /usr/lib*/pulseaudio
ce24cc
+   brlttyInstallDirectories /usr/lib*/pulse-*
ce24cc
+   brlttyInstallDirectories /usr/libexec/pulse
ce24cc
+
ce24cc
+   inst_multiple -o pulseaudio pactl pacmd
ce24cc
+   inst_multiple -o pamon paplay parec parecord
ce24cc
+
ce24cc
+   brlttyAddUserEntries pulse
ce24cc
+   brlttyAddGroupEntries pulse pulse-access pulse-rt
ce24cc
+
ce24cc
+   brlttyIncludeAlsaSupport
ce24cc
+   brlttyIncludeMessageBusSupport
ce24cc
+   inst_simple /etc/dbus-1/system.d/pulseaudio-system.conf
ce24cc
+
ce24cc
+   inst_binary chmod
ce24cc
+   inst_hook initqueue 97 "${moddir}/pulse-start.sh"
ce24cc
+   inst_hook cleanup 98 "${moddir}/pulse-stop.sh"
ce24cc
+}
ce24cc
+
ce24cc
+brlttyIncludeAlsaSupport() {
ce24cc
+   [ -d "${initdir}/etc/alsa" ] && return 0;
ce24cc
+
ce24cc
+   brlttyInstallDirectories /etc/alsa
ce24cc
+   rm -f "${initdir}/etc/alsa/conf.d/"*
ce24cc
+
ce24cc
+   brlttyInstallDirectories /usr/share/alsa
ce24cc
+   brlttyInstallDirectories /usr/lib/alsa
ce24cc
+   brlttyInstallDirectories /usr/lib*/alsa-lib
ce24cc
+
ce24cc
+   inst_multiple -o alsactl alsaucm alsamixer amixer aplay
ce24cc
+   inst_script alsaunmute
ce24cc
+
ce24cc
+   inst_hook initqueue 96 "${moddir}/alsa-start.sh"
ce24cc
+}
ce24cc
+
ce24cc
+brlttyIncludeBluetoothSupport() {
ce24cc
+   [ -d "${initdir}/etc/bluetooth" ] && return 0
ce24cc
+
ce24cc
+   brlttyInstallDirectories /etc/bluetooth
ce24cc
+   brlttyInstallDirectories /var/lib/bluetooth
ce24cc
+
ce24cc
+   inst_multiple -o bluetoothctl hciconfig hcitool sdptool
ce24cc
+   inst_binary /usr/libexec/bluetooth/bluetoothd
ce24cc
+   brlttyInstallSystemdUnits bluetooth.service bluetooth.target
ce24cc
+
ce24cc
+   inst_hook initqueue 97 "${moddir}/bluetooth-start.sh"
ce24cc
+   brlttyIncludeMessageBusSupport
ce24cc
+}
ce24cc
+
ce24cc
+brlttyIncludeMessageBusSupport() {
ce24cc
+   [ -d "${initdir}/etc/dbus-1" ] && return 0
ce24cc
+
ce24cc
+   brlttyAddMessageBusUsers /usr/share/dbus-1/system.d/*
ce24cc
+   brlttyAddMessageBusUsers /etc/dbus-1/system.d/*
ce24cc
+
ce24cc
+   brlttyInstallDirectories /etc/dbus-1
ce24cc
+   brlttyInstallDirectories /usr/share/dbus-1
ce24cc
+   brlttyInstallDirectories /usr/libexec/dbus-1
ce24cc
+
ce24cc
+   inst_multiple dbus-daemon dbus-send dbus-cleanup-sockets dbus-monitor
ce24cc
+   brlttyInstallSystemdUnits dbus.service dbus.socket
ce24cc
+
ce24cc
+   inst_hook initqueue 96 "${moddir}/dbus-start.sh"
ce24cc
+}
ce24cc
+
ce24cc
+brlttyAddMessageBusUsers() {
ce24cc
+   set -- dbus $(sed -n -r -e 's/^.* user="([^"]*)".*$/\1/p' "${@}" | sort -u)
ce24cc
+   brlttyAddUserEntries "${@}"
ce24cc
+   brlttyAddGroupEntries "${@}"
ce24cc
+}
ce24cc
+
ce24cc
+brlttyAddUserEntries() {
ce24cc
+   brlttyAddEntries passwd "${@}"
ce24cc
+}
ce24cc
+
ce24cc
+brlttyAddGroupEntries() {
ce24cc
+   brlttyAddEntries group "${@}"
ce24cc
+}
ce24cc
+
ce24cc
+brlttyAddEntries() {
ce24cc
+   local file="${1}"
ce24cc
+   shift 1
ce24cc
+
ce24cc
+   local source="/etc/${file}"
ce24cc
+   local target="${initdir}${source}"
ce24cc
+   local name
ce24cc
+
ce24cc
+   for name
ce24cc
+   do
ce24cc
+      grep -q -e "^${name}:" "${target}" || {
ce24cc
+         local line="$(grep "^${name}:" "${source}")"
ce24cc
+         [ -n "${line}" ] && echo >>"${target}" "${line}"
ce24cc
+      }
ce24cc
+   done
ce24cc
+}
ce24cc
+
ce24cc
+brlttyInstallSystemdUnits() {
ce24cc
+   local unit
ce24cc
+
ce24cc
+   for unit
ce24cc
+   do
ce24cc
+      inst_simple "/usr/lib/systemd/system/${unit}"
ce24cc
+   done
ce24cc
+}
ce24cc
+
ce24cc
+brlttyInstallDirectories() {
ce24cc
+   local directory
ce24cc
+
ce24cc
+   for directory
ce24cc
+   do
ce24cc
+      [ -d "${directory}" ] && {
ce24cc
+         eval set -- $(find "${directory}" -printf "'%p'\n")
ce24cc
+         inst_multiple "${@}"
ce24cc
+      }
ce24cc
+   done
ce24cc
+}
ce24cc
+
ce24cc
diff --git a/Initramfs/Dracut/pulse-start.sh b/Initramfs/Dracut/pulse-start.sh
ce24cc
new file mode 100755
ce24cc
index 0000000..ed9af36
ce24cc
--- /dev/null
ce24cc
+++ b/Initramfs/Dracut/pulse-start.sh
ce24cc
@@ -0,0 +1,5 @@
ce24cc
+#!/bin/bash
ce24cc
+
ce24cc
+getargbool 1 rd.brltty && getargbool 1 rd.brltty.sound && getargbool 1 rd.brltty.pulse && {
ce24cc
+   chmod a+w /tmp && pulseaudio --daemonize=yes --system --disallow-exit --disallow-module-loading --disable-shm
ce24cc
+}
ce24cc
diff --git a/Initramfs/Dracut/pulse-stop.sh b/Initramfs/Dracut/pulse-stop.sh
ce24cc
new file mode 100755
ce24cc
index 0000000..5f2b033
ce24cc
--- /dev/null
ce24cc
+++ b/Initramfs/Dracut/pulse-stop.sh
ce24cc
@@ -0,0 +1,3 @@
ce24cc
+#!/bin/bash
ce24cc
+
ce24cc
+read 
ce24cc
diff --git a/Initramfs/Dracut/speechd-start.sh b/Initramfs/Dracut/speechd-start.sh
ce24cc
new file mode 100755
ce24cc
index 0000000..4467c27
ce24cc
--- /dev/null
ce24cc
+++ b/Initramfs/Dracut/speechd-start.sh
ce24cc
@@ -0,0 +1,7 @@
ce24cc
+#!/bin/bash
ce24cc
+
ce24cc
+getargbool 1 rd.brltty && getargbool 1 rd.brltty.sound && getargbool 1 rd.brltty.speechd && {
ce24cc
+   systemctl -q is-active speech-dispatcherd || {
ce24cc
+      systemctl --no-block start speech-dispatcherd
ce24cc
+   }
ce24cc
+}
ce24cc
diff --git a/Makefile.in b/Makefile.in
ce24cc
index d722215..103af51 100644
ce24cc
--- a/Makefile.in
ce24cc
+++ b/Makefile.in
ce24cc
@@ -22,14 +22,17 @@ all install uninstall install-documents:
ce24cc
 install-messages uninstall-messages:
ce24cc
 	cd $(MSG_DIR) && $(MAKE) $(@:-messages=)
ce24cc
 
ce24cc
+install-appstream uninstall-appstream:
ce24cc
+	cd Autostart/AppStream && $(MAKE) $(@:-appstream=)
ce24cc
+
ce24cc
 install-systemd uninstall-systemd:
ce24cc
 	cd Autostart/Systemd && $(MAKE) $(@:-systemd=)
ce24cc
 
ce24cc
 install-udev uninstall-udev:
ce24cc
 	cd Autostart/Udev && $(MAKE) $(@:-udev=)
ce24cc
 
ce24cc
-install-appstream uninstall-appstream:
ce24cc
-	cd Autostart/AppStream && $(MAKE) $(@:-appstream=)
ce24cc
+install-dracut uninstall-dracut:
ce24cc
+	cd Initramfs/Dracut && $(MAKE) $(@:-dracut=)
ce24cc
 
ce24cc
 ARCHIVE_NAME = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
ce24cc
 TAR_EXTENSION = tar
ce24cc
@@ -95,9 +98,10 @@ ITERATE = \
ce24cc
    -for directory in \
ce24cc
    $(PGM_DIR) \
ce24cc
    $(MSG_DIR) \
ce24cc
+   Autostart/AppStream \
ce24cc
    Autostart/Systemd \
ce24cc
    Autostart/Udev \
ce24cc
-   Autostart/AppStream \
ce24cc
+   Initramfs/Dracut \
ce24cc
    Android/Application \
ce24cc
    ; do (cd $$directory && $(MAKE) $@); done
ce24cc
 
ce24cc
diff --git a/Programs/Makefile.in b/Programs/Makefile.in
ce24cc
index 0016035..c6d66f4 100644
ce24cc
--- a/Programs/Makefile.in
ce24cc
+++ b/Programs/Makefile.in
ce24cc
@@ -16,8 +16,9 @@
ce24cc
 # This software is maintained by Dave Mielke <dave@mielke.cc>.
ce24cc
 ###############################################################################
ce24cc
 
ce24cc
-all: all-brltty all-brltty-trtxt all-brltty-ttb all-brltty-atb $(ALL_BRLTTY_CTB) all-brltty-ktb all-brltty-tune $(ALL_XBRLAPI) $(ALL_API_BINDINGS)
ce24cc
+all: all-brltty all-brltty-lsinc all-brltty-trtxt all-brltty-ttb all-brltty-atb $(ALL_BRLTTY_CTB) all-brltty-ktb all-brltty-tune $(ALL_XBRLAPI) $(ALL_API_BINDINGS)
ce24cc
 all-brltty: brltty$X $(BRAILLE_DRIVERS) $(SPEECH_DRIVERS) $(SCREEN_DRIVERS)
ce24cc
+all-brltty-lsinc: brltty-lsinc$X
ce24cc
 all-brltty-trtxt: brltty-trtxt$X
ce24cc
 all-brltty-ttb: brltty-ttb$X
ce24cc
 all-brltty-atb: brltty-atb$X
ce24cc
@@ -805,6 +806,16 @@ brltty-trtxt.$O:
ce24cc
 
ce24cc
 ###############################################################################
ce24cc
 
ce24cc
+BRLTTY_LSINC_OBJECTS = brltty-lsinc.$O $(PROGRAM_OBJECTS)
ce24cc
+
ce24cc
+brltty-lsinc$X: $(BRLTTY_LSINC_OBJECTS)
ce24cc
+	$(CC) $(LDFLAGS) -o $@ $(BRLTTY_LSINC_OBJECTS) $(LDLIBS)
ce24cc
+
ce24cc
+brltty-lsinc.$O:
ce24cc
+	$(CC) $(CFLAGS) -c $(SRC_DIR)/brltty-lsinc.c
ce24cc
+
ce24cc
+###############################################################################
ce24cc
+
ce24cc
 BRLTEST_OBJECTS = brltest.$O $(PROGRAM_OBJECTS) report.$O $(TTB_OBJECTS) $(KTB_OBJECTS) dataarea.$O cmd.$O cmd_queue.$O drivers.$O driver.$O $(BRAILLE_OBJECTS) $(PREFS_OBJECTS) hidkeys.$O learn.$O
ce24cc
 
ce24cc
 brltest$X: $(BRLTEST_OBJECTS)
ce24cc
@@ -949,8 +960,9 @@ check-all: check-text-tables check-attributes-tables check-contraction-tables ch
ce24cc
 
ce24cc
 install:: install-programs install-tables $(INSTALL_DRIVERS) install-core-headers $(INSTALL_MESSAGES) install-manpages $(INSTALL_API)
ce24cc
 
ce24cc
-install-programs: brltty$X brltty-trtxt$X brltty-ttb$X brltty-atb$X $(INSTALL_BRLTTY_CTB) brltty-ktb$X brltty-tune$X install-program-directory install-writable-directory
ce24cc
+install-programs: brltty$X brltty-lsinc$X brltty-trtxt$X brltty-ttb$X brltty-atb$X $(INSTALL_BRLTTY_CTB) brltty-ktb$X brltty-tune$X install-program-directory install-writable-directory
ce24cc
 	$(INSTALL_PROGRAM) brltty$X $(INSTALL_PROGRAM_DIRECTORY) 
ce24cc
+	$(INSTALL_PROGRAM) brltty-lsinc$X $(INSTALL_PROGRAM_DIRECTORY) 
ce24cc
 	$(INSTALL_PROGRAM) brltty-trtxt$X $(INSTALL_PROGRAM_DIRECTORY) 
ce24cc
 	$(INSTALL_PROGRAM) brltty-ttb$X $(INSTALL_PROGRAM_DIRECTORY) 
ce24cc
 	$(INSTALL_PROGRAM) brltty-atb$X $(INSTALL_PROGRAM_DIRECTORY) 
ce24cc
@@ -1136,6 +1148,7 @@ distclean clean::
ce24cc
 
ce24cc
 clean::
ce24cc
 	-rm -f brltty$X brltty-trtxt$X brltty-ttb$X brltty-atb$X brltty-ctb$X brltty-tune$X xbrlapi$X
ce24cc
+	-rm -f brltty$X brltty-lsinc$X brltty-trtxt$X brltty-ttb$X brltty-atb$X brltty-ctb$X brltty-tune$X xbrlapi$X
ce24cc
 	-rm -f tbl2hex$(X_FOR_BUILD) *test$X *-static$X
ce24cc
 	-rm -f brlapi_constants.h *.$(LIB_EXT) *.$(LIB_EXT).* *.$(ARC_EXT) *.def *.class *.jar
ce24cc
 	-rm -f $(BLD_TOP)$(DRV_DIR)/*
ce24cc
diff --git a/Programs/brltty-lsinc.c b/Programs/brltty-lsinc.c
ce24cc
new file mode 100644
ce24cc
index 0000000..9d2b026
ce24cc
--- /dev/null
ce24cc
+++ b/Programs/brltty-lsinc.c
ce24cc
@@ -0,0 +1,119 @@
ce24cc
+/*
ce24cc
+ * BRLTTY - A background process providing access to the console screen (when in
ce24cc
+ *          text mode) for a blind person using a refreshable braille display.
ce24cc
+ *
ce24cc
+ * Copyright (C) 1995-2018 by The BRLTTY Developers.
ce24cc
+ *
ce24cc
+ * BRLTTY comes with ABSOLUTELY NO WARRANTY.
ce24cc
+ *
ce24cc
+ * This is free software, placed under the terms of the
ce24cc
+ * GNU Lesser General Public License, as published by the Free Software
ce24cc
+ * Foundation; either version 2.1 of the License, or (at your option) any
ce24cc
+ * later version. Please see the file LICENSE-LGPL for details.
ce24cc
+ *
ce24cc
+ * Web Page: http://brltty.app/
ce24cc
+ *
ce24cc
+ * This software is maintained by Dave Mielke <dave@mielke.cc>.
ce24cc
+ */
ce24cc
+
ce24cc
+#include "prologue.h"
ce24cc
+
ce24cc
+#include <stdio.h>
ce24cc
+#include <string.h>
ce24cc
+#include <search.h>
ce24cc
+
ce24cc
+#include "log.h"
ce24cc
+#include "program.h"
ce24cc
+#include "options.h"
ce24cc
+#include "file.h"
ce24cc
+
ce24cc
+BEGIN_OPTION_TABLE(programOptions)
ce24cc
+END_OPTION_TABLE
ce24cc
+
ce24cc
+static void
ce24cc
+noMemory (void) {
ce24cc
+  fprintf(stderr, "%s: insufficient memory\n", programName);
ce24cc
+  exit(PROG_EXIT_FATAL);
ce24cc
+}
ce24cc
+
ce24cc
+static int
ce24cc
+compareStrings (const void *string1, const void *string2) {
ce24cc
+  return strcmp(string1, string2);
ce24cc
+}
ce24cc
+
ce24cc
+static void
ce24cc
+logFileName (const char *name, void *data) {
ce24cc
+  static void *namesTree = NULL;
ce24cc
+
ce24cc
+  if (!tfind(name, &namesTree, compareStrings)) {
ce24cc
+    name = strdup(name);
ce24cc
+    if (!name) noMemory();
ce24cc
+    if (!tsearch(name, &namesTree, compareStrings)) noMemory();
ce24cc
+    printf("%s\n", name);
ce24cc
+  }
ce24cc
+}
ce24cc
+
ce24cc
+static DATA_CONDITION_TESTER(testConditionOperand) {
ce24cc
+  return 1;
ce24cc
+}
ce24cc
+
ce24cc
+static DATA_OPERANDS_PROCESSOR(processUnknownDirective) {
ce24cc
+  DataOperand directive;
ce24cc
+
ce24cc
+  if (getDataOperand(file, &directive, NULL)) {
ce24cc
+    if (directive.length >= 2) {
ce24cc
+      if (isKeyword(WS_C("if"), directive.characters, 2)) {
ce24cc
+        return processConditionOperands(file, testConditionOperand, 0, NULL, data);
ce24cc
+      }
ce24cc
+    }
ce24cc
+  }
ce24cc
+
ce24cc
+  return 1;
ce24cc
+}
ce24cc
+
ce24cc
+static DATA_OPERANDS_PROCESSOR(processOperands) {
ce24cc
+  BEGIN_DATA_DIRECTIVE_TABLE
ce24cc
+    DATA_NESTING_DIRECTIVES,
ce24cc
+    DATA_CONDITION_DIRECTIVES,
ce24cc
+    DATA_VARIABLE_DIRECTIVES,
ce24cc
+    {NULL, processUnknownDirective},
ce24cc
+  END_DATA_DIRECTIVE_TABLE
ce24cc
+
ce24cc
+  return processDirectiveOperand(file, &directives, "attributes table directive", data);
ce24cc
+}
ce24cc
+
ce24cc
+int
ce24cc
+main (int argc, char *argv[]) {
ce24cc
+  {
ce24cc
+    static const OptionsDescriptor descriptor = {
ce24cc
+      OPTION_TABLE(programOptions),
ce24cc
+      .applicationName = "brltty-lsinc",
ce24cc
+      .argumentsSummary = "[file ...]"
ce24cc
+    };
ce24cc
+
ce24cc
+    PROCESS_OPTIONS(descriptor, argc, argv);
ce24cc
+  }
ce24cc
+
ce24cc
+  if (argc == 0) {
ce24cc
+    logMessage(LOG_ERR, "missing table file.");
ce24cc
+    return PROG_EXIT_SYNTAX;
ce24cc
+  }
ce24cc
+
ce24cc
+  do {
ce24cc
+    const char *path = *argv++;
ce24cc
+    argc -= 1;
ce24cc
+
ce24cc
+    const DataFileParameters parameters = {
ce24cc
+      .processOperands = processOperands,
ce24cc
+      .logFileName = logFileName
ce24cc
+    };
ce24cc
+
ce24cc
+    if (testProgramPath(path)) {
ce24cc
+      logFileName(path, parameters.data);
ce24cc
+    } else {
ce24cc
+      processDataFile(path, &parameters);
ce24cc
+    }
ce24cc
+  } while (argc);
ce24cc
+
ce24cc
+  return PROG_EXIT_SUCCESS;
ce24cc
+}
ce24cc
diff --git a/Programs/datafile.c b/Programs/datafile.c
ce24cc
index e70deb5..48235e6 100644
ce24cc
--- a/Programs/datafile.c
ce24cc
+++ b/Programs/datafile.c
ce24cc
@@ -1262,9 +1262,14 @@ processDataStream (
ce24cc
   FILE *stream, const char *name,
ce24cc
   const DataFileParameters *parameters
ce24cc
 ) {
ce24cc
-  logMessage(LOG_DEBUG, "including data file: %s", name);
ce24cc
   int ok = 0;
ce24cc
 
ce24cc
+  if (parameters->logFileName) {
ce24cc
+    parameters->logFileName(name, parameters->data);
ce24cc
+  } else {
ce24cc
+    logMessage(LOG_DEBUG, "including data file: %s", name);
ce24cc
+  }
ce24cc
+
ce24cc
   DataFile file = {
ce24cc
     .name = name,
ce24cc
     .parameters = parameters,
ce24cc
diff --git a/brltty.spec.in b/brltty.spec.in
ce24cc
index f5aa33d..1ac2ebf 100644
ce24cc
--- a/brltty.spec.in
ce24cc
+++ b/brltty.spec.in
ce24cc
@@ -339,6 +339,7 @@ BuildArch: noarch
ce24cc
 
ce24cc
 AutoProv: no
ce24cc
 AutoReq: yes
ce24cc
+Requires: systemd
ce24cc
 
ce24cc
 Summary: Systemd units and wrappers for BRLTTY.
ce24cc
 %description -n brltty-systemd
ce24cc
@@ -356,6 +357,7 @@ BuildArch: noarch
ce24cc
 
ce24cc
 AutoProv: no
ce24cc
 AutoReq: yes
ce24cc
+Requires: systemd-udev
ce24cc
 
ce24cc
 Summary: Udev rules for BRLTTY.
ce24cc
 %description -n brltty-udev
ce24cc
@@ -364,6 +366,25 @@ This package provides the rules and wrapper for managing BRLTTY via Udev.
ce24cc
 Install this package if you'd like to manage BRLTTY processes via Udev.
ce24cc
 
ce24cc
 
ce24cc
+%package -n brltty-dracut
ce24cc
+Version: @PACKAGE_VERSION@
ce24cc
+Release: 1
ce24cc
+Group: System Environment/Daemons
ce24cc
+License: LGPL
ce24cc
+BuildArch: noarch
ce24cc
+
ce24cc
+AutoProv: no
ce24cc
+AutoReq: yes
ce24cc
+Requires: dracut
ce24cc
+Requires: brltty-utils
ce24cc
+
ce24cc
+Summary: Dracut module for BRLTTY.
ce24cc
+%description -n brltty-dracut
ce24cc
+This package provides the module for adding BRLTTY to an initial ramdisk image.
ce24cc
+
ce24cc
+Install this package if you'd like to have braille accessibility BRLTTY processes via Udev.
ce24cc
+
ce24cc
+
ce24cc
 %package -n brlapi
ce24cc
 Version: @api_release@
ce24cc
 Release: 1
ce24cc
@@ -382,6 +403,26 @@ Install this package if you have an application
ce24cc
 which directly accesses a refreshable braille display.
ce24cc
 
ce24cc
 
ce24cc
+%package -n brlapi-utils
ce24cc
+Version: @api_release@
ce24cc
+Release: 1
ce24cc
+Group: Applications/System
ce24cc
+License: LGPL
ce24cc
+
ce24cc
+Requires: libX11
ce24cc
+
ce24cc
+BuildRequires: xorg-x11-proto-devel
ce24cc
+BuildRequires: libX11-devel
ce24cc
+BuildRequires: libXtst-devel
ce24cc
+
ce24cc
+AutoProv: no
ce24cc
+AutoReq: yes
ce24cc
+
ce24cc
+Summary: Appliation Programming Interface for BRLTTY.
ce24cc
+%description -n brlapi-utils
ce24cc
+This package provides a set of commands that use the BrlAPI interface.
ce24cc
+
ce24cc
+
ce24cc
 %package -n brlapi-devel
ce24cc
 Version: @api_release@
ce24cc
 Release: 1
ce24cc
@@ -489,26 +530,6 @@ Install this package if you have a Tcl application
ce24cc
 which directly accesses a refreshable braille display.
ce24cc
 
ce24cc
 
ce24cc
-%package -n brlapi-utils
ce24cc
-Version: @api_release@
ce24cc
-Release: 1
ce24cc
-Group: Applications/System
ce24cc
-License: LGPL
ce24cc
-
ce24cc
-Requires: libX11
ce24cc
-
ce24cc
-BuildRequires: xorg-x11-proto-devel
ce24cc
-BuildRequires: libX11-devel
ce24cc
-BuildRequires: libXtst-devel
ce24cc
-
ce24cc
-AutoProv: no
ce24cc
-AutoReq: yes
ce24cc
-
ce24cc
-Summary: Appliation Programming Interface for BRLTTY.
ce24cc
-%description -n brlapi-utils
ce24cc
-This package provides a set of commands for maintaining BRLTTY's datafiles.
ce24cc
-
ce24cc
-
ce24cc
 %prep
ce24cc
 # %setup -n %{name}-%{version}
ce24cc
 %setup -n @PACKAGE_TARNAME@-@PACKAGE_VERSION@
ce24cc
@@ -518,8 +539,13 @@ This package provides a set of commands for maintaining BRLTTY's datafiles.
ce24cc
 make
ce24cc
 
ce24cc
 %install
ce24cc
-make install install-documents install-messages
ce24cc
-make install-systemd install-udev install-appstream
ce24cc
+make install
ce24cc
+make install-documents
ce24cc
+make install-messages
ce24cc
+make install-appstream
ce24cc
+make install-systemd
ce24cc
+make install-udev
ce24cc
+make install-dracut
ce24cc
 install -m 644 Documents/brltty.conf "${RPM_BUILD_ROOT}%{_sysconfdir}"
ce24cc
 %find_lang %{name}
ce24cc
 
ce24cc
@@ -542,6 +568,7 @@ rm -fr "${RPM_BUILD_ROOT}"
ce24cc
 %exclude %{_libdir}/brltty/libbrlttyxa2.so
ce24cc
 %exclude %{_libdir}/brltty/libbrlttyxsc.so
ce24cc
 %{_sysconfdir}/brltty
ce24cc
+%exclude %{_sysconfdir}/brltty/dracut.conf
ce24cc
 %{_datadir}/metainfo/org.a11y.brltty.metainfo.xml
ce24cc
 %doc %{_mandir}/man1/brltty.1.gz
ce24cc
 %doc %{_docdir}/*/LICENSE*
ce24cc
@@ -598,12 +625,36 @@ rm -fr "${RPM_BUILD_ROOT}"
ce24cc
 %{_udevlibdir}/*
ce24cc
 %{_udevrulesdir}/*
ce24cc
 
ce24cc
+%files -n brltty-dracut
ce24cc
+/usr/lib/dracut/modules.d/99brltty
ce24cc
+%config(noreplace) %verify(not size md5 mtime) %{_sysconfdir}/brltty/Initramfs/dracut.conf
ce24cc
+%config(noreplace) %verify(not size md5 mtime) %{_sysconfdir}/brltty/Initramfs/cmdline
ce24cc
+
ce24cc
 %files -n brlapi
ce24cc
 %defattr(-,root,root)
ce24cc
 %{_libdir}/libbrlapi.so.*
ce24cc
 %{_datadir}/polkit-1/actions/org.a11y.brlapi.policy
ce24cc
 %doc %{_docdir}/*/Manual-BrlAPI
ce24cc
 
ce24cc
+%files -n brlapi-utils
ce24cc
+%{_bindir}/xbrlapi
ce24cc
+%doc %{_mandir}/man1/xbrlapi.1.gz
ce24cc
+%{_datadir}/gdm/greeter/autostart/xbrlapi.desktop
ce24cc
+%{_sysconfdir}/X11/Xsession.d/60xbrlapi
ce24cc
+%{_bindir}/eutp
ce24cc
+%doc %{_mandir}/man1/eutp.1.gz
ce24cc
+%{_bindir}/vstp
ce24cc
+%doc %{_mandir}/man1/vstp.1.gz
ce24cc
+
ce24cc
+%files -n brlapi-devel
ce24cc
+%defattr(-,root,root)
ce24cc
+%{_libdir}/libbrlapi.a
ce24cc
+%{_libdir}/libbrlapi.so
ce24cc
+%{_includedir}/brlapi.h
ce24cc
+%{_includedir}/brlapi_*.h
ce24cc
+%doc %{_mandir}/man3/*
ce24cc
+%doc %{_docdir}/*/BrlAPIref
ce24cc
+
ce24cc
 %files -n java-brlapi
ce24cc
 @JAVA_JAR_DIR@/*
ce24cc
 @JAVA_JNI_DIR@/*
ce24cc
@@ -618,25 +669,6 @@ rm -fr "${RPM_BUILD_ROOT}"
ce24cc
 @TCL_DIR@/brlapi-@api_release@/libbrlapi_tcl.so
ce24cc
 @TCL_DIR@/brlapi-@api_release@/pkgIndex.tcl
ce24cc
 
ce24cc
-%files -n brlapi-devel
ce24cc
-%defattr(-,root,root)
ce24cc
-%{_libdir}/libbrlapi.a
ce24cc
-%{_libdir}/libbrlapi.so
ce24cc
-%{_includedir}/brlapi.h
ce24cc
-%{_includedir}/brlapi_*.h
ce24cc
-%doc %{_mandir}/man3/*
ce24cc
-%doc %{_docdir}/*/BrlAPIref
ce24cc
-
ce24cc
-%files -n brlapi-utils
ce24cc
-%{_bindir}/xbrlapi
ce24cc
-%{_bindir}/eutp
ce24cc
-%{_bindir}/vstp
ce24cc
-%doc %{_mandir}/man1/xbrlapi.1.gz
ce24cc
-%doc %{_mandir}/man1/eutp.1.gz
ce24cc
-%doc %{_mandir}/man1/vstp.1.gz
ce24cc
-%{_sysconfdir}/X11/Xsession.d/60xbrlapi
ce24cc
-%{_datadir}/gdm/greeter/autostart/xbrlapi.desktop
ce24cc
-
ce24cc
 
ce24cc
 %changelog
ce24cc
 * Mon Feb 5 2018 Dave Mielke <Dave@Mielke.cc> 5.6
ce24cc
diff --git a/configure.ac b/configure.ac
ce24cc
index 8938c6b..b09fda8 100644
ce24cc
--- a/configure.ac
ce24cc
+++ b/configure.ac
ce24cc
@@ -38,15 +38,18 @@ AC_DEFINE_UNQUOTED([BRLAPI_REVISION], [${api_revision}],
ce24cc
                    [Define this to be the API library revision number.])
ce24cc
 
ce24cc
 BRLTTY_SUMMARY_BEGIN
ce24cc
-brltty_build_directories=". Programs Documents Messages Android/Core Android/Application"
ce24cc
+brltty_build_directories=". Programs Documents Messages"
ce24cc
 brltty_source_directory="`dirname "${0}"`"
ce24cc
 brltty_manual_directories=""
ce24cc
 
ce24cc
-for brltty_autostart_directory in `(cd "${brltty_source_directory}" && echo Autostart/*)`
ce24cc
+for brltty_directory in Autostart Initramfs Android
ce24cc
 do
ce24cc
-   test -f "${brltty_source_directory}/${brltty_autostart_directory}/Makefile.in" && {
ce24cc
-      brltty_build_directories="${brltty_build_directories} ${brltty_autostart_directory}"
ce24cc
-   }
ce24cc
+   for brltty_subdirectory in `echo "${brltty_source_directory}/${brltty_directory}/"*`
ce24cc
+   do
ce24cc
+      test -f "${brltty_subdirectory}/Makefile.in" && {
ce24cc
+         brltty_build_directories="${brltty_build_directories} ${brltty_subdirectory}"
ce24cc
+      }
ce24cc
+   done
ce24cc
 done
ce24cc
 
ce24cc
 for brltty_manual_directory in `(cd "${brltty_source_directory}" && echo Documents/Manual-*/*)`
ce24cc
@@ -1957,7 +1960,7 @@ AC_OUTPUT([
ce24cc
    Documents/BrlAPIref.doxy
ce24cc
    Bindings/Lisp/brlapi.lisp
ce24cc
    Bindings/Python/setup.py
ce24cc
-   Android/Application/res/values/configured.xml:Android/Application/res.strings.in
ce24cc
    Autostart/Systemd/brltty@.service
ce24cc
+   Android/Application/res/values/configured.xml:Android/Application/res.strings.in
ce24cc
    ${brltty_make_files}
ce24cc
 ])