Repository navigation
Add OTG support for Windows - #3011
Conversation
Currently, there is an issue with the libusb prebuilt dll. Refs #3011 <#3011> Refs libusb/#1049 <libusb/libusb#1049>
All adb commands are executed with an "interruptor", so that they can be interrupted on Ctrl+C. Make this interruptor optional, so that we could call "adb kill-server" in OTG mode. This command always returns almost immediately anyway. Ideally, we should make all blocking calls interruptible (including libusb calls, by using the asynchronous API), but it's a lot of work, and in practice it works well enough. PR #3011 <#3011>
Currently, there is an issue with the libusb prebuilt dll. Refs libusb/#1049 <libusb/libusb#1049> PR #3011 <#3011>
|
I disabled the feature for win32 due to this prebuilt dll issue. On Win64, it works as expected. I merge. 🚀 |
|
Thank you for your hard work. Just a minor suggest so I don't want to throw new issue. Do you have any plan to make a Github Action to build automatically for all platforms? For example when each PR is merged to |
|
There is a PR for GitHub Actions: #1709 I spend some time to figure out why, but didn't manage to make it work, then I worked on something else… I should retry (any help is welcome). |
That might be an error on another USB device (that's why it's logged at debug level). Is the device detected by adb (when USB debugging is enabled)? PS: please post console output as text instead of screenshot. |
Yes ,everything else works perfectly except just the OTG function and it says no USB devices. even if I connected multiple devices, the new error screen shows this as a USB device... could windows 11 be a problem? |
|
@54m33r4 #3050 |
scrcpy v1.23 Changes since v1.22: - Add HID/OTG support for Windows (--otg only) (Genymobile#2773, Genymobile#3011) - Add HID/OTG support for macOS (Genymobile#2774, Genymobile#3031) - Improve device selection (list devices, -d, -e) (Genymobile#3005) - Downscale and retry on MediaCodec error in more cases (Genymobile#2990, Genymobile#3043) - Add ZSH completion script (Genymobile#3012) - Add Bash completion script (Genymobile#2930, Genymobile#3048) - Add --no-cleanup option (Genymobile#1764, Genymobile#3020) - Add --printf-fps (Genymobile#468, Genymobile#3030) - Print both compiled and linked version of libs on --version - Fix FPS counter (broken in v1.22) - Various technical refactors and fixes

scrcpy v1.22 introduced a new OTG mode. It was based on HID keyboard introduced in v1.20 and HID mouse also introduced in v1.22. It was only supported on Linux.
On Windows, it is not possible to open a USB device if it is already open by another process (like the adb daemon). As a consequence, we can't send HID events if adb is running. Therefore, on Windows,
--hid-keyboardand--hid-mousewhile mirroring are not possible. These features are still limited to Linux.However, in OTG mode (
--otg), no adb is necessary, so it is possible to open the USB device to send HID events. This PR adds support for--otgon Windows.Concretely:
open_a_terminal_here.bat(extracted from the release)scrcpy --otgFixes #2773
Here is an unofficial release with this branch, so that you can test and report issues:
scrcpy-otg-windows-win64.zipsha256:6cb1a9e01441fedb9618fa98b8403aecbed39bc7167e8edd3f44fb6227591b8dscrcpy-otg-windows-win32.zipsha256:38a397086999c51ff8634915dd3c1f0792587aeccdd6a65961a841a9e5d87db3Note that on my test computer with Windows 10 64bit, the win32 version does not work due to missing
libgcc_s_sjlj-1.dll.According to stackoverflow, a linker flag
-static-libgccmust be added somewhere, but I think it is related to prebuilt libusb dll for win32 (since it works for win64).EDIT: yes, it's a problem on the libusb prebuilt dll for win32: libusb/libusb#1049