do not deadlock

This commit is contained in:
Chrys 2019-10-17 23:55:39 +02:00
parent a4b4560a6b
commit a3acf7d9cc
9 changed files with 352 additions and 7 deletions

41
play zone/clilauncher.sh Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash
# clilauncher.sh
# Description: Launches xterm with give application and fenrir.
#
# Copyright 2019, F123 Consulting, <information@f123.org>
# Copyright 2019, Storm Dragon, <storm_dragon@linux-a11y.org>
#
# This is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3, or (at your option) any later
# version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this package; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
#--code--
if [[ $# -lt 1 ]]; then
echo "Usage: $0 program to launch args."
exit 1
fi
# Make sure the program being launched exists
command -v "${1%% *}" &> /dev/null || exit 1
for i in /tmp/fenrirscreenreader-*.sock ; do
if [[ "$i" != "/tmp/fenrirscreenreader-deamon.sock" ]]; then
echo -n "setting set screen#suspendingScreen=pty" | socat - UNIX-CLIENT:$i
fi
done
#/usr/bin/urxvt -name "${1%% *}" -e fenrir -d -s /etc/fenrirscreenreader/settings/xterm.conf -o "general.shell=/usr/bin/${1%% *};remote#socketFile=/tmp/fenrirscreenreader-${1%% *}.sock"
/usr/bin/urxvt -name "${1%% *}" -e ../src/fenrir -d -s ./xterm.conf -o "general.shell=/usr/bin/${1%% *};remote#socketFile=/tmp/fenrirscreenreader-${1%% *}.sock"

35
play zone/start1.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
# clilauncher.sh
# Description: Launches xterm with give application and fenrir.
#
# Copyright 2019, F123 Consulting, <information@f123.org>
# Copyright 2019, Storm Dragon, <storm_dragon@linux-a11y.org>
#
# This is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3, or (at your option) any later
# version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this package; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
#--code--
rm -rf /tmp/fenrir*
for i in /tmp/fenrirscreenreader-*.sock ; do
if [[ "$i" != "/tmp/fenrirscreenreader-deamon.sock" ]]; then
echo -n "setting set screen#suspendingScreen=pty" | socat - UNIX-CLIENT:$i
fi
done
/usr/bin/urxvt -name "${1%% *}" -e ../src/fenrir -s ./xterm.conf -o "general.shell=./waitForKey1;remote#socketFile=/tmp/fenrirscreenreader-waitForKey1.sock"

33
play zone/start2.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
# clilauncher.sh
# Description: Launches xterm with give application and fenrir.
#
# Copyright 2019, F123 Consulting, <information@f123.org>
# Copyright 2019, Storm Dragon, <storm_dragon@linux-a11y.org>
#
# This is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3, or (at your option) any later
# version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this package; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
#--code--
for i in /tmp/fenrirscreenreader-*.sock ; do
if [[ "$i" != "/tmp/fenrirscreenreader-deamon.sock" ]]; then
echo -n "setting set screen#suspendingScreen=pty" | socat - UNIX-CLIENT:$i
fi
done
/usr/bin/urxvt -name "${1%% *}" -e ../src/fenrir -d -s ./xterm.conf -o "general.shell=./waitForKey2;remote#socketFile=/tmp/fenrirscreenreader-waitForKey2.sock"

14
play zone/waitForKey1 Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
echo "1"
echo "Press 'q' to exit"
count=0
while : ; do
read -n 1 k <&1
if [[ $k = q ]] ; then
printf "\nQuitting from the program\n"
break
else
((count=$count+1))
echo "Press 'q' to exit"
fi
done

14
play zone/waitForKey2 Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
echo "2"
echo "Press 'q' to exit"
count=0
while : ; do
read -n 1 k <&1
if [[ $k = q ]] ; then
printf "\nQuitting from the program\n"
break
else
((count=$count+1))
echo "Press 'q' to exit"
fi
done

193
play zone/xterm.conf Normal file
View File

@ -0,0 +1,193 @@
[sound]
enabled=True
driver=genericDriver
theme=default
volume=1.0
# shell commands for generic sound driver
genericPlayFileCommand=play -q -v fenrirVolume fenrirSoundFile
genericFrequencyCommand=play -q -v fenrirVolume -n -c1 synth fenrirDuration sine fenrirFrequence
[speech]
enabled=True
driver=speechdDriver
#driver=genericDriver
serverPath=
rate=0.85
pitch=0.5
# Pitch for capital letters
capitalPitch=0.9
#module=espeak
voice=bdl
#language=en
volume=1.0
autoReadIncoming=True
# genericSpeechCommand is the command that is executed for talking
# the following variables are replaced with values
# fenrirText = is the text that should be spoken
# fenrirModule = may be the speech module like used in speech-dispatcher, not every TTY need this
# fenrirLanguage = the language
# fenrirVoice = is the current voice that should be used
# the current volume, pitch and rate is calculated like this
# value = min + settingValue * (min - max )
# fenrirVolume = is replaced with the current volume
# fenrirPitch = is replaced with the current pitch
# fenrirRate = is replaced with the current speed (speech rate)
genericSpeechCommand=espeak -a fenrirVolume -s fenrirRate -p fenrirPitch -v fenrirVoice -- "fenrirText"
# these are the min and max values of the TTS system that is used in genericSpeechCommand
fenrirMinVolume=0
fenrirMaxVolume=200
fenrirMinPitch=0
fenrirMaxPitch=99
fenrirMinRate=80
fenrirMaxRate=890
[braille]
enabled=True
driver=brlttyDriver
#layout=en
# to what should the flush timeout relate to
# word = flush after (number of words to display) * seconds
# char = flush after (number of chars to display) * seconds
# fix = flush after X seconds
# none = no automatic flush (manual via shortcut)
flushMode=word
# seconds to flush or
# -1 = no automatic flush (manual via shortcut)
flushTimeout=3
# how should the cursor be focused?
# page = if cursor cross the border move to next page and start at beginn
# fixCell = ajust the cursor on an special cell where it is always placed. the display scroll here more smooth.
cursorFocusMode=page
# define the cell on the Braille device where fenrir should scroll and keep the cursor
# 0 = first cell on device
# -1 = last cell on device
# >0 = fix cell number
fixCursorOnCell=-1
#How should the braille follow the focus
# none = no automatic toggle command used
# review = priority to review
# last = follow last used cursor
cursorFollowMode=last
# number of cells in panning (horizontal)
# 0 = display size, >0 number of cells
panSizeHorizontal=0
[screen]
driver=ptyDriver
encoding=auto
screenUpdateDelay=0.05
suspendingScreen=1
autodetectSuspendingScreen=False
[keyboard]
driver=evdevDriver
# filter input devices NOMICE, ALL or a DEVICE NAME
device=ALL
grabDevices=True
ignoreShortcuts=False
keyboardLayout=desktop
charEcho=False
charDeleteEcho=True
wordEcho=False
interruptOnKeyPress=True
# you can filter the keys on that the speech should interrupt (empty = all keys, otherwhise the given keys)
interruptOnKeyPressFilter=
# timeout for double tap in sec
doubleTapTimeout=0.2
[general]
debugLevel=1
# debugMode sets where the debug output should send to:
# debugMode=File writes to debugFile (Default: /var/log/fenrirscreenreader/fenrir.log)
# debugMode=Print just prints on the screen
debugMode=File
debugFile=
punctuationProfile=default
punctuationLevel=some
respectPunctuationPause=True
newLinePause=True
numberOfClipboards=10
# used path for "export_clipboard_to_file"
# $user is replaced by username
clipboardExportPath=/tmp/fenrirClipboard
emoticons=True
fenrirKeys=KEY_KP0,KEY_CAPSLOCK
scriptKeys=KEY_META,KEY_COMPOSE
timeFormat=%H:%M:%P
dateFormat="%A, %B %d, %Y"
autoSpellCheck=True
spellCheckLanguage=en_US
scriptPath=/usr/share/fenrirscreenreader/scripts
# overload commands, and create new one without changing Fenrir default
commandPath=
#fenrirBGColor = the backgroundcolor
#fenrirFGColor = the foregroundcolor
#fenrirUnderline = speak the underline attribute
#fenrirBold = speak the bold attribute
#fenrirBlink = speak the blink attribute
#fenrirFont = the font
#fenrirFontSize = the fontsize
attributeFormatString=Background fenrirBGColor,Foreground fenrirFGColor,fenrirUnderline,fenrirBold,fenrirBlink, Font fenrirFont,Fontsize fenrirFontSize
autoPresentIndent=False
# play a sound when attributes are changeing
hasAttributes=False
# shell for PTY emulatiun (empty = default shell)
shell=
[focus]
#follow the text cursor
cursor=True
#follow highlighted text changes
highlight=False
[remote]
enable=True
# connection type
# unix = unix sockets
# tcp = tcp (localhost only)
method=unix
# tcp port
port=22447
# socket filepath
socketpath=/tmp/
# allow settings to overwrite
enableSettingsRemote=True
# allow commands to be executed
enableCommandRemote=True
[barrier]
enabled=True
leftBarriers=│└┌─
rightBarriers=│┘┐─
[review]
lineBreak=True
endOfScreen=True
# leave the review when pressing a key
leaveReviewOnCursorChange=True
# leave the review when changing the screen
leaveReviewOnScreenChange=True
[promote]
enabled=True
inactiveTimeoutSec=120
list=
[time]
# automatic time anouncement
enabled=False
# present time
presentTime=True
# present date (on change)
presentDate=True
# present time after x seconds
delaySec=0
# present time after to given minutes example every 15 minutes: 00,15,30,45
# if delaySec is >0 onMinutes is ignored
onMinutes=00,30
# announce via soundicon
announce=True
# interrupt current speech for time announcement
interrupt=False

View File

@ -59,13 +59,23 @@ class inputManager():
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
self.executeDeviceGrab = False
return
print(self.env['runtime']['screenManager'].getCurrScreenIgnored())
if self.env['runtime']['screenManager'].getCurrScreenIgnored():
if self.ungrabAllDevices():
self.executeDeviceGrab = False
while not self.ungrabAllDevices():
time.sleep(0.1)
self.env['runtime']['debug'].writeDebugOut("retry ungrabAllDevices " ,debug.debugLevel.WARNING)
print('try ungrabbing')
self.env['runtime']['debug'].writeDebugOut("All devices ungrabbed" ,debug.debugLevel.INFO)
print('ungrabbed')
else:
while not self.grabAllDevices():
time.sleep(0.1)
self.executeDeviceGrab = False
time.sleep(0.2)
self.env['runtime']['debug'].writeDebugOut("retry grabAllDevices" ,debug.debugLevel.WARNING)
print('try grabbing')
print('grabbed')
self.env['runtime']['debug'].writeDebugOut("All devices grabbed" ,debug.debugLevel.INFO)
self.executeDeviceGrab = False
def sendKeys(self, keyMacro):
for e in keyMacro:
key = ''
@ -316,7 +326,7 @@ class inputManager():
shortcutRepeat = int(key)
except:
if not self.isValidKey(key.upper()):
self.env['runtime']['debug'].writeDebugOut("invalid key : "+ key.upper() + ' command:' +commandName ,debug.debugLevel.WARNING)
self.env['runtime']['debug'].writeDebugOut("invalid key : "+ key.upper() + ' command:' +commandName ,debug.debugLevel.WARNING)
invalid = True
break
shortcutKeys.append(key.upper())

View File

@ -158,6 +158,9 @@ class remoteManager():
self.env['runtime']['settingsManager'].resetSettingArgDict()
def setSettings(self, settingsArgs):
self.env['runtime']['settingsManager'].parseSettingArgs(settingsArgs)
self.env['runtime']['screenManager'].getCurrScreen()
self.env['runtime']['screenManager'].getSessionInformation()
self.env['runtime']['screenManager'].updateScreenIgnored()
def handleRemoteIncomming(self, eventData):
if not eventData:
return

View File

@ -349,7 +349,8 @@ class driver(inputDriver):
self.gDevices[fd] = True
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: grab device ('+ str(self.iDevices[fd].name) + ')',debug.debugLevel.INFO)
except IOError:
return False
if not self.gDevices[fd]:
return False
# self.gDevices[fd] = True
# #self.removeDevice(fd)
except Exception as e:
@ -364,7 +365,8 @@ class driver(inputDriver):
self.gDevices[fd] = False
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: ungrab device ('+ str(self.iDevices[fd].name) + ')',debug.debugLevel.INFO)
except IOError:
return False
if self.gDevices[fd]:
return False
# self.gDevices[fd] = False
# #self.removeDevice(fd)
except Exception as e: