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

scrcpy exits spontaneously a few times a day #4508

Open
2 tasks
freebrowser1 opened this issue Dec 6, 2023 · 6 comments
Open
2 tasks

scrcpy exits spontaneously a few times a day #4508

freebrowser1 opened this issue Dec 6, 2023 · 6 comments

Comments

@freebrowser1
Copy link

  • I have read the FAQ.
  • I have searched in existing issues.

Environment

  • OS: macOS
  • scrcpy version: 2.2
  • installation method: from homebrew
  • device model: OnePlus 6
  • Android version: 10

Describe the bug
When connected wired via USB cable, it just exits a few times during a work day. After restart it runs a couple of hours and then it exits again spontaneously.
This does not happen when connected wirelessly.

% scrcpy -S -s <deviceID> -m 1024 -K
scrcpy v2.2 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     -->   (usb)  <deviceID>                        device  ONEPLUS_A6003
/Users/user/homebrew/Cellar/scrcpy/2.2/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 56.6 MB/s (64363 bytes in 0.001s)
[server] INFO: Device: [OnePlus] OnePlus ONEPLUS A6003 (Android 10)
[server] WARN: Audio disabled: it is not supported before Android 11
INFO: USB device found:
INFO:         0000000000000001   (2109:0100)  VIA Technologies Inc.          USB 2.0 BILLBOARD             
INFO:     --> <deviceID>           (2a70:9011)  OnePlus OnePlus
INFO:         058F84688461       (058f:8468)  Generic Mass Storage Device
INFO: USB device: <deviceID> (2a70:9011) OnePlus OnePlus
INFO: Renderer: metal
WARN: Demuxer 'audio': stream explicitly disabled by the device
INFO: Texture: 1024x504
[server] INFO: Device screen turned off

This terminal output appears when it spontaneously exits:

WARN: Device disconnected
ERROR: UNREGISTER_HID: libusb error: Input/Output Error
WARN: Could not unregister HID keyboard
@rom1v
Copy link
Collaborator

rom1v commented Dec 6, 2023

WARN: Device disconnected

This happens when the adb connection gets closed.

This may happen due to USB cable/port issue, or when USB is reconfigured (when you enable/disable MTP for example).

This is not specific to scrcpy: if you run adb shell or adb logcat in a separate terminal, you'll observe they will terminate at the same time as scrcpy.

@freebrowser1
Copy link
Author

freebrowser1 commented Dec 7, 2023

WARN: Device disconnected

This happens when the adb connection gets closed.

This may happen due to USB cable/port issue, or when USB is reconfigured (when you enable/disable MTP for example).

This is not specific to scrcpy: if you run adb shell or adb logcat in a separate terminal, you'll observe they will terminate at the same time as scrcpy.

But adb should not terminate spontaneously. I never use MTP and never reconfigure USB when the device is connected using scrcpy.

@rom1v
Copy link
Collaborator

rom1v commented Dec 7, 2023

But adb should not terminate spontaneously.

From the adb perspective, this is exactly as if the device was disconnected.

If you run an adb command and unplug the device, the adb command terminates.

I never use MTP and never reconfigure USB when the device is connected using scrcpy.

Try with another cable or USB port then.

@freebrowser1
Copy link
Author

The issue also occurs when connected via wifi, but less frequently.

@rom1v
Copy link
Collaborator

rom1v commented Dec 12, 2023

The issue also occurs when connected via wifi, but less frequently.

Yes, this can happen too. Sometimes the adb server (in the device ROM) just crashes on the device (check your adb logcat).

Anyway, this is a problem at the adb level, if the adb connection is closed, scrcpy detects that the device is disconnected.

In theory, it could try to reconnect during a certain period, but it's too complicated for a workaround. This can be done by an external script which restarts if scrcpy terminates with an error (cf #721).

@shodanx2
Copy link

shodanx2 commented Jun 1, 2024

This solution might work for you
#721 (comment)

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

No branches or pull requests

3 participants