Refactor Braille support

pull/373/head
Martin Wimpress 3 years ago
parent 559e2ae886
commit 2490060192
No known key found for this signature in database
GPG Key ID: 61DF940515E06DA3
  1. 2
      README.md
  2. 25
      quickemu

@ -688,7 +688,7 @@ Usage
quickemu --vm ubuntu.conf quickemu --vm ubuntu.conf
You can also pass optional parameters You can also pass optional parameters
--accessible : Select accessible facilitation. 'braille' (default - currently requires --display sdl ) --braille : Enable braille support. Requires SDL.
--delete-disk : Delete the disk image and EFI variables --delete-disk : Delete the disk image and EFI variables
--delete-vm : Delete the entire VM and it's configuration --delete-vm : Delete the entire VM and it's configuration
--display : Select display backend. 'sdl' (default), 'gtk', 'none', or 'spice' --display : Select display backend. 'sdl' (default), 'gtk', 'none', or 'spice'

@ -897,7 +897,8 @@ function vm_boot() {
-monitor none -monitor none
-serial mon:stdio) -serial mon:stdio)
if [[ "${ACCESSIBLE}" == "braille" ]] || [[ "${ACCESSIBLE}" == "brl" ]]; then # FIXME: Check for device availability. qemu will fail to start otherwise
if [ -n "${BRAILLE}" ]; then
# shellcheck disable=SC2054 # shellcheck disable=SC2054
args+=(-chardev braille,id=brltty args+=(-chardev braille,id=brltty
-device usb-braille,id=usbbrl,chardev=brltty) -device usb-braille,id=usbbrl,chardev=brltty)
@ -1049,7 +1050,7 @@ function usage() {
echo " ${LAUNCHER} --vm ubuntu.conf" echo " ${LAUNCHER} --vm ubuntu.conf"
echo echo
echo "You can also pass optional parameters" echo "You can also pass optional parameters"
echo " --accessible : Select accessible facilitation. 'braille' (default - currently requires --display sdl )" echo " --braille : Enable braille support. Requires SDL."
echo " --delete-disk : Delete the disk image and EFI variables" echo " --delete-disk : Delete the disk image and EFI variables"
echo " --delete-vm : Delete the entire VM and it's configuration" echo " --delete-vm : Delete the entire VM and it's configuration"
echo " --display : Select display backend. 'sdl' (default), 'gtk', 'none', or 'spice'" echo " --display : Select display backend. 'sdl' (default), 'gtk', 'none', or 'spice'"
@ -1066,14 +1067,6 @@ function usage() {
exit 1 exit 1
} }
#
function accessible_param_check() {
if [ "${ACCESSIBLE}" != "braille" ] && [ "${ACCESSIBLE}" != "brl" ] ; then
echo "ERROR! Requested accessiblility '${ACCESSIBLE}' is not recognised."
exit 1
# TODO can we check the device/API is available
fi
}
function display_param_check() { function display_param_check() {
if [ "${OUTPUT}" != "gtk" ] && [ "${OUTPUT}" != "none" ] && [ "${OUTPUT}" != "sdl" ] && [ "${OUTPUT}" != "spice" ]; then if [ "${OUTPUT}" != "gtk" ] && [ "${OUTPUT}" != "none" ] && [ "${OUTPUT}" != "sdl" ] && [ "${OUTPUT}" != "spice" ]; then
echo "ERROR! Requested output '${OUTPUT}' is not recognised." echo "ERROR! Requested output '${OUTPUT}' is not recognised."
@ -1104,6 +1097,7 @@ tpm="off"
usb_devices=() usb_devices=()
extra_args="" extra_args=""
BRAILLE=""
DELETE_DISK=0 DELETE_DISK=0
DELETE_VM=0 DELETE_VM=0
FULLSCREEN="" FULLSCREEN=""
@ -1165,10 +1159,8 @@ if [ $# -lt 1 ]; then
else else
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case "${1}" in case "${1}" in
-accessible|--accessible|-accessibility|--accessibility) -braille|--braille)
ACCESSIBLE="${2}" BRAILLE="on"
accessible_param_check
shift
shift;; shift;;
-delete|--delete|-delete-disk|--delete-disk) -delete|--delete|-delete-disk|--delete-disk)
DELETE_DISK=1 DELETE_DISK=1
@ -1251,7 +1243,10 @@ if [ -n "${VM}" ] && [ -e "${VM}" ]; then
fi fi
if [ -z "${OUTPUT}" ]; then if [ -z "${OUTPUT}" ]; then
if [ -z "${display}" ]; then # Braille support requires SDL. Override OUTPUT if braille was requested.
if [ -n "${BRAILLE}" ]; then
OUTPUT="sdl"
elif [ -z "${display}" ]; then
OUTPUT="sdl" OUTPUT="sdl"
else else
OUTPUT="${display}" OUTPUT="${display}"

Loading…
Cancel
Save