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

set display brightness #101

Closed
anishbajpai014 opened this Issue Mar 29, 2018 · 5 comments

Comments

Projects
None yet
2 participants
@anishbajpai014

anishbajpai014 commented Mar 29, 2018

It would be great if scrcpy could set device brightness to 0 on start and reset it on exit.
The current value can be accessed using adb shell settings get system screen_brightness, and can be set using adb shell settings put system screen_brightness XX where XX ranges from 0 to 255.

On a side note, maybe a user can be allowed to run scripts at the start and exit of scrcpy.

@anishbajpai014

This comment has been minimized.

anishbajpai014 commented Mar 29, 2018

All of this can be achieved using a bash script.
Closing.

@rom1v

This comment has been minimized.

Collaborator

rom1v commented Mar 29, 2018

The current value can be accessed using adb shell settings get system screen_brightness, and can be set using adb shell settings put system screen_brightness XX where XX ranges from 0 to 255.

For completeness, screen_brightness_mode must also be set to 0:

adb shell settings put system screen_brightness_mode 0
adb shell settings put system screen_brightness 0

On a side note, maybe a user can be allowed to run scripts at the start and exit of scrcpy.

See #96.

All of this can be achieved using a bash script.

😉

I still implemented show touches as an option. I don't know if brightness deserve its own option too… For now, I don't think so.

@anishbajpai014

This comment has been minimized.

anishbajpai014 commented Mar 30, 2018

I don't know if brightness deserve its own option too

Yeah you're right. A wrapper script is more than enough.
Script samples for the most frequent actions can be added to the readme though.

For example, this is the function I'm using -

function scrcpy () {
	brightness=$(adb shell settings get system screen_brightness)
	adb shell settings put system screen_brightness_mode 0
	adb shell settings put system screen_brightness 0
	adb shell svc power stayon usb
	command scrcpy
	adb shell settings put system screen_brightness_mode 1
	adb shell settings put system screen_brightness $brightness
	adb shell svc power stayon false
}
@rom1v

This comment has been minimized.

Collaborator

rom1v commented Mar 30, 2018

👍

One question: I never used the command built-in bash command. What's the benefit concretely.

As a suggestion, you could forward the arguments to scrcpy:

    command scrcpy "$@"
@anishbajpai014

This comment has been minimized.

anishbajpai014 commented Mar 30, 2018

The command function is there only because I wanted the function to have the same name.
If this function is called without command, it will keep calling itself recursively.

Totally forgot about passing the arguments. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment