android - Simulating combination of key presses from ADB terminal -
android - Simulating combination of key presses from ADB terminal -
hi, want send "ctrl + w" chrome android close active tab. tried lots of things there no success accomplish terminal. (if connect usb keyboard otg, can close tab ctrl+w)
firstly not want write application this, want shell command utilize tasker.
i read somewhere accomplish (ctrl+w keypress), have simulate key presses this:
down ctrl downwards w w ctrl
and accomplish terminal, seems have utilize "sendevent".
i can simulate hardware keypress "sendevent" can not simulate normal keys it.
for example, downwards , powerfulness key:
sendevent /dev/input/event1 1 116 1 sendevent /dev/input/event1 0 0 0 sendevent /dev/input/event1 1 116 0 sendevent /dev/input/event1 0 0 0
i utilize commands, can not utilize commands send normal keys. (for illustration a,b,c etc)
the event1 gpio-keys, i'm using it. , other input events sensors , 1 charging driver. (max77693-muic)
the output of "getevent -p" says that:
add device 1: /dev/input/event9 name: "compass_sensor" events: rel (0002): 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 input props: <none> add together device 2: /dev/input/event6 name: "barometer_sensor" events: rel (0002): 0000 0001 0002 input props: <none> add together device 3: /dev/input/event5 name: "light_sensor" events: rel (0002): 0000 0001 0002 0009 input props: <none> add together device 4: /dev/input/event4 name: "proximity_sensor" events: abs (0003): 0019 : value 1, min 0, max 1, fuzz 0, flat 0, resolution 0 input props: <none> add together device 5: /dev/input/event3 name: "gyro_sensor" events: rel (0002): 0003 0004 0005 input props: <none> not driver version /dev/input/mice, not typewriter add together device 6: /dev/input/event7 name: "midas_wm1811 midas jack" events: key (0001): 0072 0073 00e2 sw (0005): 0002 0004 input props: <none> add together device 7: /dev/input/event1 name: "gpio-keys" events: key (0001): 0072 0073 0074 00ac input props: <none> add together device 8: /dev/input/event0 name: "max77693-muic" events: key (0001): 0072 0073 00a3 00a4 00a5 input props: <none> add together device 9: /dev/input/event8 name: "sec_touchkey" events: key (0001): 008b 009e led (0011): 0008 input props: <none> add together device 10: /dev/input/event2 name: "sec_touchscreen" events: abs (0003): 002f : value 0, min 0, max 9, fuzz 0, flat 0, resolution 0 0030 : value 0, min 0, max 255, fuzz 0, flat 0, resolution 0 0031 : value 0, min 0, max 255, fuzz 0, flat 0, resolution 0 0032 : value 0, min 0, max 30, fuzz 0, flat 0, resolution 0 0035 : value 0, min 0, max 719, fuzz 0, flat 0, resolution 0 0036 : value 0, min 0, max 1279, fuzz 0, flat 0, resolution 0 0039 : value 0, min 0, max 65535, fuzz 0, flat 0, resolution 0 003c : value 0, min -90, max 90, fuzz 0, flat 0, resolution 0 003d : value 0, min 0, max 1, fuzz 0, flat 0, resolution 0 input props: input_prop_direct
also gpio-keys layout file "/system/usr/keylayout/gpio-keys.kl" this:
key 115 volume_up wake key 114 volume_down wake key 116 powerfulness wake key 172 home wake
i can send normal keyevents with:
"input keyevent keycode_x"
and send more one:
"input keyevent keycode_x keycode_y"
you should think can works this:
"input keyevent keycode_ctrl_left keycode w"
but keyevent downwards , immediatly , can not utilize send ctrl+w combination.
i know, reply should "sendevent". can not find.
i tried adding false keys key layout file this:
key 115 volume_up wake key 114 volume_down wake key 116 powerfulness wake key 172 home wake key 19 q
i restarted phone, tried:
sendevent /dev/input/event1 1 19 1 sendevent /dev/input/event1 0 0 0 sendevent /dev/input/event1 1 19 0 sendevent /dev/input/event1 0 0 0
but never writes "q" textbox.
please help, helps.
the events
section in getevent -p
output lists accepted key codes:
add device 7: /dev/input/event1 name: "gpio-keys" events: key (0001): 0072 0073 0074 00ac
i.e. volume_up
(0x73), volume_down
(0x72), power
(0x74) , home
(0xac) in case of /dev/input/event1
. else gets filtered out linux kernel input driver long before reaches android framework (where layout files tried modify used)
android input adb keyevent
Comments
Post a Comment