Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
easy-media-controller
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mihkevich
easy-media-controller
Commits
ebf6c7d4
Commit
ebf6c7d4
authored
Dec 20, 2021
by
mihkevich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug start main.py
parent
69c8c6fd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
key_listener.py
key_listener.py
+11
-5
No files found.
key_listener.py
View file @
ebf6c7d4
...
...
@@ -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
())
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment