Update vcsaDriver.py

This commit is contained in:
chrys 2019-02-28 17:52:52 +01:00 committed by GitHub
parent 16d657e761
commit 47bcaa425b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -123,12 +123,15 @@ class driver(screenDriver):
try: try:
watchdog.unregister(vcsa[ oldScreen ]) watchdog.unregister(vcsa[ oldScreen ])
except: except:
pass print('watchdog.unregister: '+ str(e))
try: try:
watchdog.register(vcsa[ currScreen ], select.POLLPRI | select.POLLERR) watchdog.register(vcsa[ currScreen ], select.POLLPRI | select.POLLERR)
except: except Exception as e:
pass print('watchdog.register: '+ str(e))
self.updateCharMap(currScreen) try:
self.updateCharMap(currScreen)
except Exception as e:
print('updateCharMap: '+ str(e))
oldScreen = currScreen oldScreen = currScreen
try: try:
vcsa[currScreen].seek(0) vcsa[currScreen].seek(0)
@ -144,6 +147,7 @@ class driver(screenDriver):
dirtyContent = vcsa[currScreen].read() dirtyContent = vcsa[currScreen].read()
screenContent = b'' screenContent = b''
timeout = time.time() timeout = time.time()
print('dirty ' + str(currScreen))
while screenContent != dirtyContent: while screenContent != dirtyContent:
screenContent = dirtyContent screenContent = dirtyContent
if time.time() - timeout >= 0.4: if time.time() - timeout >= 0.4:
@ -194,8 +198,10 @@ class driver(screenDriver):
unipairs = array("H", [0]*(2*sz)) unipairs = array("H", [0]*(2*sz))
unimapdesc = array("B", pack("@HP", sz, unipairs.buffer_info()[0])) unimapdesc = array("B", pack("@HP", sz, unipairs.buffer_info()[0]))
ioctl(tty.fileno(), GIO_UNIMAP, unimapdesc) ioctl(tty.fileno(), GIO_UNIMAP, unimapdesc)
print('updateCharMap sz good')
break break
except Exception as e: except Exception as e:
print('updateCharMap sz wrong: ' + str(e))
self.env['runtime']['debug'].writeDebugOut('VCSA:updateCharMap:scaling up sz=' + str(sz) + ' ' + str(e),debug.debugLevel.WARNING) self.env['runtime']['debug'].writeDebugOut('VCSA:updateCharMap:scaling up sz=' + str(sz) + ' ' + str(e),debug.debugLevel.WARNING)
sz *= 2 sz *= 2
tty.close() tty.close()
@ -204,11 +210,13 @@ class driver(screenDriver):
for u, b in zip(utable[::2], utable[1::2]): for u, b in zip(utable[::2], utable[1::2]):
if self.charmap.get(b) is None: if self.charmap.get(b) is None:
self.charmap[b] = chr(u) self.charmap[b] = chr(u)
print('charmap ' + str(self.charmap[b]))
def autoDecodeVCSA(self, allData, rows, cols): def autoDecodeVCSA(self, allData, rows, cols):
allText = '' allText = ''
allAttrib = [] allAttrib = []
i = 0 i = 0
print('autoDecodeVCSA start')
for y in range(rows): for y in range(rows):
lineText = '' lineText = ''
lineAttrib = [] lineAttrib = []