Commit ebf6c7d4 by mihkevich

fix bug start main.py

parent 69c8c6fd
......@@ -4,6 +4,7 @@ import os, sys
import evdev
import subprocess
from threading import Thread
import time, datetime
log = Log("key_listener")
......@@ -36,13 +37,18 @@ try:
log.info(string_device)
device = evdev.InputDevice(string_device)
keyboard_device=device
log.info(keyboard_device)
for event in keyboard_device.read_loop():
if event.type == evdev.ecodes.EV_KEY and event.value == 0 and event.code == 41:
log.info("event_code: {}".format(event.code))
th = Thread(target=call_main())
th.start()
sleep(2)
log.info(event)
current_time = round(time.time())
log.info("current_time: {}".format(current_time))
log.info("event.sec: {}".format(event.sec))
if (current_time - event.sec < 2):
th = Thread(target=call_main())
th.start()
sleep(1)
except Exception as e:
log.error(log.get_line())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment