leng-yue / py-scrcpy-client

An easy to use python scrcpy client
https://leng-yue.github.io/py-scrcpy-client/
MIT License
290 stars 74 forks source link

Can I use the repo to send events to scrcpy server on Android from a recorded getevent ? #12

Closed instasck closed 2 years ago

instasck commented 2 years ago

I have the following recorded scroll:

[  116385.268385] 0003 0039 000002c5
[  116385.268385] 0003 0030 00000008
[  116385.268385] 0003 0035 00000186 -  x
[  116385.268385] 0003 0036 0000029c  - y
[  116385.268385] 0001 014a 00000001  -- finger down
[  116385.268385] 0000 0000 00000000
[  116385.300193] 0003 0035 00000185
[  116385.300193] 0003 0036 000002b0
[  116385.300193] 0000 0000 00000000
[  116385.310616] 0003 0035 00000184
[  116385.310616] 0003 0036 000002d1
[  116385.310616] 0000 0000 00000000
[  116385.321030] 0003 0035 00000183
[  116385.321030] 0003 0036 0000030b
[  116385.321030] 0000 0000 00000000
[  116385.331669] 0003 0030 00000007
[  116385.331669] 0003 0035 00000180
[  116385.331669] 0003 0036 000003a1
[  116385.331669] 0000 0000 00000000
[  116385.342048] 0003 0030 00000006
[  116385.342048] 0003 0035 0000017f
[  116385.342048] 0003 0036 000003c9
[  116385.342048] 0000 0000 00000000
[  116385.352433] 0003 0036 000003f1
[  116385.352433] 0000 0000 00000000
[  116385.363175] 0003 0030 00000005
[  116385.363175] 0003 0035 00000180
[  116385.363175] 0003 0036 0000041c
[  116385.363175] 0000 0000 00000000
[  116385.383405] 0003 0039 ffffffff
[  116385.383405] 0001 014a 00000000  -- finger up
[  116385.383405] 0000 0000 00000000

I want to replay it using scrcpy, can it be done ?

leng-yue commented 2 years ago

Of course, you can send this series of events. However, scrolling events on android itself is not reproducible.

instasck commented 2 years ago

scrolling

I see you have the "swipe" option, it is not different from scroll I guess I meant swipe. I need someone to do a job for me, so please tell me if you know anyone: I need to send the events as recorded in getevents. I need to change the device ID used in the motion event over scrcpy (to be sent from the client side)

leng-yue commented 2 years ago

What's the format of your recorded scroll? To begin with, you need to parse it. Then, you can use scrcpy-client to construct events and dispatch them manually.

leng-yue commented 2 years ago

Please refer to the getevent's document https://source.android.com/devices/input/getevent. However, it is hard to use scrcpy to dispatch all kinds of native android events, you can consider ADB's sendevent instead.

instasck commented 2 years ago

Please refer to the getevent's document https://source.android.com/devices/input/getevent. However, it is hard to use scrcpy to dispatch all kinds of native android events, you can consider ADB's sendevent instead.

The issue is that android 10 locked it access to sendevent, I am looking for a solution to that. What will be the different from scrcpy to real touch screen since I know it send the ACTION_DOWN, MOVE, ACTION_UP what the software we controll over in android will see different ? I know touch id is one of them

leng-yue commented 2 years ago

There are so many differences... You will find that scrcpy has much fewer operations than the sendevent.