only update charmap when needed - speedup

This commit is contained in:
chrys87 2018-06-07 18:16:12 +02:00 committed by GitHub
parent 099995f57b
commit 103186cacd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -106,6 +106,7 @@ class driver(screenDriver):
tty = open('/sys/devices/virtual/tty/tty0/active','r') tty = open('/sys/devices/virtual/tty/tty0/active','r')
currScreen = str(tty.read()[3:-1]) currScreen = str(tty.read()[3:-1])
oldScreen = currScreen oldScreen = currScreen
self.updateCharMap(currScreen)
watchdog = select.epoll() watchdog = select.epoll()
watchdog.register(vcsa[currScreen], select.POLLPRI | select.POLLERR) watchdog.register(vcsa[currScreen], select.POLLPRI | select.POLLERR)
watchdog.register(tty, select.POLLPRI | select.POLLERR) watchdog.register(tty, select.POLLPRI | select.POLLERR)
@ -127,6 +128,7 @@ class driver(screenDriver):
watchdog.register(vcsa[ currScreen ], select.POLLPRI | select.POLLERR) watchdog.register(vcsa[ currScreen ], select.POLLPRI | select.POLLERR)
except: except:
pass pass
self.updateCharMap(currScreen)
oldScreen = currScreen oldScreen = currScreen
try: try:
vcsa[currScreen].seek(0) vcsa[currScreen].seek(0)
@ -157,7 +159,6 @@ class driver(screenDriver):
def createScreenEventData(self, screen, content): def createScreenEventData(self, screen, content):
self.updateCharMap(screen)
eventData = { eventData = {
'bytes': content, 'bytes': content,
'lines': int( content[0]), 'lines': int( content[0]),