try remove sound for virtual devices
This commit is contained in:
parent
55e9f9e4b4
commit
0e8ebc43b4
@ -1,22 +0,0 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core import debug
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
def run(self):
|
||||
pass
|
||||
#self.env['runtime']['inputManager'].updateInputDevices()
|
||||
def setCallback(self, callback):
|
||||
pass
|
@ -1,25 +0,0 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core import debug
|
||||
import time
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.lastTime = time.time()
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
def run(self):
|
||||
if time.time() - self.lastTime > 2:
|
||||
self.env['runtime']['outputManager'].playSoundIcon(soundIcon = 'accept', interrupt=True)
|
||||
lastTime = time.time()
|
||||
def setCallback(self, callback):
|
||||
pass
|
35
src/fenrirscreenreader/commands/onPlugInputDevice/plugSound.py
Executable file
35
src/fenrirscreenreader/commands/onPlugInputDevice/plugSound.py
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Fenrir TTY screen reader
|
||||
# By Chrys, Storm Dragon, and contributers.
|
||||
|
||||
from fenrirscreenreader.core import debug
|
||||
import time
|
||||
|
||||
class command():
|
||||
def __init__(self):
|
||||
pass
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.lastTime = time.time()
|
||||
self.tempDisable = False
|
||||
def shutdown(self):
|
||||
pass
|
||||
def getDescription(self):
|
||||
return 'No description found'
|
||||
def run(self):
|
||||
if time.time() - self.lastTime > 5:
|
||||
if not self.isTempDisable():
|
||||
self.env['runtime']['outputManager'].playSoundIcon(soundIcon = 'accept', interrupt=True)
|
||||
else:
|
||||
self.resetTempDisable()
|
||||
lastTime = time.time()
|
||||
def setCallback(self, callback):
|
||||
pass
|
||||
def setTempDisable(self):
|
||||
self.tempDisable = True
|
||||
def resetTempDisable(self):
|
||||
self.tempDisable = False
|
||||
def isTempDisable(self):
|
||||
return self.tempDisable
|
@ -152,8 +152,19 @@ class inputManager():
|
||||
except Exception as e:
|
||||
pass
|
||||
def handlePlugInputDevice(self, eventData):
|
||||
self.env['runtime']['inputManager'].updateInputDevices(eventData)
|
||||
|
||||
playSound = False
|
||||
for deviceEntry in eventData:
|
||||
self.env['runtime']['inputManager'].updateInputDevices(deviceEntry['device'])
|
||||
# dont play sounds for virtual devices
|
||||
try:
|
||||
playSound = playSound or not deviceEntry['virtual']
|
||||
except:
|
||||
playSound = True
|
||||
if not playSound:
|
||||
try:
|
||||
self.env['commands']['onPlugInputDevice']['PLUGSOUND'].setTempDisable()
|
||||
except:
|
||||
pass
|
||||
def updateInputDevices(self, newDevice = None):
|
||||
try:
|
||||
self.env['runtime']['inputDriver'].updateInputDevices(newDevice)
|
||||
|
@ -70,13 +70,13 @@ class driver(inputDriver):
|
||||
while device:
|
||||
self.env['runtime']['debug'].writeDebugOut('plugInputDeviceWatchdogUdev:' + str(device), debug.debugLevel.INFO)
|
||||
try:
|
||||
#if not '/sys/devices/virtual/input/' in device.sys_path:
|
||||
virtual = '/sys/devices/virtual/input/' in device.sys_path
|
||||
if device.device_node:
|
||||
validDevices.append(str(device.device_node))
|
||||
validDevices.append({'device': device.device_node, 'virtual': virtual})
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
device = monitor.poll(0.1)
|
||||
device = monitor.poll(0.5)
|
||||
except:
|
||||
device = None
|
||||
if validDevices:
|
||||
@ -149,6 +149,8 @@ class driver(inputDriver):
|
||||
deviceFileList = None
|
||||
|
||||
if newDevices and not init:
|
||||
if not isinstance(newDevices, list):
|
||||
newDevices = [newDevices]
|
||||
deviceFileList = newDevices
|
||||
else:
|
||||
deviceFileList = evdev.list_devices()
|
||||
|
Loading…
Reference in New Issue
Block a user