Skip to content
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

Unlocking from scrcpy makes scrcpy quit #597

Closed
raphj opened this issue Jun 15, 2019 · 15 comments
Closed

Unlocking from scrcpy makes scrcpy quit #597

raphj opened this issue Jun 15, 2019 · 15 comments
Labels

Comments

@raphj
Copy link

raphj commented Jun 15, 2019

I am using scrcpy though Wifi with a phone running LineageOS 16.

When the screen is off and the device is locked, I run scrcpy.
I see the locked screen. Typing the pin code unlocks the phone, and makes scrcpy quit without any error message.

If I am connected to the phone using an adb shell, the session is interrupted too when unlocking.

I y try to re-run scrcpy right after, I get this error:

adb: error: failed to get feature set: device unauthorized.
This adb server's $ADB_VENDOR_KEYS is not set
Try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.
ERROR: "adb push" returned with value 1

If I wait a few seconds, scrcpy works again and shows the phone screen, unlocked.
When the device locks itself after inactivity, scrcpy quits (I can reconnect just after).

Should a workaround be implemented in scrcpy to handle this interruption?

@rom1v
Copy link
Collaborator

rom1v commented Jun 15, 2019

Is it really related to unlocking? It looks like a "fragile" cable. It never happens in other situations?

@raphj
Copy link
Author

raphj commented Jun 15, 2019

It's on Wifi. I don't know if it happens when connected with a cable and I don't have one to test this at the moment, sorry.
It is always in this situation, always in the same conditions. I don't think this is a Wifi reliability issue. I was downloading something on the phone and the download was not interrupted.

@rom1v
Copy link
Collaborator

rom1v commented Jun 15, 2019

OK, it's weird that unlocking the device disconnects adb. 😞

@rom1v rom1v added the adb label Jun 15, 2019
@raphj
Copy link
Author

raphj commented Nov 4, 2019

I'm not sure I'm still seeing this. I still think that you may want to implement a workaround for this issue, or not, so feel free to close.

Thanks again for scrcpy, very useful!

@rom1v
Copy link
Collaborator

rom1v commented Nov 4, 2019

I still think that you may want to implement a workaround for this issue, or not, so feel free to close.

It's definitely an adb connection issue anyway:

adb: error: failed to get feature set: device unauthorized.

So I'm closing 👍

@rom1v rom1v closed this as completed Nov 4, 2019
@srevinsaju
Copy link

srevinsaju commented Nov 5, 2019

@raphj, in LOS, try going to USB settings in Developer options and select 'No Data Transfer's and keep 'USB debugging' with 'Show USB debugging notification' on. This might help you. This usually happens when you toggle the 'ADB over WiFi Switch' which doesn't allow PC's ADB to initiate the connection. Doing it using the
$ adb tcpip 5555

Will surely solve the problem. Next option is to update the ADB to latest version. Hope it helps!

@rom1v
Copy link
Collaborator

rom1v commented Jun 4, 2020

Also see: #1382 (comment)

@mohammadZahedian
Copy link

@raphj, in LOS, try going to USB settings in Developer options and select 'No Data Transfer's and keep 'USB debugging' with 'Show USB debugging notification' on. This might help you. This usually happens when you toggle the 'ADB over WiFi Switch' which doesn't allow PC's ADB to initiate the connection. Doing it using the $ adb tcpip 5555

Will surely solve the problem. Next option is to update the ADB to latest version. Hope it helps!

Sent from my Galaxy Note2 using FastHub

change usb setting to "No Data Transfer's" worked for me
weird is that i was connected wirelessly!

@Uj947nXmRqV2nRaWshKtHzTvckUUpD
Copy link

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented Jan 7, 2022

@raphj, in LOS, try going to USB settings in Developer options and select 'No Data Transfer's and keep 'USB debugging' with 'Show USB debugging notification' on. This might help you. This usually happens when you toggle the 'ADB over WiFi Switch' which doesn't allow PC's ADB to initiate the connection. Doing it using the $ adb tcpip 5555
Will surely solve the problem. Next option is to update the ADB to latest version. Hope it helps!
Sent from my Galaxy Note2 using FastHub

change usb setting to "No Data Transfer's" worked for me weird is that i was connected wirelessly!

This fixed it for me as well. Really weird, as in my case I was also connecting wirelessly (wifi).

Note: under developer options, the option is called 'Default USB configuration' (Android 11). There is also another 'USB Preferences' menu when searching android settings by 'USB', but that only changes temporarilly the mode when the cable is plugged, after disconnecting the cable the mode is reverted back to the 'Default USB configuration' which is the one that must be changed to 'No Data Transfer'

In my case scrcpy was quitting both when locking and unlocking when 'Default USB configuration' was set to 'File Transfer'

Is there any explanation for this strange behavior?

@rom1v
Copy link
Collaborator

rom1v commented Jan 7, 2022

Is there any explanation for this strange behavior?

Yes, if the mode is changed between the locked/unlocked mode, it might changes the USB vendor id / product id, causing adb to disconnect (not only scrcpy, if you run adb shell or adb logcat it would also close)

Check the vendor id and product id with lsusb in both modes.

@Uj947nXmRqV2nRaWshKtHzTvckUUpD

Indeed, adb shell disconnectes as well. lsusb doesn't return anything in my case.

@rom1v
Copy link
Collaborator

rom1v commented Jan 7, 2022

lsusb doesn't return anything in my case.

lsusb lists no devices? 🤔

@Uj947nXmRqV2nRaWshKtHzTvckUUpD

Yes, even with cable connected and under root shell

@bonnebulle
Copy link

Me too, after unlocking (screen lock), I need to re.lanch scrcpy
( with or without cable, on Wifi :5555 or not )
( am an Android 11 user )

@xweiba
Copy link

xweiba commented Mar 1, 2024

I solved this problem by changing the default USB configuration to charge only

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants