-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpedalmapper
More file actions
executable file
·43 lines (32 loc) · 844 Bytes
/
pedalmapper
File metadata and controls
executable file
·43 lines (32 loc) · 844 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
43
#!/usr/bin/python
import sys
import os
pipe = open('/dev/usb/hiddev0','rb')
action = []
spacing = 0
while 1:
for character in pipe.read(1):
action += ['%01X' % ord(character)]
if len(action) == 24:
left = False
right = False
center = False
if action[4] == '1':
left = True
if action[12] == '1':
center = True
if action[20] == '1':
right = True
if center:
os.system('xte "key i"')
if left:
os.system('xte "keydown Shift_L"')
os.system('xte "key i"')
os.system('xte "keyup Shift_L"')
if right:
os.system('xte "keydown Shift_L"')
os.system('xte "key a"')
os.system('xte "keyup Shift_L"')
if not right and not left and not center:
os.system('xte "key Escape"')
action = []