scrcpy icon indicating copy to clipboard operation
scrcpy copied to clipboard

Client for Server 2.4

Open fazerlab opened this issue 1 year ago • 4 comments

I´m using a Python module https://github.com/leng-yue/py-scrcpy-client as reference to develop a Python client just to control (touch). .With Server 1.20 work fine. I tried with version 2.4 and don´t work. I think that protocol change. In my code i used the package:

 b =  b'\x02'
 b += b'\x00' #down
 b += b'\xff\xff\xff\xff\xff\xff\xff\xff'
 b += struct.pack('>I', int(300)) # x
 b += struct.pack('>I', int(600)) # y
 b += struct.pack('>h', int(1920))
 b += struct.pack('>h', int(1200))
 b += b'\xff\xff'  # Pressure
 b += b'\x00\x00\x00\x01'  # Event button primary

The server initilization that is working is:

adb push scrcpy-server /data/local/tmp/scrcpy-server.jar
adb shell CLASSPATH=/data/local/tmp/scrcpy-server.jar app_process / com.genymobile.scrcpy.Server  1.20 info  0 8000000 0  -1 true - false true 0 false  false -  -  false

Thank´s for help

fazerlab avatar Mar 27 '24 15:03 fazerlab

The current protocol is documented here: https://github.com/Genymobile/scrcpy/blob/master/doc/develop.md#protocol

rom1v avatar Mar 27 '24 15:03 rom1v

I will try, but some example ou could be helpfull

fazerlab avatar Mar 27 '24 17:03 fazerlab

I will try, but some example ou could be helpfull

Hi, but I think scrcpy.c is the best example.

Tryanks avatar Apr 01 '24 07:04 Tryanks

I´m using a Python module https://github.com/leng-yue/py-scrcpy-client as reference to develop a Python client just to control (touch). .With Server 1.20 work fine. I tried with version 2.4 and don´t work. I think that protocol change. In my code i used the package:

 b =  b'\x02'
 b += b'\x00' #down
 b += b'\xff\xff\xff\xff\xff\xff\xff\xff'
 b += struct.pack('>I', int(300)) # x
 b += struct.pack('>I', int(600)) # y
 b += struct.pack('>h', int(1920))
 b += struct.pack('>h', int(1200))
 b += b'\xff\xff'  # Pressure
 b += b'\x00\x00\x00\x01'  # Event button primary

The server initilization that is working is:

adb push scrcpy-server /data/local/tmp/scrcpy-server.jar
adb shell CLASSPATH=/data/local/tmp/scrcpy-server.jar app_process / com.genymobile.scrcpy.Server  1.20 info  0 8000000 0  -1 true - false true 0 false  false -  -  false

Thank´s for help

Try this and see if it can help you. https://github.com/me2sy/MYScrcpy/blob/1.1.1/myscrcpy/controller/control_socket_controller.py See the function > ControlSocketController.packet__touch()

me2sy avatar Jul 28 '24 12:07 me2sy