basic detect current TTY
This commit is contained in:
parent
7e11695556
commit
1e93905a23
@ -6,6 +6,9 @@
|
|||||||
import hashlib
|
import hashlib
|
||||||
import difflib
|
import difflib
|
||||||
import textwrap
|
import textwrap
|
||||||
|
from subprocess import Popen, PIPE
|
||||||
|
|
||||||
|
import utils.debug
|
||||||
import speech.es as es
|
import speech.es as es
|
||||||
import speech.sd as sd
|
import speech.sd as sd
|
||||||
|
|
||||||
@ -34,13 +37,16 @@ while(runtime['running']):
|
|||||||
currTTY = open('/sys/devices/virtual/tty/tty0/active','r')
|
currTTY = open('/sys/devices/virtual/tty/tty0/active','r')
|
||||||
runtime['newTTY'] = currTTY.read()[3:-1]
|
runtime['newTTY'] = currTTY.read()[3:-1]
|
||||||
currTTY.close()
|
currTTY.close()
|
||||||
runtime['newTTY'] = '3'
|
p = Popen("fgconsole", stdout=PIPE, stderr=PIPE, shell=True)
|
||||||
|
runtime['newTTY'], stderr = p.communicate()
|
||||||
|
runtime['newTTY'] = str(int(runtime['newTTY']))
|
||||||
|
#runtime['newTTY'] = str(currTTY)
|
||||||
try:
|
try:
|
||||||
vcsa = open(runtime['screenDriver'] + runtime['newTTY'] ,'rb')
|
vcsa = open(runtime['screenDriver'] + runtime['newTTY'] ,'rb')
|
||||||
runtime['newContentBytes'] = vcsa.read()
|
runtime['newContentBytes'] = vcsa.read()
|
||||||
vcsa.close()
|
vcsa.close()
|
||||||
except:
|
except:
|
||||||
print(runtime['screenDriver'] + runtime['newTTY'])
|
print('Nope' + runtime['screenDriver'] + runtime['newTTY'])
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# get metadata like cursor or screensize
|
# get metadata like cursor or screensize
|
||||||
|
Loading…
x
Reference in New Issue
Block a user