-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFrameBufferController.py
More file actions
42 lines (30 loc) · 871 Bytes
/
FrameBufferController.py
File metadata and controls
42 lines (30 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import os
import subprocess
import threading
import time
class FrameBufferController(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.cmd = os.path.dirname( os.path.abspath( __file__ )) + '/fbcp'
def run(self):
fbcp = subprocess.Popen(self.cmd)
self.running = True
while self.running:
pass
else:
fbcp.kill()
def stopController(self):
self.running = False
if __name__ == '__main__':
import sys
try:
controller = FrameBufferController()
controller.start()
print 'Copying framebuffer to /dev/fb1'
time.sleep(10)
except KeyboardInterrupt:
print 'Cancelled'
except:
print 'Unexpected error : ', sys.exc_info()[0], sys.exc_info()[1]
finally:
controller.stopController()