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

Unable to use --no-display --turn-screen-off at the same time #2426

Closed
2 tasks done
mukheshpugal opened this issue Jun 25, 2021 · 9 comments
Closed
2 tasks done

Unable to use --no-display --turn-screen-off at the same time #2426

mukheshpugal opened this issue Jun 25, 2021 · 9 comments
Milestone

Comments

@mukheshpugal
Copy link

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

Environment

  • OS: Ubuntu 18.04
  • scrcpy version: 1.18
  • installation method: linux-brew
  • device model: ONEPLUS A6003
  • Android version: 11

Describe the bug

I'm trying to stream the video to a v4l2 loopback device. Everything seems to work fine except when using the options --no-display --turn-screen-off at the same. There is no windowed display as expected, however the phone screen does not get turned off.

On using the options one at a time everything works as expected.

I've tried it with another device (PANASONIC ELUGA Turbo (Android 5.1)). Still the same issue persists.

@rom1v
Copy link
Collaborator

rom1v commented Jun 25, 2021

Indeed, the controller is not started if there is no display:

scrcpy/app/src/scrcpy.c

Lines 346 to 357 in ab12b6c

if (options->display) {
if (options->control) {
if (!controller_init(&s->controller, s->server.control_socket)) {
goto end;
}
controller_initialized = true;
if (!controller_start(&s->controller)) {
goto end;
}
controller_started = true;
}

The reason was that initially controls could only be initiated by input events (captured by the window). This might be changed now.

@mukheshpugal
Copy link
Author

mukheshpugal commented Jun 25, 2021

Will I be able to run an adb command from another terminal to turn the screen off? That is without disturbing the v4l2 stream. If I can, please let me know of the command.

@rom1v
Copy link
Collaborator

rom1v commented Jun 25, 2021

Unfortunately, in the current state, no.

@rom1v rom1v added this to the v1.19 milestone Jun 25, 2021
@mukheshpugal
Copy link
Author

Alright. Looking forward for the fix! Thanks.

@rom1v
Copy link
Collaborator

rom1v commented Jun 25, 2021

Out of curiosity, what is the use case?

If your device screen is off and you pass --no-display, you can't control it at all?

@mukheshpugal
Copy link
Author

Well, there's this game called Mortal Kombat mobile and in the game, you can recieve extra coins by logging in every hour and completing a few tasks. I want to automate it so that I can run it through the night. Obviously I don't want the phone display to be on all the time.

Since I'll be running the controlling program headlessly on an rpi, I don't want a window.

With the screen off, I am able to sent inputs using the adb shell input command independently.

@mukheshpugal
Copy link
Author

I just realised that the backlight is still on on my non amoled device while using --turn-screen-off. Is this normal?

rom1v added a commit that referenced this issue Jun 25, 2021
The options --no-display and --no-control are independent.

The controller was not initialized when no display was requested,
because it was assumed that no control could occur without display. But
that's not true (anymore): for example, it is possible to pass
--turn-screen-off.

Fixes #2426 <#2426>
@rom1v
Copy link
Collaborator

rom1v commented Jun 25, 2021

Fixed on dev.

I just realised that the backlight is still on on my non amoled device while using --turn-screen-off. Is this normal?

Scrcpy just request the device to change the "power mode", how the action is done is device-dependent.

@rom1v rom1v closed this as completed Jun 25, 2021
@mukheshpugal
Copy link
Author

Great!

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

2 participants