try out TTY detection
This commit is contained in:
parent
5b3e5eecf6
commit
c2d01cd780
11
TODO
11
TODO
@ -11,11 +11,6 @@ http://serverfault.com/questions/306854/how-to-find-out-the-currently-active-lin
|
||||
http://mielke.cc/brltty/doc/Manual-BrlAPI/English/BrlAPI.html
|
||||
https://git.gnome.org/browse/orca/tree/src/orca/braille.py
|
||||
|
||||
- implement speechdriver speechd
|
||||
https://git.gnome.org/browse/orca/tree/src/orca/speech.py
|
||||
https://git.gnome.org/browse/orca/tree/src/orca/speechdispatcherfactory.py
|
||||
http://devel.freebsoft.org/doc/speechd/speech-dispatcher.html#Client-Programming
|
||||
|
||||
- implement speechdriver generic (say)
|
||||
- threading ReadContent, ReadShortcuts, executeCommands, listenNewTTYsForListen, controllThread (main)
|
||||
- debugging
|
||||
@ -45,3 +40,9 @@ it seems we have this info in vcsa
|
||||
|
||||
- get current cursor
|
||||
|
||||
- implement speechdriver speechd
|
||||
https://git.gnome.org/browse/orca/tree/src/orca/speech.py
|
||||
https://git.gnome.org/browse/orca/tree/src/orca/speechdispatcherfactory.py
|
||||
http://devel.freebsoft.org/doc/speechd/speech-dispatcher.html#Client-Programming
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@ runtime = {
|
||||
'running':True,
|
||||
'columns': 0,
|
||||
'lines': 0,
|
||||
'screenDriver': '/dev/vcsa3',
|
||||
'screenDriver': '/dev/vcsa',
|
||||
'delta': '',
|
||||
'oldCursor':{'x':0,'y':0},
|
||||
'oldContentBytes': b'',
|
||||
@ -23,15 +23,25 @@ runtime = {
|
||||
'newContentBytes': b'',
|
||||
'newContentText': '',
|
||||
'newContentAttrib': b'',
|
||||
'oldTTY':'0',
|
||||
'newTTY':'0',
|
||||
'speechDriverString':'sd',
|
||||
'speechDriver': sd.speech()
|
||||
}
|
||||
|
||||
while(runtime['running']):
|
||||
# read screen
|
||||
vcsa = open(runtime['screenDriver'],'rb')
|
||||
runtime['newContentBytes'] = vcsa.read()
|
||||
vcsa.close()
|
||||
currTTY = open('/sys/devices/virtual/tty/tty0/active','r')
|
||||
runtime['newTTY'] = currTTY.read()[3:-1]
|
||||
currTTY.close()
|
||||
runtime['newTTY'] = '3'
|
||||
try:
|
||||
vcsa = open(runtime['screenDriver'] + runtime['newTTY'] ,'rb')
|
||||
runtime['newContentBytes'] = vcsa.read()
|
||||
vcsa.close()
|
||||
except:
|
||||
print(runtime['screenDriver'] + runtime['newTTY'])
|
||||
continue
|
||||
|
||||
# get metadata like cursor or screensize
|
||||
runtime['lines'] = int( runtime['newContentBytes'][0])
|
||||
@ -43,6 +53,12 @@ while(runtime['running']):
|
||||
runtime['newContentText'] = str(runtime['newContentBytes'][4:][::2].decode('cp1252').encode('utf-8'))
|
||||
runtime['newContentAttrib'] = runtime['newContentBytes'][5:][::2]
|
||||
runtime['newContentText'] = '\n'.join(textwrap.wrap(runtime['newContentText'], runtime['columns']))
|
||||
if runtime['newTTY'] != runtime['oldTTY']:
|
||||
runtime['oldContentBytes'] = b''
|
||||
runtime['oldContentAttrib'] = b''
|
||||
runtime['oldContentText'] = ''
|
||||
runtime['oldCursor']['x'] = 0
|
||||
runtime['oldCursor']['y'] = 0
|
||||
|
||||
# changes on the screen
|
||||
if runtime['oldContentBytes'] != runtime['newContentBytes']:
|
||||
@ -62,4 +78,4 @@ while(runtime['running']):
|
||||
runtime['oldContentTextAttrib'] = runtime['newContentAttrib']
|
||||
runtime['oldCursor']['x'] = runtime['newCursor']['x']
|
||||
runtime['oldCursor']['y'] = runtime['newCursor']['y']
|
||||
|
||||
runtime['oldTTY'] = runtime['newTTY']
|
||||
|
@ -63,7 +63,7 @@ class speech():
|
||||
if not self.isInitialized:
|
||||
return False
|
||||
try:
|
||||
self.sd..set_output_module(module)
|
||||
self.sd.set_output_module(module)
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user