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

[Feature] Control without phone screen turning on #793

Closed
kriki200 opened this issue Sep 6, 2019 · 21 comments
Closed

[Feature] Control without phone screen turning on #793

kriki200 opened this issue Sep 6, 2019 · 21 comments

Comments

@kriki200
Copy link

kriki200 commented Sep 6, 2019

Any way to use it without the phone screen on.

@rom1v
Copy link
Collaborator

rom1v commented Sep 6, 2019

scrcpy --turn-screen-off

or Ctrl+o at any time in the scrcpy window.

@fefo-dev
Copy link

fefo-dev commented Sep 6, 2019

@rom1v I tried to make a shortcut to launch the no console executable with this parameter and it didn't work. Is it possible? Didnt found any arg to disable the console on the normal client too.

@kriki200
Copy link
Author

kriki200 commented Sep 7, 2019

@fefo-dev I got it working...
@rom1v thanks, misunderstood the documentation initially, on the other note is there any way for right click (while scren is off) to automatically go into this mode instead of also turning on the screen while doing it. I've also got another requests that the screen would turn off when minimizing the window .

@kriki200
Copy link
Author

kriki200 commented Sep 7, 2019

And another one, when the window gets minimized if oz could stop streaming and continue when its maximized again.

@iamjoshuabcxvii
Copy link

is it possible to control the device with no mirroring?, I just want to control the device with mouse and keyboard with no mirroring on the computer.

@srevinsaju
Copy link

@iamjoshuabcxvii , you can do it with the gui interface, even without scrcpy on guiscrcpy
https://srevinsaju.github.io/guiscrcpy/
guiscrcpy - your PC is your Android device

@iamjoshuabcxvii
Copy link

@iamjoshuabcxvii , you can do it with the gui interface, even without scrcpy on guiscrcpy
https://srevinsaju.github.io/guiscrcpy/
guiscrcpy - your PC is your Android device

it looks like the same SCRCPY anyway, is there a way to not mirror the phone screen really and just control it with mouse and KB?.

@srevinsaju
Copy link

srevinsaju commented Sep 8, 2019

You can do it with your mouse , no keyboard. The panels remain open and are connected even though mirroring is not enabled, implying you can power on / off your device remotely or press the home key without mirroring. You can also do swipes

Note: guiscrcpy is completely independent module from scrcpy. It is like an add-on, so it has its own engine

@rom1v
Copy link
Collaborator

rom1v commented Sep 8, 2019

@iamjoshuabcxvii No, not possible with scrcpy.

Ref #87 (comment) and #279 (comment)

@rom1v
Copy link
Collaborator

rom1v commented Sep 8, 2019

is there any way for right click (while scren is off) to automatically go into this mode instead of also turning on the screen while doing it

See #760

@QuakeString
Copy link

this feature not working, there is a error showing

Screenshot_20190914_084948

@rom1v
Copy link
Collaborator

rom1v commented Sep 14, 2019

Which Android version?

(please copy-paste the text here instead of a screenshot, so that it can be searched)

@npes87184
Copy link
Contributor

this feature not working, there is a error showing

Screenshot_20190914_084948

@rom1v I have meet this call stack on my oneplus 7 pro with Android 10 beta 1. The exception happens in reflection target. I guess it is a bug from beta build.

@fefo-dev
Copy link

fefo-dev commented Sep 19, 2019

Finally got it to work. For some reason -s didn't work with scrcpy-noconsole but --turn-screen-off did.

For reference I created a .bat file with scrcpy-noconsole --turn-screen-off . However, the .bat itself creates a cmd window to run the command, and closing it closes scrcpy. So I found a way to run all off that silently from a .vbs file with CreateObject("Wscript.Shell").Run "your.bat", 0, True . Trying to run scrpcy with arguments directy failed for me, but it should be some syntax issue.

@rom1v
Copy link
Collaborator

rom1v commented Sep 19, 2019

For some reason -s didn't work

Because it's -S? :)

@kriki200
Copy link
Author

is there any way for right click (while scren is off) to automatically go into this mode instead of also turning on the screen while doing it

See #760

Can a hotkey be made to auto issue ctrl+o after the right click?

@manishSbisht
Copy link

this feature not working, there is a error showing
Screenshot_20190914_084948

@rom1v I have meet this call stack on my oneplus 7 pro with Android 10 beta 1. The exception happens in reflection target. I guess it is a bug from beta build.

