Desidero inviare "CTRL + W" a Chrome per Android per chiudere la scheda attiva. Ho provato un sacco di cose ma non c'è successo per raggiungerlo dal terminale. (Se connetto una tastiera USB con OTG, posso chiudere la scheda con CTRL + W)Simulazione della combinazione di pressioni dei tasti dal terminale ADB
In primo luogo non voglio scrivere un'applicazione per questo, voglio solo un comando di shell per usarlo da Tasker.
Ho letto da qualche parte che per raggiungere questo (CTRL + W pressione di un tasto), devo simulare dei tasti in questo modo:
premuto Ctrl
Giù W
Up W
Fino CTRL
E per raggiungere questo dal terminale, sembra che devo usare "sendevent".
Posso simulare tutti i tasti hardware con "sendevent" ma non posso simulare i normali tasti con esso.
Ad esempio, per il basso e fino al tasto POWER:
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
io uso questo comanda, ma non riesco a usare questi comandi per inviare tasti normali. (ad esempio a, b, c, ecc.)
L'evento1 è il gpio-keys, quindi lo sto utilizzando. E tutti gli altri eventi di input sono sensori e uno è il driver di ricarica. (Max77693-muic)
L'uscita del "getevent -p" dice che:
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 device 2: /dev/input/event6
name: "barometer_sensor"
events:
REL (0002): 0000 0001 0002
input props:
<none>
add device 3: /dev/input/event5
name: "light_sensor"
events:
REL (0002): 0000 0001 0002 0009
input props:
<none>
add 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 device 5: /dev/input/event3
name: "gyro_sensor"
events:
REL (0002): 0003 0004 0005
input props:
<none>
could not get driver version for /dev/input/mice, Not a typewriter
add device 6: /dev/input/event7
name: "Midas_WM1811 Midas Jack"
events:
KEY (0001): 0072 0073 00e2
SW (0005): 0002 0004
input props:
<none>
add device 7: /dev/input/event1
name: "gpio-keys"
events:
KEY (0001): 0072 0073 0074 00ac
input props:
<none>
add device 8: /dev/input/event0
name: "max77693-muic"
events:
KEY (0001): 0072 0073 00a3 00a4 00a5
input props:
<none>
add device 9: /dev/input/event8
name: "sec_touchkey"
events:
KEY (0001): 008b 009e
LED (0011): 0008
input props:
<none>
add 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
Anche il mio tasti GPIO file di layout "/system/usr/keylayout/gpio-keys.kl" come questo:
key 115 VOLUME_UP WAKE
key 114 VOLUME_DOWN WAKE
key 116 POWER WAKE
key 172 HOME WAKE
posso inviare tutti keyevents normali con:
"input keyevent KEYCODE_X"
e di inviare più di una:
"input keyevent KEYCODE_X KEYCODE_Y"
Si dovrebbe pensare il possibile funziona così:
"input keyevent KEYCODE_CTRL_LEFT KEYCODE W"
ma KeyEvent su e giù subito e non posso utilizzarlo per inviare combinazione CTRL + W.
Lo so, la risposta dovrebbe essere con "sendevent". Ma non riesco a trovare.
Ho anche provato ad aggiungere alcuni tasti falsi nel file di layout dei tasti in questo modo:
key 115 VOLUME_UP WAKE
key 114 VOLUME_DOWN WAKE
key 116 POWER WAKE
key 172 HOME WAKE
key 19 Q
ho riavviato il telefono, poi provato:
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
Ma non è mai scrive "Q" in la qualsiasi casella di testo.
Si prega di aiuto, grazie per il vostro aiuto.
La soluzione è arrivata dopo due anni, grazie. Ho provato e funziona benissimo. – Yusuf