From 37a60cf8e28620c3a3bdbc980943db2e44ceddf2 Mon Sep 17 00:00:00 2001 From: David P Date: Sun, 21 Feb 2021 20:33:40 -0300 Subject: add braille support on OpenRC profiles Signed-off-by: David P --- .../airootfs/etc/local.d/livecd-talk.start | 11 + configs/releng-openrc/airootfs/root/.zlogin | 6 +- .../airootfs/usr/local/bin/livecd-sound | 248 +++++++++++++++++++++ .../parabolaiso-x86_64-speech-linux-libre.conf | 8 + configs/releng-openrc/efiboot/EFI/BOOT/refind.conf | 3 +- configs/releng-openrc/packages.both | 7 +- .../releng-openrc/syslinux/parabolaiso_head.cfg | 1 + .../syslinux/parabolaiso_pxe_both_inc.cfg | 4 +- .../syslinux/parabolaiso_sys32-linux-libre.cfg | 17 +- .../syslinux/parabolaiso_sys64-linux-libre.cfg | 18 +- .../syslinux/parabolaiso_sys_32_inc.cfg | 5 + .../syslinux/parabolaiso_sys_both_inc.cfg | 6 + .../releng-openrc/syslinux/parabolaiso_tail.cfg | 2 +- configs/releng-openrc/syslinux/syslinux.cfg | 1 + 14 files changed, 322 insertions(+), 15 deletions(-) create mode 100755 configs/releng-openrc/airootfs/etc/local.d/livecd-talk.start create mode 100755 configs/releng-openrc/airootfs/usr/local/bin/livecd-sound create mode 100644 configs/releng-openrc/efiboot/EFI/BOOT/entries/parabolaiso-x86_64-speech-linux-libre.conf (limited to 'configs/releng-openrc') diff --git a/configs/releng-openrc/airootfs/etc/local.d/livecd-talk.start b/configs/releng-openrc/airootfs/etc/local.d/livecd-talk.start new file mode 100755 index 0000000..4c1813b --- /dev/null +++ b/configs/releng-openrc/airootfs/etc/local.d/livecd-talk.start @@ -0,0 +1,11 @@ +#!/bin/bash +# +# SPDX-License-Identifier: GPL-3.0-or-later + +if grep -qo 'accessibility=on' /proc/cmdline; then + livecd-sound -u + chvt 13 + livecd-sound -p + chvt 1 + rc-service start espeakup +fi diff --git a/configs/releng-openrc/airootfs/root/.zlogin b/configs/releng-openrc/airootfs/root/.zlogin index a74dff0..0fb119d 100644 --- a/configs/releng-openrc/airootfs/root/.zlogin +++ b/configs/releng-openrc/airootfs/root/.zlogin @@ -1,4 +1,6 @@ -# -# SPDX-License-Identifier: GPL-3.0-or-later +# fix for screen readers +if grep -Fq 'accessibility=' /proc/cmdline &> /dev/null; then + setopt SINGLE_LINE_ZLE +fi ~/.automated_script.sh diff --git a/configs/releng-openrc/airootfs/usr/local/bin/livecd-sound b/configs/releng-openrc/airootfs/usr/local/bin/livecd-sound new file mode 100755 index 0000000..3ead720 --- /dev/null +++ b/configs/releng-openrc/airootfs/usr/local/bin/livecd-sound @@ -0,0 +1,248 @@ +#!/usr/bin/env bash +# +# SPDX-License-Identifier: GPL-3.0-or-later + +usage() { + cat <<- _EOF_ + live cd sound helper script. + Usage: livecdsound [OPTION] + OPTIONS + -u, --unmute unmute all sound cards + -p, --pick select a card for speetch output + -h, --help Show this usage message + +_EOF_ +} + +bugout () { + printf "/usr/local/bin/livecdsound: programming error" + stat_fail +} + +echo_card_indices() +{ + if [ -f /proc/asound/cards ] ; then + sed -n -e's/^[[:space:]]*\([0-7]\)[[:space:]].*/\1/p' /proc/asound/cards + fi +} + +# The following functions try to set many controls. +# No card has all the controls and so some of the attempts are bound to fail. +# Because of this, the functions can't return useful status values. + +# $1 +# $2 +# $3 +unmute_and_set_level(){ + { [ "$3" ] &&[ "$2" ] && [ "$1" ] ; } || bugout + printf "Setting: %s on card: %s to %s\n" "$2" "$1" "$3" + amixer -c "$1" set "$2" "$3" unmute + return 0 +} + +# $1 +# $2 +mute_and_zero_level() +{ + { [ "$1" ] && [ "$2" ] ; } || bugout + printf "Muting control: %s on card: %s\n" "$2" "$1" + amixer -c "$1" set "$2" "0%" mute + return 0 +} + +# $1 +# $2 +# $3 "on" | "off" +switch_control() +{ + { [ "$3" ] && [ "$1" ] ; } || bugout + printf "Switching control: %s on card: %s to %s\n" "$2" "$1" "$3" + amixer -c "$1" set "$2" "$3" + return 0 +} + +# $1 +sanify_levels_on_card() +{ + unmute_and_set_level "$1" "Front" "80%" + unmute_and_set_level "$1" "Master" "80%" + unmute_and_set_level "$1" "Master Mono" "80%" + unmute_and_set_level "$1" "Master Digital" "80%" # E.g., cs4237B + unmute_and_set_level "$1" "Playback" "80%" + unmute_and_set_level "$1" "Headphone" "100%" + unmute_and_set_level "$1" "PCM" "80%" + unmute_and_set_level "$1" "PCM,1" "80%" # E.g., ess1969 + unmute_and_set_level "$1" "DAC" "80%" # E.g., envy24, cs46xx + unmute_and_set_level "$1" "DAC,0" "80%" # E.g., envy24 + unmute_and_set_level "$1" "DAC,1" "80%" # E.g., envy24 + unmute_and_set_level "$1" "Synth" "80%" + unmute_and_set_level "$1" "CD" "80%" + unmute_and_set_level "$1" "PC Speaker" "100%" + + mute_and_zero_level "$1" "Mic" + mute_and_zero_level "$1" "IEC958" # Ubuntu #19648 + + # Intel P4P800-MX + switch_control "$1" "Master Playback Switch" on + switch_control "$1" "Master Surround" on + + # Trident/YMFPCI/emu10k1: + unmute_and_set_level "$1" "Wave" "80%" + unmute_and_set_level "$1" "Music" "80%" + unmute_and_set_level "$1" "AC97" "80%" + + # DRC: + unmute_and_set_level "$1" "Dynamic Range Compression" "80%" + + # Required for HDA Intel (hda-intel): + unmute_and_set_level "$1" "Front" "80%" + + # Required for SB Live 7.1/24-bit (ca0106): + unmute_and_set_level "$1" "Analog Front" "80%" + + # Required at least for Via 823x hardware on DFI K8M800-MLVF Motherboard + switch_control "$1" "IEC958 Capture Monitor" off + + # Required for hardware allowing toggles for AC97 through IEC958, + # valid values are 0, 1, 2, 3. Needs to be set to 0 for PCM1. + unmute_and_set_level "$1" "IEC958 Playback AC97-SPSA" "0" + + # Required for newer Via hardware + unmute_and_set_level "$1" "VIA DXS,0" "80%" + unmute_and_set_level "$1" "VIA DXS,1" "80%" + unmute_and_set_level "$1" "VIA DXS,2" "80%" + unmute_and_set_level "$1" "VIA DXS,3" "80%" + + # Required on some notebooks with ICH4: + switch_control "$1" "Headphone Jack Sense" off + switch_control "$1" "Line Jack Sense" off + + # Some machines need one or more of these to be on; + # others need one or more of these to be off: + + switch_control "$1" "Audigy Analog/Digital Output Jack" on + switch_control "$1" "SB Live Analog/Digital Output Jack" on + + # D1984 -- Thinkpad T61/X61 + switch_control "$1" "Speaker" on + switch_control "$1" "Headphone" on + + # HDA-Intel w/ "Digital" capture mixer (See Ubuntu #193823) + unmute_and_set_level "$1" "Digital" "80%" + + return 0 +} + +# $1 | "all" +sanify_levels() +{ + local ttsdml_returnstatus=0 + local card + case "$1" in + all) + for card in $(echo_card_indices) ; do + sanify_levels_on_card "$card" || ttsdml_returnstatus=1 + done + ;; + *) + sanify_levels_on_card "$1" || ttsdml_returnstatus=1 + ;; + esac + return $ttsdml_returnstatus +} + +# List all cards that *should* be usable for PCM audio. In my experience, +# the console speaker (handled by the pcsp driver) isn't a suitable playback +# device, so we'll exclude it. +list_non_pcsp_cards() +{ + for card in $(echo_card_indices); do + local cardfile="/proc/asound/card${card}/id" + if [ -r "$cardfile" ] && [ -f "$cardfile" ] && \ + [ "$(cat "$cardfile")" != pcsp ]; then + echo "$card" + fi + done +} + +# Properly initialize the sound card so that we have audio at boot. +unmute_all_cards() +{ + sanify_levels all +} + +is_numeric() { + local str=$1 + [[ "$str" =~ ^[0-9]+$ ]] +} + +set_default_card() { + local card=$1 + sed -e "s/%card%/$card/g" < /usr/local/share/livecd-sound/asound.conf.in \ + > /etc/asound.conf +} + +play_on_card() { + local card=$1 file=$2 + aplay -q "-Dplughw:$card,0" "$file" +} + +# If there are multiple usable sound cards, prompt the user to choose one, +# using auditory feedback. +pick_a_card() +{ + set -f + usable_cards="$(list_non_pcsp_cards)" + num_usable_cards="$(wc -w <<< "$usable_cards")" + + if [ "$num_usable_cards" -eq 1 ]; then + printf "Only one sound card is detected\n" + exit 0 + fi + printf "multiple sound cards detected\n" + for card in $usable_cards; do + if ! is_numeric "$card"; then + continue + fi + play_on_card "$card" /usr/share/livecd-sounds/pick-a-card.wav& + done + wait + sleep 1 + for card in $usable_cards; do + if ! is_numeric "$card"; then + continue + fi + play_on_card "$card" /usr/share/livecd-sounds/beep.wav + if read -r -t 10; then + printf "Selecting %s sound card as default\n" "$card" + set_default_card "$card" + break + fi +done +} + +if [[ $# -eq 0 ]]; then + echo "error: No argument passed." + exit 1 +fi +while [[ "${1}" != "" ]]; do + case ${1} in + -h|--help) + usage + exit + ;; + -u|--unmute) + printf "Unmuting all cards" + unmute_all_cards + ;; + -p|--pick) + pick_a_card + ;; + *) + echo "error: Unsupported argument" + usage + exit 1 + ;; + esac + shift +done diff --git a/configs/releng-openrc/efiboot/EFI/BOOT/entries/parabolaiso-x86_64-speech-linux-libre.conf b/configs/releng-openrc/efiboot/EFI/BOOT/entries/parabolaiso-x86_64-speech-linux-libre.conf new file mode 100644 index 0000000..62167e7 --- /dev/null +++ b/configs/releng-openrc/efiboot/EFI/BOOT/entries/parabolaiso-x86_64-speech-linux-libre.conf @@ -0,0 +1,8 @@ +# +# SPDX-License-Identifier: GPL-3.0-or-later + +menuentry "Parabola GNU/Linux-libre install medium (x86_64, UEFI) with speech" { + loader /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux-libre + initrd /%INSTALL_DIR%/boot/x86_64/initramfs-linux-libre.img + options "parabolaisobasedir=%INSTALL_DIR% parabolaisolabel=%PARABOLAISO_LABEL% accessibility=on" +} diff --git a/configs/releng-openrc/efiboot/EFI/BOOT/refind.conf b/configs/releng-openrc/efiboot/EFI/BOOT/refind.conf index 1380e2f..075bf3f 100644 --- a/configs/releng-openrc/efiboot/EFI/BOOT/refind.conf +++ b/configs/releng-openrc/efiboot/EFI/BOOT/refind.conf @@ -4,6 +4,7 @@ scanfor manual showtools shell firmware reboot shutdown -timeout 3 +timeout 15 include entries/parabolaiso-x86_64-linux-libre.conf +include entries/parabolaiso-x86_64-speech-linux-libre.conf default_selection entries/parabolaiso-x86_64-linux-libre.conf diff --git a/configs/releng-openrc/packages.both b/configs/releng-openrc/packages.both index 558caad..28d6ebf 100644 --- a/configs/releng-openrc/packages.both +++ b/configs/releng-openrc/packages.both @@ -1,8 +1,10 @@ # # SPDX-License-Identifier: GPL-3.0-or-later +alsa-utils arch-install-scripts base bind-tools +brltty-openrc btrfs-progs cloud-init crda @@ -15,6 +17,7 @@ dmraid dnsmasq dosfstools efibootmgr +espeakup-openrc elogind ethtool exfatprogs @@ -34,8 +37,8 @@ kitty-terminfo lftp linux-atm linux-libre -linux-libre linux-libre-firmware +livecd-sounds lsscsi lvm2-openrc lynx @@ -74,6 +77,7 @@ rxvt-unicode-terminfo sdparm sg3_utils smartmontools +squashfs-tools sudo syslinux tcpdump @@ -82,6 +86,7 @@ termite-terminfo testdisk tmux udev-init-scripts +udftools usb_modeswitch usbmuxd usbutils diff --git a/configs/releng-openrc/syslinux/parabolaiso_head.cfg b/configs/releng-openrc/syslinux/parabolaiso_head.cfg index d3c18d6..17b77e9 100644 --- a/configs/releng-openrc/syslinux/parabolaiso_head.cfg +++ b/configs/releng-openrc/syslinux/parabolaiso_head.cfg @@ -28,3 +28,4 @@ MENU COLOR msg07 35;40 #ff777caa #a0000000 std MENU COLOR tabmsg 35;40 #ff777caa #00000000 std MENU CLEAR +MENU IMMEDIATE diff --git a/configs/releng-openrc/syslinux/parabolaiso_pxe_both_inc.cfg b/configs/releng-openrc/syslinux/parabolaiso_pxe_both_inc.cfg index ea72b27..ed898b5 100644 --- a/configs/releng-openrc/syslinux/parabolaiso_pxe_both_inc.cfg +++ b/configs/releng-openrc/syslinux/parabolaiso_pxe_both_inc.cfg @@ -2,6 +2,6 @@ # SPDX-License-Identifier: GPL-3.0-or-later INCLUDE parabolaiso_head.cfg -INCLUDE parabolaiso_pxe64.cfg -INCLUDE parabolaiso_pxe32.cfg +INCLUDE parabolaiso_pxe64-linux-libre.cfg +INCLUDE parabolaiso_pxe32-linux-libre.cfg INCLUDE parabolaiso_tail.cfg diff --git a/configs/releng-openrc/syslinux/parabolaiso_sys32-linux-libre.cfg b/configs/releng-openrc/syslinux/parabolaiso_sys32-linux-libre.cfg index 2729002..b2c943c 100644 --- a/configs/releng-openrc/syslinux/parabolaiso_sys32-linux-libre.cfg +++ b/configs/releng-openrc/syslinux/parabolaiso_sys32-linux-libre.cfg @@ -1,14 +1,25 @@ # # SPDX-License-Identifier: GPL-3.0-or-later -TIMEOUT 30 +TIMEOUT 150 LABEL parabola32 TEXT HELP -Boot the Parabola GNU/Linux-libre (i686) live medium. +Boot the Parabola GNU/Linux-libre install medium on BIOS. It allows you to install Parabola GNU/Linux-libre or perform system maintenance. ENDTEXT -MENU LABEL Boot Parabola GNU/Linux-libre (i686) +MENU LABEL Parabola GNU/Linux-libre install medium (i686, BIOS) LINUX /%INSTALL_DIR%/boot/i686/vmlinuz-linux-libre INITRD /%INSTALL_DIR%/boot/i686/initramfs-linux-libre.img APPEND parabolaisobasedir=%INSTALL_DIR% parabolaisolabel=%PARABOLAISO_LABEL% + +# Accessibility boot option +LABEL parabola32speech +TEXT HELP +Boot the Parabola GNU/Linux-libre install medium on BIOS with speakup screen reader. +It allows you to install Parabola GNU/Linux-libre or perform system maintenance with speech feedback. +ENDTEXT +MENU LABEL Parabola GNU/Linux-libre install medium (i686, BIOS) with ^speech +LINUX /%INSTALL_DIR%/boot/i686/vmlinuz-linux-libre +INITRD /%INSTALL_DIR%/boot/i686/initramfs-linux-libre.img +APPEND parabolaisobasedir=%INSTALL_DIR% parabolaisolabel=%PARABOLAISO_LABEL% accessibility=on diff --git a/configs/releng-openrc/syslinux/parabolaiso_sys64-linux-libre.cfg b/configs/releng-openrc/syslinux/parabolaiso_sys64-linux-libre.cfg index 25f43c2..b173f93 100644 --- a/configs/releng-openrc/syslinux/parabolaiso_sys64-linux-libre.cfg +++ b/configs/releng-openrc/syslinux/parabolaiso_sys64-linux-libre.cfg @@ -1,15 +1,23 @@ # # SPDX-License-Identifier: GPL-3.0-or-later -DEFAULT parabola64 -TIMEOUT 30 - LABEL parabola64 TEXT HELP -Boot the Parabola GNU/Linux-libre (x86_64) live medium. +Boot the Parabola GNU/Linux-libre install medium on BIOS. It allows you to install Parabola GNU/Linux-libre or perform system maintenance. ENDTEXT -MENU LABEL Boot Parabola GNU/Linux-libre (x86_64) +MENU LABEL Parabola GNU/Linux-libre install medium (x86_64, BIOS) LINUX /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux-libre INITRD /%INSTALL_DIR%/boot/x86_64/initramfs-linux-libre.img APPEND parabolaisobasedir=%INSTALL_DIR% parabolaisolabel=%PARABOLAISO_LABEL% + +# Accessibility boot option +LABEL parabola64speech +TEXT HELP +Boot the Parabola GNU/Linux-libre install medium on BIOS with speakup screen reader. +It allows you to install Parabola GNU/Linux-libre or perform system maintenance with speech feedback. +ENDTEXT +MENU LABEL Parabola GNU/Linux-libre install medium (x86_64, BIOS) with ^speech +LINUX /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux-libre +INITRD /%INSTALL_DIR%/boot/x86_64/initramfs-linux-libre.img +APPEND parabolaisobasedir=%INSTALL_DIR% parabolaisolabel=%PARABOLAISO_LABEL% accessibility=on diff --git a/configs/releng-openrc/syslinux/parabolaiso_sys_32_inc.cfg b/configs/releng-openrc/syslinux/parabolaiso_sys_32_inc.cfg index 99f22cf..b9306ed 100644 --- a/configs/releng-openrc/syslinux/parabolaiso_sys_32_inc.cfg +++ b/configs/releng-openrc/syslinux/parabolaiso_sys_32_inc.cfg @@ -2,5 +2,10 @@ # SPDX-License-Identifier: GPL-3.0-or-later INCLUDE parabolaiso_head.cfg + +DEFAULT parabola32 +TIMEOUT 150 + INCLUDE parabolaiso_sys32-linux-libre.cfg + INCLUDE parabolaiso_tail.cfg diff --git a/configs/releng-openrc/syslinux/parabolaiso_sys_both_inc.cfg b/configs/releng-openrc/syslinux/parabolaiso_sys_both_inc.cfg index cd77b43..afb027d 100644 --- a/configs/releng-openrc/syslinux/parabolaiso_sys_both_inc.cfg +++ b/configs/releng-openrc/syslinux/parabolaiso_sys_both_inc.cfg @@ -2,6 +2,12 @@ # SPDX-License-Identifier: GPL-3.0-or-later INCLUDE parabolaiso_head.cfg + +DEFAULT parabola64 +TIMEOUT 150 + INCLUDE parabolaiso_sys64-linux-libre.cfg + INCLUDE parabolaiso_sys32-linux-libre.cfg + INCLUDE parabolaiso_tail.cfg diff --git a/configs/releng-openrc/syslinux/parabolaiso_tail.cfg b/configs/releng-openrc/syslinux/parabolaiso_tail.cfg index f7a27a2..af172c0 100644 --- a/configs/releng-openrc/syslinux/parabolaiso_tail.cfg +++ b/configs/releng-openrc/syslinux/parabolaiso_tail.cfg @@ -19,7 +19,7 @@ LINUX /%INSTALL_DIR%/boot/memtest LABEL hdt MENU LABEL Hardware Information (HDT) COM32 hdt.c32 -APPEND modules_alias=hdt/modalias.gz pciids=boot/syslinux/hdt/pciids.gz +APPEND modules_alias=hdt/modalias.gz pciids=hdt/pciids.gz LABEL reboot TEXT HELP diff --git a/configs/releng-openrc/syslinux/syslinux.cfg b/configs/releng-openrc/syslinux/syslinux.cfg index 7cb63ed..187eea5 100644 --- a/configs/releng-openrc/syslinux/syslinux.cfg +++ b/configs/releng-openrc/syslinux/syslinux.cfg @@ -12,3 +12,4 @@ CONFIG parabolaiso_pxe_choose.cfg LABEL sys CONFIG parabolaiso_sys_choose.cfg + -- cgit v1.2.2