ADB command:
adb shell input text <string> input text to device (the text box where the cursor is located)
adb shell input keyevent <event_code> send key event to device
The key event KeyCode is as follows:
0 --> "Keycode_unknown" 1 --> "Keycode_menu" 2 --> " Keycode_soft_right "3 --> " Keycode_home "4 --> " KEYCODE_BACK "5 --> "Keycode_call" 6 --> "Keycode_endcall" 7 --> " Keycode_0 " 8 --> " Keycode_1 " 9 --> " keycode_2 " 10 -- > "Keycode_3" 11 --> "Keycode_4" 12 --> "Keycode_5" 13 --> "Keycode_6" 14 --> "Keycode_7" 15 --> "Keycode_8" 16 --> "Keycode_9" 17 --> "Keycode_ STAR " 18 --> " Keycode_pound " 19 --> " Keycode_dpad_up " 20 --> "Keycode_dpad_down" 21 --> "Keycode_dpad_left" 22 -- > "KEYCODE_DPAD_right "23 --> " Keycode_dpad_center " 24 --> " keycode_volume_up " 25 --> "Keycode_volume_down" 26 --> "Keycode_power" 27 --> "Keycode_camera" 28 --> "Keycode_clear" 29 --> "Keycode_a" 30 --> "Keycode_b" 31 --> "Keycode_c" 32 --> "Keycode_d" 33 --> "Keycode_e" 34 --> "Keycode_f" 35 --> "Keycode_g" 36 --> "Keycode_h" 37 --> "Keycode_i" 38 --> "Keycode_j" 39 --> "Keycode_k" 40 --> "keycode_l" 41 --> "Keycode_m" 42 --> "Keycode_n" 43 --> "Keycode_o" 44 --> "Keycode_p" 45 --> "Keycode_q" 46 --> "Keycode_r" 47 --> "Keycode_ S " 48 --> " keycode_t " 49 --> " Keycode_u " 50 --> "Keycode_v" 51 --> "Keycode_w" 52 --> "keycode_x" 53 --> "keycode_y" 54 --> "Keycode_z" 55 --> "Keycode_comma" 56 --> "Keycode_period" 57 --> "Keycode_alt_ Left " 58 --> " Keycode_alt_right " 59 --> " Keycode_shift_left " 60 --> "Keycode_shift_right" 61 --> "Keycode_tab" 62 --> "Keycode_space" 63 --> "Keycode_sym" 64 --> "Keycode_explorer" 65 --> "Keycode_envelope" 66 --> " Keycode_enter " 67 --> "Keycode_del" 68 --> "Keycode_grave" 69 --> "Keycode_minus" 70 --> "Keycode_equals" 71 --> "Keycode_left_ Bracket " 72 --> " Keycode_right_bracket " 73 --> " Keycode_ Backslash " 74 --> " Keycode_semicolon " 75 --> " Keycode_ Apostrophe "76 --> " Keycode_slash " 77 --> " Keycode_at " 78 --> "Keycode_num" 79 --> "Keycode_headsethook" 80 --> "Keycode_focus" 81 --> "Keycode_plus" 82 --> "KEYCODE_MENU" 83 - -> "Keycode_notification" 84 --> "Keycode_search" 85 --> "Tag_last_keycode"
ADB command Send KeyEvent