Skip to content

Use Socket

Q.Z.Lin edited this page Oct 2, 2021 · 2 revisions

adb forward tcp:9999 localabstract:minitouch

Start minitouch before sending command
adb shell /data/local/tmp/minitouch

Use python tcp demo for sending command

import socket

addr = ('localhost', 9999)

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(addr)

command = 'v\nd 0 10 10 50\nc\nu 0\nc'
s.send(command.encode())

msg = s.recv(1024)

s.close()
print(msg.decode('utf-8'))

reference: Source Code of williamfzc/pyminitouch

Clone this wiki locally