Same errors here with Android Q stable release.
Unable to control from PC while starting with -S tag.
Also while launched normally(without -S), input control from PC is lost as soon as Ctrl+O is pressed, also screen on both ends get turned off.

For some reason -s didn't work

Because it's -S? :)

I have used uppercase "-S".

Below is the error messages I'm getting:

C:\scrcpy\scrcpy-server.jar: 1 file pushed. 1.3 MB/s (22470 bytes in 0.016s)
INFO: Initial texture: 720x1280
[server] ERROR: Exception on thread Thread[Thread-1,5,main]
java.lang.AssertionError: java.lang.NoSuchMethodException: android.view.SurfaceControl.getBuiltInDisplay [int]
        at com.genymobile.scrcpy.wrappers.SurfaceControl.getBuiltInDisplay(SurfaceControl.java:82)
        at com.genymobile.scrcpy.Device.setScreenPowerMode(Device.java:164)
        at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:113)
        at com.genymobile.scrcpy.Controller.control(Controller.java:73)
        at com.genymobile.scrcpy.Server$1.run(Server.java:45)
        at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.NoSuchMethodException: android.view.SurfaceControl.getBuiltInDisplay [int]
        at java.lang.Class.getMethod(Class.java:2072)
        at java.lang.Class.getMethod(Class.java:1693)
        at com.genymobile.scrcpy.wrappers.SurfaceControl.getBuiltInDisplay(SurfaceControl.java:80)
        ... 5 more

@rom1v
Copy link
Collaborator

rom1v commented Sep 30, 2019

Same errors here with Android Q stable release.

java.lang.NoSuchMethodException: android.view.SurfaceControl.getBuiltInDisplay [int]

This is weird, because you enter the code where Build.VERSION.SDK_INT < Build.VERSION_CODES.Q:

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
return (IBinder) CLASS.getMethod("getBuiltInDisplay", int.class).invoke(null, builtInDisplayId);
}

What is the value of Build.VERSION.SDK_INT on your device?

diff --git a/server/src/main/java/com/genymobile/scrcpy/wrappers/SurfaceControl.java b/server/src/main/java/com/genymobile/scrcpy/wrappers/SurfaceControl.java
index 5b5586f..ffa49ee 100644
--- a/server/src/main/java/com/genymobile/scrcpy/wrappers/SurfaceControl.java
+++ b/server/src/main/java/com/genymobile/scrcpy/wrappers/SurfaceControl.java
@@ -6,6 +6,8 @@ import android.os.Build;
 import android.os.IBinder;
 import android.view.Surface;
 
+import com.genymobile.scrcpy.Ln;
+
 @SuppressLint("PrivateApi")
 public final class SurfaceControl {
 
@@ -80,6 +82,8 @@ public final class SurfaceControl {
         try {
             // the method signature has changed in Android Q
             // <https://github.com/Genymobile/scrcpy/issues/586>
+            Ln.d("SDK_INT = " + Build.VERSION.SDK_INT);
+            Ln.d("VERSION_CODES.Q = " + Build.VERSION_CODES.Q);
             if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
                 return (IBinder) CLASS.getMethod("getBuiltInDisplay", int.class).invoke(null, builtInDisplayId);
             }

@f3liperamos
Copy link

I'm getting the exact same error as npes87184 and manishSbisht. (so, no need to copy&paste again). It seems a common issue on those devices (at least on Q roms)
Oneplus 7 pro, running beta 4 of android Q.

What is the value of Build.VERSION.SDK_INT on your device?

Do I need to setup a environment (devtools to debug, android studio, etc) or it is possible to get this value from adb shell getprop?

I don't know if adb shell getprops lists any sensitive data, but here are some props

[ro.build.product]: [OnePlus7Pro]
[ro.build.version.release]: [10]
[ro.build.version.sdk]: [29]
[ro.build.version.min_supported_target_sdk]: [23]
[ro.rom.version]: [OP7Pro_O2_BETA_4]

@rom1v
Copy link
Collaborator

rom1v commented Nov 5, 2019

@f3liperamos It's fixed on dev branch (the next release will have the fix). See #835

@f3liperamos
Copy link

@f3liperamos It's fixed on dev branch (the next release will have the fix). See #835

Great! I didn't see that issue before because it was on closed state already and I didn't notice we had all those oneplus users opening bugs, my bad.

I was willing to try share some info since I had the device (and it's probably not a common one) but I have no experience with android&java stuff.

Thanks for your had work!

@rom1v rom1v closed this as completed Nov 5, 2019
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

9 participants