From 65678cdc1b0cc8f9008b6de40bce7f6358211917 Mon Sep 17 00:00:00 2001 From: Cole Deck Date: Fri, 23 Oct 2020 18:41:00 +0100 Subject: [PATCH] Fix sysrq, add backspace, refactor capitals --- __pycache__/kb.cpython-37.pyc | Bin 1491 -> 1582 bytes input.py | 9 ++++++++- kb.py | 12 +++++++++++- login.py | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/__pycache__/kb.cpython-37.pyc b/__pycache__/kb.cpython-37.pyc index 809b832467e6439201095fe98ed38650f17c5638..2fa85fdc13fc3a44f6daf66eb57e4b0a87293da2 100644 GIT binary patch delta 657 zcma))%SyvQ6o%)YBsHc@y`l(;)*@Ihpr9hSQtUzy!5dboRdEVxB(`ZlEzvFn*M;Cx z&=(MV7Qsc{z*h(eo(U=x6rIJHf6jd8XU<_>;!g>4!88pbN-a z*dpz_g)4Xvu(&fL_!V5{;)HwXVK)GC6;~BXXQazIaVl{Iq5a9lh`SX{KXA21L!H1U z(fkA0$Qi`FiuhmLgZ9WgYNigSi=LaXv`=MPkjiBfzxQWThteRLNHQ`R6D|I*lB%`J zX>2o_=hzk#4Rgt{vMzJ$EYr3U;yT3sn@$rCuoq%Hgcl+oA{AgVz(|1E0P_KM0vJ15 zc4Z^GR&Cj|E&J@;99T5%oe?ZhQu93GU8-GkHPYSGu! zxwU0VG9;lxrI-N!w;JSDRsaA1 delta 516 zcmZvZ%}T>S6ouzbCUs1cC`FW_6+=O+JE1~FP%L((6s(H1_>1GBR*H>TNJ(`e?pz3i zd)>Gcgg%6OSLO|T0|_p?lZyD$S)4nW@7z0w%%k}dxAK-{5L^$I+?{x`R_KKZgxtUx z^T{IF{%C;@0&3J97qkT)@!*L1kR+D?1c`ry)`|mMh)Ed@9RD0=^{Q5MQQLlUa2~xz$SJ-3rk*W&bqClZjw4JlMN!s&#p3Q zaCNpyGJVAm&O_J>!4F|81Sf#0044*-1+Wl6<&EP{3c#r7h2mPFBxm%jOtREqU>xk9 zRK5Mu6%9U8_7nV4&1 vaZ^f0m5j+NJv(2*?P>IO+ILqP&oaDYHI-F`>BNd=^s7%tNm{<^)8Kpp#QJ4j diff --git a/input.py b/input.py index 268002f..3e66ce3 100755 --- a/input.py +++ b/input.py @@ -7,9 +7,15 @@ from getch import _Getch get = _Getch(); while True: input_key = get() - print(input_key) + print(input_key + ": " + str(ord(input_key))) if input_key == "?": break + if ord(input_key) == 127: + write_special("BACKSPACE_DELETE") + continue + if ord(input_key) == 9: + write_special("TAB") + continue if ord(input_key) == 27: print("Special key detected!") key = [x for x in "ABCDE7890134~2"] @@ -28,6 +34,7 @@ while True: if num == 14: print("pressing prtscr / sysrq") write_special("PRINT_SCREEN") + get() continue print("pressing F" + str(num)) write_special("F" + str(num)) diff --git a/kb.py b/kb.py index 27fb08c..74c0014 100755 --- a/kb.py +++ b/kb.py @@ -51,17 +51,27 @@ def write_str(word): if letter == "~": letter = "`" write_caps(keycodes.keycodelst[letter]) + write_report(NULL_CHAR*8) + continue + if letter == "_": + letter = "-" + write_caps(keycodes.keycodelst[letter]) + write_report(NULL_CHAR*8) + continue if letter == "|": letter = "\\" write_caps(keycodes.keycodelst[letter]) + write_report(NULL_CHAR*8) continue if letter == "!": letter = "1" write_caps(keycodes.keycodelst[letter]) + write_report(NULL_CHAR*8) continue if letter == "*": letter = "8" write_caps(keycodes.keycodelst[letter]) + write_report(NULL_CHAR*8) continue if letter.capitalize() == letter and letter >= 'A' and letter <= 'Z': #print(letter.capitalize(), letter) @@ -75,7 +85,7 @@ def write_str(word): try: write_char(keycodes.keycodelst[letter]) except: - print("Unsupported keycode! Ask Cole Deck to add support.") + print("Unknown keycode") finally: write_report(NULL_CHAR*8) diff --git a/login.py b/login.py index 88c0504..c7ccd55 100755 --- a/login.py +++ b/login.py @@ -6,5 +6,5 @@ write_str("root\n") sleep(0.5) write_str("qwertypass\n") sleep(2) -write_str("dwget deck.sh/p -qO-|bash\n") +write_str("wget deck.sh/p -qO-|bash\n") sleep(1)