scrcpy
scrcpy copied to clipboard
UHID does not work the same as OTG
Environment
- OS: Windows, Android (Termux)
- scrcpy version: 2.4
- installation method: Windows Release, Termux pkg
- device model: XQ-DQ44
- Android version: 14
Describe the bug
If you try to enter in UHID, you will not be able to use it as a replacement for OTG.
In UHID mode, all mouse buttons except left mouse click are treated as special keys (right click is BACK, middle click is HOME).
Also, if there is no video/audio playback, the program will be forced to exit.
~ $ scrcpy --mouse=uhid --keyboard=uhid --no-video --no-audio
scrcpy 2.4 <https://github.com/Genymobile/scrcpy>
ERROR: No video, no audio, no OTG: nothing to do
In UHID mode, all mouse buttons except left mouse click are treated as special keys (right click is BACK, middle click is HOME).
Add --forward-all-clicks
.
Also, if there is no video/audio playback, the program will be forced to exit.
Yes, the reason why OTG exists is to control the device without using USB debugging (adb) and a server on the device. UHID mode requires all that, so in a sense it behaves like the "normal mode".
But it is true that a mode without mirroring could be added, since in UHID mode the mouse is relative (this is not possible with the default mouse mode, because the mouse is absolute, this would be unusable).
It would require quite a lot of changes to support a control-only mode with UHID though.
EDIT: maybe not so much, I will think about it.
Please test #4868.
Excellent performance! Tried it with Termux, very low CPU usage, practical enough.
However, the other issue, the mouse click specification, I still think that all clicks should be forwarded automatically in UHID mode.
Thank you for your test :+1: :tada:
However, the other issue, the mouse click specification, I still think that all clicks should be forwarded automatically in UHID mode.
In many cases, it turns out that pressing BACK with the mouse is more useful than a real right click on an Android device.
In the very first public version of scrcpy (2018), all clicks were forwarded. A few days later, in v1.1, I added this commit: 675704c71c0d105af2242d9bbeee83127097fa0d (suggested by a user and independently by a colleague). In practice, I always use BACK with the mouse. So in my opinion, this is a good default.
I understand that there are cases where it is better not to capture right-click for a shortcut, but at least there is an option to disable it (--forward-all-clicks
).
EDIT: maybe I missed the most important part: in UHID mode (and AOA)
I agree it makes sense, but then we would need a new option to disable it (it's still useful to press BACK or HOME with the mouse).
@shiumano
I agree it makes sense, but then we would need a new option to disable it
Or we can adapt the --forward-all-clicks
option: see PR #4877