prepare keyboard grab

This commit is contained in:
chrys 2016-08-10 02:09:49 +02:00
parent 03d8dcd751
commit 6eceeee07b
11 changed files with 197 additions and 0 deletions

1
TODO
View File

@ -23,6 +23,7 @@ ToDos in Priority order:
- implement onScreenChange commands
read highlighted text mode
window mode (define a area and just read that changes)
promoted text
- autostart systemd
- implement braille

View File

@ -1,3 +1,4 @@
1-KEY_KP0=fenrirKey
1-KEY_LEFTCTRL=shut_up
1-KEY_RIGHTCTRL=shut_up
1-KEY_KP8=curr_line

View File

@ -25,6 +25,8 @@ screenUpdateDelay=0.4
[keyboard]
device=all
grabDevices=True
ignoreShortcuts=False
keyboardLayout=desktop
charEcho=False
charDeleteEcho=True

View File

@ -0,0 +1,38 @@
[sound]
enabled=True
driver=sox
theme=default
volume=1.0
[speech]
enabled=True
driver=speechd
rate=0.75
pitch=0.5
volume=1.0
module=espeak
voice=de
language=de
autoReadIncomming=True
[braille]
enabled=False
layout=en
[screen]
driver=linux
screenUpdateDelay=0.4
[keyboard]
device=all
grabDevices=True
ignoreShortcuts=False
keyboardLayout=desktop
charEcho=True
charDeleteEcho=True
wordEcho=True
interruptOnKeyPress=False
[general]
debugLevel=0
punctuationLevel=1

View File

@ -0,0 +1,38 @@
[sound]
enabled=True
driver=sox
theme=default
volume=1.0
[speech]
enabled=True
driver=espeak
rate=0.75
pitch=0.5
module=espeak
voice=en-us
language=en-us
volume=1.0
autoReadIncomming=True
[braille]
enabled=False
layout=en
[screen]
driver=linux
screenUpdateDelay=0.4
[keyboard]
device=all
grabDevices=True
ignoreShortcuts=False
keyboardLayout=desktop
charEcho=False
charDeleteEcho=True
wordEcho=False
interruptOnKeyPress=False
[general]
debugLevel=0
punctuationLevel=1

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,40 @@
#!/bin/python
import evdev
from evdev import InputDevice, UInput
from select import select
import time
iDevices = map(evdev.InputDevice, (evdev.list_devices()))
iDevices = {dev.fd: dev for dev in iDevices if dev.fn in ['/dev/input/event18']}
uDevices = {}
for fd in iDevices:
dev = iDevices[fd]
uDevices[fd] = UInput()
dev.grab()
# dev.capabilities(),
# dev.name,
# dev.info.vendor,
# dev.info.product,
# dev.version,
# dev.info.bustype,
# '/dev/uinput'
# )
i = 0
while i < 10:
r, w, x = select(iDevices, [], [])
if r != []:
i += 1
for fd in r:
for event in iDevices[fd].read():
if event.code != 30:
uDevices[fd].write_event(event)
uDevices[fd].syn()
#print('Devicename:'+ devices[fd].name + ' Devicepath:' + devices[fd].fn + ' Events:' + str(devices[fd].active_keys(verbose=True)) + ' Value:' + str(event.value))
for fd in iDevices:
iDevices[fd].ungrab()

View File

@ -35,6 +35,8 @@ settings = {
},
'keyboard':{
'device':"all",
'grabDevices':True,
'ignoreShortcuts':False,
'keyboardLayout': "desktop",
'charEcho':False,
'charDeleteEcho':True,

73
tools/configure_pulse.sh Executable file
View File

@ -0,0 +1,73 @@
#!/bin/bash
# This script configures pulse to work both in the graphical invironment and in the console with root apps.
if [[ $(whoami) != "root" ]]; then
# Get the current user's XDG_HOME
xdgPath="${XDG_CONFIG_HOME:-$HOME/.config}"
# Warn user if we are going to overwrite an existing default.pa
if [ -f "$xdgPath/pulse/default.pa" ]; then
read -p "This will replace the current file located at $xdgPath/pulse/default.pa, press enter to continue or control+c to abort. " continue
fi
echo '.include /etc/pulse/default.pa
load-module module-native-protocol-unix auth-anonymous=1 socket=/tmp/pulse.sock' > $xdgPath/pulse/default.pa
echo "If you have not yet done so, please run this script as root to write the client.conf file."
else
# This section does the root part:
xdgPath="/root/.config"
mkdir -p "$xdgPath/pulse"
# Warn user if we are going to overwrite an existing default.pa
if [ -f "$xdgPath/pulse/default.pa" ]; then
read -p "This will replace the current file located at $xdgPath/pulse/default.pa, press enter to continue or control+c to abort. " continue
fi
cat << EOF > "$xdgPath/pulse/client.conf"
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio 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 Lesser General Public License
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
## Configuration file for PulseAudio clients. See pulse-client.conf(5) for
## more information. Default values are commented out. Use either ; or # for
## commenting.
; default-sink =
; default-source =
default-server = unix:/tmp/pulse.sock
; default-dbus-server =
autospawn = no
; autospawn = yes
; daemon-binary = /usr/bin/pulseaudio
; extra-arguments = --log-target=syslog
; cookie-file =
; enable-shm = yes
; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB
; auto-connect-localhost = no
; auto-connect-display = no
EOF
echo "If you have not yet done so, run this script as your normal user to write the user default.pa"
fi
# If there were no errors tell user to restart, else warn them errors happened.
if [ $? -eq 0 ]; then
echo "Configuration created succeswsfully, restart pulse, or your system, for changes to take affect."
else
echo "Errors were encountered while writing the configuration. please correct them manually."
fi
exit 0

1
tools/traceEvdev.py Normal file → Executable file
View File

@ -1,3 +1,4 @@
#!/bin/python
import evdev
from evdev import InputDevice
from select import select