-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtouch-screen.py
More file actions
27 lines (25 loc) · 905 Bytes
/
touch-screen.py
File metadata and controls
27 lines (25 loc) · 905 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
import evdev
from evdev import InputDevice, categorize, ecodes, list_devices
devices = map(InputDevice, list_devices())
device=""
for dev in devices:
if "Touchscreen" in dev.name:
device = dev
print device
if device != "":
for event in device.read_loop():
if event.type == ecodes.EV_KEY:
#print categorize(event)
#print event.type, event.code, event.value
if event.code == ecodes.BTN_TOUCH and event.value == 1:
#print 'You touched me'
fr = open('/tmp/marquee-mode', 'r')
mode = fr.readline().replace('\n','')
fr.close()
fw = open('/tmp/marquee-mode', 'w')
if mode == '1':
fw.write('2')
elif mode == '2':
fw.write('1')
fw.close()
print mode