From ee24881169308196da40c9b96b1583d4fa9e697f Mon Sep 17 00:00:00 2001 From: chrys Date: Sat, 1 Oct 2016 03:06:16 +0200 Subject: [PATCH] respect device setting for keyboard values are AUTO, ALL, and a device name --- config/settings/settings.conf | 15 ++++++++------- config/settings/settings.conf.orig | 3 ++- config/settings/settings.conf.storm | 3 ++- src/fenrir-package/inputDriver/evdev.py | 16 +++++++++++----- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/config/settings/settings.conf b/config/settings/settings.conf index a850ba33..dd1a81ae 100644 --- a/config/settings/settings.conf +++ b/config/settings/settings.conf @@ -58,7 +58,7 @@ voice= language=english-us # Read new text as it happens? -autoReadIncomming=True +autoReadIncoming=True [braille] #braille is not implemented yet @@ -70,22 +70,23 @@ driver=linux encoding=cp850 screenUpdateDelay=0.4 suspendingScreen= -autodetectSuspendingScreen=False +autodetectSuspendingScreen=True [keyboard] driver=evdev -device=all +# filter input devices AUTO, ALL or a DEVICE NAME +device=AUTO # gives fenrir exclusive access to the keyboard and let consume keystrokes. just disable on problems. grabDevices=True ignoreShortcuts=False # the current shortcut layout located in /etc/fenrir/keyboard -keyboardLayout=test +keyboardLayout=desktop # echo chars while typing. -charEcho=True +charEcho=False # echo deleted chars charDeleteEcho=True # echo word after pressing space -wordEcho=True +wordEcho=False # interrupt speech on any keypress interruptOnKeyPress=False # timeout for double tap in sec @@ -96,7 +97,7 @@ debugLevel=0 punctuationLevel=Some numberOfClipboards=10 # define the current fenrir key -fenrirKeys=KEY_KP0 +fenrirKeys=KEY_KP0,KEY_META timeFormat=%H:%M:%P dateFormat=%A, %B %d, %Y autoSpellCheck=True diff --git a/config/settings/settings.conf.orig b/config/settings/settings.conf.orig index 9c1a1417..13711a11 100644 --- a/config/settings/settings.conf.orig +++ b/config/settings/settings.conf.orig @@ -72,7 +72,8 @@ autodetectSuspendingScreen=True [keyboard] driver=evdev -device=all +# filter input devices AUTO, ALL or a DEVICE NAME +device=AUTO # gives fenrir exclusive access to the keyboard and let consume keystrokes. just disable on problems. grabDevices=True ignoreShortcuts=False diff --git a/config/settings/settings.conf.storm b/config/settings/settings.conf.storm index 702bf13b..d7ac3576 100644 --- a/config/settings/settings.conf.storm +++ b/config/settings/settings.conf.storm @@ -31,7 +31,8 @@ autodetectSuspendingScreen=False [keyboard] driver=evdev -device=all +# filter input devices AUTO, ALL or a DEVICE NAME +device=AUTO grabDevices=True ignoreShortcuts=False keyboardLayout=desktop diff --git a/src/fenrir-package/inputDriver/evdev.py b/src/fenrir-package/inputDriver/evdev.py index 9258b86b..9bb262e8 100644 --- a/src/fenrir-package/inputDriver/evdev.py +++ b/src/fenrir-package/inputDriver/evdev.py @@ -60,11 +60,17 @@ class driver(): # 1 Keys # we try to filter out mices and other stuff here self.iDevices = map(evdev.InputDevice, (evdev.list_devices())) - self.iDevices = {dev.fd: dev for dev in self.iDevices if 1 in dev.capabilities() and not 3 in dev.capabilities() and not 2 in dev.capabilities()} - #self.iDevices = {dev.fd: dev for dev in self.iDevices if 1 in dev.capabilities()} - self.ledDevices = map(evdev.InputDevice, (evdev.list_devices())) - self.ledDevices = {dev.fd: dev for dev in self.ledDevices if 1 in dev.capabilities() and 17 in dev.capabilities() and not 3 in dev.capabilities() and not 2 in dev.capabilities()} - + self.ledDevices = map(evdev.InputDevice, (evdev.list_devices())) + if self.env['runtime']['settingsManager'].getSetting('keyboard', 'device').upper() == 'ALL': + self.iDevices = {dev.fd: dev for dev in self.iDevices if 1 in dev.capabilities()} + self.ledDevices = {dev.fd: dev for dev in self.ledDevices if 1 in dev.capabilities() and 17 in dev.capabilities()} + elif self.env['runtime']['settingsManager'].getSetting('keyboard', 'device').upper() == 'AUTO': + self.iDevices = {dev.fd: dev for dev in self.iDevices if 1 in dev.capabilities() and not 3 in dev.capabilities() and not 2 in dev.capabilities()} + self.ledDevices = {dev.fd: dev for dev in self.ledDevices if 1 in dev.capabilities() and 17 in dev.capabilities() and not 3 in dev.capabilities() and not 2 in dev.capabilities()} + else: + self.iDevices = {dev.fd: dev for dev in self.iDevices if dev.name.upper() in self.env['runtime']['settingsManager'].getSetting('keyboard', 'device').upper()} + self.ledDevices = {dev.fd: dev for dev in self.ledDevices if dev.name.upper() in self.env['runtime']['settingsManager'].getSetting('keyboard', 'device').upper()} + def mapEvent(self, event): if not event: return None