Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
105.52k stars 10.24k forks source link

OTG over tcpip mode #3453

Open oyekanwahab opened 1 year ago

oyekanwahab commented 1 year ago

Is your feature request related to a problem? Please describe. I have been using scrcpy for a very long time, all my phones are always rooted, so I always use scrcpy with tcpip, I just discovered that there is an otg mode, which is only accessible with USB

Describe the solution you'd like Is it possible to enable this mode on tcpip mode, since the ADB daemon is not being used by the USB on tcpip mode?

Describe alternatives you've considered

Additional context Add any other context or screenshots about the feature request here.

rom1v commented 1 year ago

No because we can only send HID events on Android using the AOA protocol (over USB).

oyekanwahab commented 1 year ago

ok. I was thinking that it was using ADB

I was thinking you wanted to implement what Deskdock was doing using ADB for mouse and keyboard input

twaik commented 1 year ago

Actually it is possible with root + uinput.

oyekanwahab commented 1 year ago

I have a root device, can you show me how

twaik commented 1 year ago

It will require a lot of modifications inside scrcpy. This case can not be handled in easy way.

oyekanwahab commented 1 year ago

Are you able to get it to work yourself

On Thu, 6 Oct 2022 at 17:17, Twaik Yont @.***> wrote:

It will require a lot of modifications inside scrcpy. This case can not be handled in easy way.

— Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/3453#issuecomment-1270353307, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACUPOVSWTHTMUIHN7ZWEMN3WB33TBANCNFSM57AJFXTA . You are receiving this because you authored the thread.Message ID: @.***>

twaik commented 1 month ago

@rom1v it seems like uinput works fine over ADB TCPIP connection. I can work with https://github.com/Blub/netevent tool cross-compiled to aarch64 with all devices except Xiaomi. I think it can be used to implement capturing PC's keyboard and mouse.

rom1v commented 1 month ago

Since this issue, UHID mode has been implemented: https://github.com/Genymobile/scrcpy/blob/master/doc/keyboard.md#uhid And the feature to control the device without video playback has been added recently (on dev branch): https://github.com/Genymobile/scrcpy/pull/4868

twaik commented 1 month ago

What about emulating mouse this way?

rom1v commented 1 month ago

Mouse is also implemented.

https://github.com/Genymobile/scrcpy/blob/master/doc/mouse.md#uhid

twaik commented 1 month ago

You are right, keyboard works after installing last version from release page. But for some reason mouse does not work. I mean cursor is intercepted, but I do not see it on screen. Also clicks make some weird action I can not really identify. Phone reacts like I swipe up.

rom1v commented 1 month ago

but I do not see it on screen

On some devices, the cursor is not displayed on lock screen.

Does it work on the home screen? (run scrcpy -M)

twaik commented 1 month ago

It does not.

twaik commented 1 month ago

Should I record a video?