-
-
Notifications
You must be signed in to change notification settings - Fork 11k
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
Windows, ADB, and OTG #3050
Comments
Thank you for your report. Indeed, I can reproduce, but I don't understand why it worked when I implemented it (I am pretty sure that this was one of the first things I tested). I even retested with the initial binaries posted on #3011, it does not work anymore. 😦 I had a forced Windows update since then, but it would be surprising that this could cause this issue… The problem is that it ignores the device because it could not read the device serial: diff --git a/app/src/usb/usb.c b/app/src/usb/usb.c
index 32a66f98..97aa9a33 100644
--- a/app/src/usb/usb.c
+++ b/app/src/usb/usb.c
@@ -15,6 +15,7 @@ read_string(libusb_device_handle *handle, uint8_t desc_index) {
(unsigned char *) buffer,
sizeof(buffer));
if (result < 0) {
+ LOGD("Read string: libusb error: %s", libusb_strerror(result));
return NULL;
}
Refs #3011 (comment) I will investigate. |
@vsutardja (refs #2773) Could you reproduce the issue? |
I enabled libusb logs at warning level: diff --git a/app/src/usb/usb.c b/app/src/usb/usb.c
index 32a66f98..bcec9b60 100644
--- a/app/src/usb/usb.c
+++ b/app/src/usb/usb.c
@@ -219,7 +222,11 @@ sc_usb_select_device(struct sc_usb *usb, const char *serial,
bool
sc_usb_init(struct sc_usb *usb) {
usb->handle = NULL;
- return libusb_init(&usb->context) == LIBUSB_SUCCESS;
+ bool ok = libusb_init(&usb->context) == LIBUSB_SUCCESS;
+ if (ok) {
+ libusb_set_option(usb->context, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_WARNING);
+ }
+ return ok;
}
void Here is the result if USB debugging is disabled:
Calling Looks like libusb/libusb#761. |
If enabling/disabling ADB means toggling the USB Debugging setting in the phone's Developer Options, then I can reproduce this issue as well. With it disabled, my Pixel 6 actually appears under Device Manager as a different device (Portable Device instead of Android Device) with a different PID (4EE1 instead of 4EE7) using a different driver (WUDFWpdMtp instead of WinUSB). What might be happening is that the driver used when USB Debugging is disabled is automatically picked up by a Windows system component which then claims the device, much like how a running I think a distinction should be made between |
@vsutardja Thank you very much for your tests and explanations 👍 So it seems it's not a good news for OTG without USB debugging on Windows :( |
Environment
Describe the bug
Apologies if I'm misunderstanding but the existing notes for the OTG function states that ADB is not necessary, but that doesn't actually seem to be the case. Without ADB enabled, "scrcpy --otg" always results in:
"ERROR: Could not find any USB device"
When ADB is enabled, then it works fine - but the interesting thing is that it works even if RSA permission is not granted. Plus, when initializing OTG, scrcpy kills the adb daemon anyways. So maybe there's a flag that's causing it to refuse to start OTG if it doesn't see an ADB device, even though ADB itself isn't needed/used?
Behavior tested and verified to be identical on:
Pixel 5 w/ Android 11
S21 Ultra w/ Android 12
LG G4 w/ Android 6
Moto X4 with Android 9
The text was updated successfully, but these errors were encountered: