Explorar el Código

Update 'CARDPUTER CircuitPython/keyboard.py'

cube hace 1 mes
padre
commit
4e7418e93b
Se han modificado 1 ficheros con 7 adiciones y 7 borrados
  1. 7
    7
      CARDPUTER CircuitPython/keyboard.py

+ 7
- 7
CARDPUTER CircuitPython/keyboard.py Ver fichero

23
             "0x4":"CTRLD", "0x13":"CTRLS", "0x9":"    ", "0x60":"ESC", "0xf":"CTRLO"
23
             "0x4":"CTRLD", "0x13":"CTRLS", "0x9":"    ", "0x60":"ESC", "0xf":"CTRLO"
24
         }
24
         }
25
 
25
 
26
-    def scan(self):
27
-        code=hex(ord(sys.stdin.read(1)))
26
+    def scan(self, keycode = None):
27
+        if not keycode:
28
+            code=hex(ord(sys.stdin.readline(1)))
29
+        else:
30
+            code = keycode
28
         #printing the code can be useful for debugging purposes, to check that the codes have been logged correctly if something unexpected is happening
31
         #printing the code can be useful for debugging purposes, to check that the codes have been logged correctly if something unexpected is happening
29
         #print(code)
32
         #print(code)
30
         key = None
33
         key = None
39
         elif code in self.special:
42
         elif code in self.special:
40
             key = self.special[code]
43
             key = self.special[code]
41
             
44
             
42
-        if key:
43
-            return key
44
-        else:
45
-            return "UNKNOWN "+code
45
+        return key
46
 
46
 
47
     def is_alphanumeric(self, key):
47
     def is_alphanumeric(self, key):
48
         if key in self.special.values() or key in self.chars.values():
48
         if key in self.special.values() or key in self.chars.values():
49
             return False
49
             return False
50
         else:
50
         else:
51
-            return True
51
+            return True