-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.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-keyboard
and--hid-mouse
while 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--otg
on Windows.Concretely:
open_a_terminal_here.bat
(extracted from the release)scrcpy --otg
Fixes #2773
Here is an unofficial release with this branch, so that you can test and report issues:
scrcpy-otg-windows-win64.zip
sha256:6cb1a9e01441fedb9618fa98b8403aecbed39bc7167e8edd3f44fb6227591b8dscrcpy-otg-windows-win32.zip
sha256: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-libgcc
must 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