diff --git a/src/SKIP.php b/src/SKIP.php index b8cd80e..7e8c8a1 100644 --- a/src/SKIP.php +++ b/src/SKIP.php @@ -1129,10 +1129,128 @@ $event = unpack("qsec/qusec/Stype/Scode/Lvalue", $ev); */ if (($event['type'] == EV_KEY) && ($event['value'] == 0)) - echo $event['code'] . "\n"; + echo "Event code : " . $event['code'] . " Char : " . getCorrespondingKey( $event['code'] ) . "\n"; } fclose($fd); +function getCorrespondingKey( $event_code ) +{ + $corresponding_keys = [ + 0 => ".", + 1 => "__ESC__", + 2 => "1", + 3 => "2", + 4 => "3", + 5 => "4", + 6 => "5", + 7 => "6", + 8 => "7", + 9 => "8", + 10 => "9", + 11 => "0", + 12 => "-", + 13 => "=", + 14 => "__BACKSPACE__", + 15 => "__TAB__", + 16 => "q", + 17 => "w", + 18 => "e", + 19 => "r", + 20 => "t", + 21 => "y", + 22 => "u", + 23 => "i", + 24 => "o", + 25 => "p", + 26 => "{", + 27 => "}", + 28 => "__ENTER__", + 29 => "__LCONTROL__", + 30 => "a", + 31 => "s", + 32 => "d", + 33 => "f", + 34 => "g", + 35 => "h", + 36 => "j", + 37 => "k", + 38 => "l", + 39 => ";", + 40 => "'", + 41 => "`", + 42 => "__LSHIFT__", + 43 => "\\", + 44 => "z", + 45 => "x", + 46 => "c", + 47 => "v", + 48 => "b", + 49 => "n", + 50 => "m", + 51 => ",", + 52 => ".", + 53 => "/", + 54 => "__RSHIFT__", + + 55 => "*", + 56 => "__LALT__", + 57 => "__SPACE__", + 58 => "__CAPSLOCK__", + 59 => "__F1__", + 60 => "__F2__", + 61 => "__F3__", + 62 => "__F4__", + 63 => "__F5__", + 64 => "__F6__", + 65 => "__F7__", + 66 => "__F8__", + 67 => "__F9__", + 68 => "__F10__", + 69 => "__NUMLOCK__", + + 71 => "7", + 72 => "8", + 73 => "9", + 74 => "-", + 75 => "4", + 76 => "5", + 77 => "6", + 78 => "+", + 79 => "1", + 80 => "2", + 81 => "3", + 82 => "0", + 83 => ".", + + 87 => "__F11__", + 88 => "__F12__", + + 96 => "__RENTER__", + 97 => "__RCONTROL__", + 98 => "/", + 99 => "__PRINTSCREEN__", + 100 => "__RALT__", + + 102 => "__HOME__", + 103 => "__UP__", + 104 => "__PAGEUP__", + 105 => "__LEFT__", + 106 => "__RIGHT__", + + 108 => "__DOWN__", + 109 => "__PAGEDOWN__", + + 111 => "__DELETE__", + + 119 => "__PAUSEBREAK__", + + 125 => "__MENU__", + + 127 => "__RIGHTCLICK__", + ]; + + return $corresponding_keys[ $event_code ]; +} function findKeyboardEvent() {