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

Allow quicker access to DDC power control options #1372

Closed
KrzysztofPrzygoda opened this issue Jan 19, 2023 · 25 comments
Closed

Allow quicker access to DDC power control options #1372

KrzysztofPrzygoda opened this issue Jan 19, 2023 · 25 comments
Labels
DDC DDC related issue enhancement New feature or request

Comments

@KrzysztofPrzygoda
Copy link

KrzysztofPrzygoda commented Jan 19, 2023

It would be nice to have power off button available next to monitor menu (perhaps as an option to display it there). Quite popular I think (for me at least).

Right now I need to make 4+ extra steps:

  1. Expand monitor (if not expanded).
  2. Expand monitor's additional settings (if not expanded).
  3. Go to DCC Control menu and wait for to show it up.
  4. Choose Turn Display Off option.
  5. Then I have to collapse everything manually to get back to the original menu state.
@waydabber waydabber added the enhancement New feature or request label Jan 19, 2023
@waydabber
Copy link
Owner

Sure, I can make it an option to have it up there. The power command is not uniformly supported and might be annoying for users if they inadvertently click on it so I would not do it by default but if somebody chooses to put it up there, that's a different story.

@KrzysztofPrzygoda
Copy link
Author

By the way, is there really no "power on" option in DCC or this is just rarely supported?

@waydabber
Copy link
Owner

waydabber commented Jan 19, 2023

there is a command (D6) to change DPMS power modes and to power off the display. VESA DPMS was a thing devised when CRTs ruled, but the states are carried over to some modern LCDs

These are the four DPMS modes (DDC D6 command values 1-4)

 0     DPMSModeOn          In use
 1     DPMSModeStandby     Blanked, low power
 2     DPMSModeSuspend     Blanked, lower power
 3     DPMSModeOff         Shut off, awaiting activity

And there is a command value 5 which is to turn the display Off.

BD uses DPMS mode 3 for panel off and 0 for panel on (command value 4 and 1) and value 5 for power off. But support for these varies heavily.

@waydabber
Copy link
Owner

waydabber commented Jan 19, 2023

but you can try overriding the command value for backlight off/on, your display might respond to command 2-3 instead of 4 - if it still turns off the backlight in any of those modes but can turn it back on, then you could use that instead of power off/on or the not able to backlight on from DPMSModeOff.

@waydabber
Copy link
Owner

Screenshot 2023-01-19 at 23 42 23

@waydabber
Copy link
Owner

waydabber commented Jan 19, 2023

So for clarification, the DDC values are this:

     01: DPM: On,  DPMS: Off
     02: DPM: Off, DPMS: Standby
     03: DPM: Off, DPMS: Suspend
     04: DPM: Off, DPMS: Off
     05: Write only value to turn off display

States 01-04 should be readable which implies that the display must respond to DDC and should be able to come back from 02-04 the state to 01. Not doing so is a firmware issue, but much more severe incompatibilities exist in the DDC field as it is very neglected generally by manufacturers - your display supporting most other things actually puts it among the good ones. :)

@KrzysztofPrzygoda
Copy link
Author

KrzysztofPrzygoda commented Jan 20, 2023

Hmm.... I've tested all the values and all of them turns display off, with the difference that after issuing 1-4 I had to additionally send 5 to be able to power monitor back on. Otherwise, display is not responding to the power button.
So, it looks like 5 is the only viable command.

@KrzysztofPrzygoda
Copy link
Author

@waydabber Is there any way to query DDC capabilities ddcutil alike under macOS?
I've found ddcctl but it doesn't seem to work at all on M1 Macs.

@waydabber
Copy link
Owner

Yes, there is but this capability is not built into BetterDisplay. The reason for this is that read support is rather sporadic to begin with and capacity flags, reported min-max values are often unreliable. MonitorControl had some of this ability but not active, querying min-max values is also disabled by default. I might add this feature in the future but it's a low priority #1168

@KrzysztofPrzygoda
Copy link
Author

So, I found winddcutil and queried my LG 27UP850-W (results below).

It seems display is VESA MCCS v2.1 compliant and capable of Power mode D6 (01 04). Reads current state while display is ON (D6 is 1) but unfortunately, setting any value from range 1..4 leads to unresponsive power down state (no picture, no response to the power button, power supply replug required).

C:\Users\Dell\Downloads>winddcutil.exe
Usage: winddcutil command [<arg> ...]
Commands:
        help                                           Display help
        detect                                         Detect monitors
        capabilities <display-id>                      Query monitor capabilities
        getvcp <display-id> <feature-code>             Report VCP feature value
        setvcp <display-id> <feature-code> <new-value> Set VCP feature value

C:\Users\Dell\Downloads>winddcutil.exe detect
Display 0:      Generic PnP Monitor
Display 1:      Dell SHP14BA Display

C:\Users\Dell\Downloads>winddcutil.exe capabilities 0
(prot(monitor)type(lcd)UP850cmds(01 02 03 0C E3 F3)vcp(02 04 05 08 10 12 14(05 08 0B ) 16 18 1A 52 60( 11 12 0F 00) AC AE B2 B6 C0 C6 C8 C9 D6(01 04) DF 62 8D F4 F5(00 01 02) F6(00 01 02) 4D 4E 4F 15(01 06 11 13 14 15 18 19 28 29 48) F7(00 01 02 03) F8(00 01) F9 E4 E5 E6 E7 E8 E9 EA EB EF FD(00 01) FE(00 01 02) FF)mccs_ver(2.1)mswhql(1))

C:\Users\Dell\Downloads>winddcutil.exe getvcp 0 d6
VCP d6 1

@KrzysztofPrzygoda
Copy link
Author

After further investigation of MCCS codes and some tests, this seems to be right approach:

  • Power Off: d6 = 5
  • Power On: if (d6 != 1) then { d6 = 1 }

If we send d6 = 1 while d6 == 1 then display becomes unresponsive until we send sequence d6 = 5 then d6 = 1.
So, IMHO, we should always test d6 against current value and never issue same value again.
The best UI control for power seems to be ON/OFF state slider then. What do you think?

PS 1
The only drawback I see is that it works on HDMI port only while display does not detach on power off.
Under USB-C port (no matter if cable is native Thunderbolt or USB-C to DP dongle) display always detaches on power off and there is no way to send power on command anymore. Requires manual power button operation.

But I wonder if we could take another approach analogous to "no signal" case while computer goes to sleep. When computer wakes up then displays wake up. I don't know the protocol that stands behind it, and I don't know if it is feasible for particular monitor, but might be port agnostic solution. What do you think?

PS 2
I found that BD does not allow to change control code - always resets changes back to default value.

@KrzysztofPrzygoda
Copy link
Author

Background
I've got 4 external monitors and power management is a deal breaker for me since I dynamically use them and every monitor takes >= 25 W, so unused is a waste of energy. Moreover, manual control is a daunting and not ergonomic task.
Same applies to DCC brightness control, while difference between 0-100 is 20 W. That's why it is so important.

@waydabber
Copy link
Owner

So if you send a single Power off command, can you turn the display back on with a backlight on command? Btw you can remap the backlight off and on to any value you want in the app.

@waydabber
Copy link
Owner

The problem might be that the app sends most displays twice by default as for most of the time the first DDC command fails. If you want to change this, modify this one:

Screenshot 2023-01-21 at 15 58 16

@waydabber
Copy link
Owner

also, you can use m1ddc on the mac to send messages one by one.

m1ddc set standby 5 - should turn off your display
m1ddc set standby 1 - should turn it on if your display is indeed responsive after putting it to power off mode (which would be strange, but hey, who knows)

@waydabber
Copy link
Owner

@KrzysztofPrzygoda

"I found that BD does not allow to change control code - always resets changes back to default value."

Hmm. I can't seem to reproduce this issue. Where do you see this? If this is the case then it must be a bug.

I tried with some displays, if I send d6=5 the display turns off and no more communication is possible (the standard also states that this is a write only value since afterwards the display control panel is powered off). Is this not the case with your LG display?

@KrzysztofPrzygoda
Copy link
Author

I tried with some displays, if I send d6=5 the display turns off and no more communication is possible (the standard also states that this is a write only value since afterwards the display control panel is powered off). Is this not the case with your LG display?

Have you tried with HDMI?
As I said, in my case it works on HDMI only (see attached video).
IMG_4481_720p.webm

IMG_4481_720p.webm

@KrzysztofPrzygoda
Copy link
Author

"I found that BD does not allow to change control code - always resets changes back to default value."

Hmm. I can't seem to reproduce this issue. Where do you see this? If this is the case then it must be a bug.

I can't set code 0 (i.e. 00h) in particular. Any other values are stored. So, maybe it's not important.

@waydabber
Copy link
Owner

waydabber commented Jan 22, 2023

Nice! It's good to know that there is a combination of settings that works for this display. I think for many people who wants to use this feature, some levels of tinkering will be needed.

Yes, code 00h is not valid, the app treats that as no input (as default non-numeric string to int conversion result is 00h).

@waydabber
Copy link
Owner

Hi @KrzysztofPrzygoda - I plan to add a feature to generally disconnect/connect a display in one of the next versions which might be of an interest to you - this might prove a more stable solution than using DDC for power control. This solution puts the display to sleep using the standard means + also removes the unneeded display from the display layout.

#1396
#1407

@KrzysztofPrzygoda
Copy link
Author

KrzysztofPrzygoda commented Jan 27, 2023

Hi @waydabber, great news!

Removing display from the layout could be an option. There are situations when I'd like to power monitor off (saving energy) but keep its layout untouched, which means keeping desktop spaces layout and apps still there that I can get back to them quickly by powering monitor back on. Otherwise, all my remaining desktop spaces will be reconfigured, creating some sort of confusion.

@waydabber
Copy link
Owner

Right. For that use case using DDC power is the best - I don't know a way currently to send a sleep signal to a display (without DDC) while keeping the display in the layout. There might be one, will investigate and if I find a solution, will add as an option.

@waydabber waydabber added the DDC DDC related issue label Jan 27, 2023
@waydabber waydabber changed the title Add Turn Display Off option next to main controls Allow quicker access to DDC power control options Jan 27, 2023
@KrzysztofPrzygoda
Copy link
Author

Actually DCC works strange. There are several conditions when display is not removed from the display layout:

  1. D6 = 5 on HDMI.
  2. Sometimes even on USB-C D6 = 5 doesn't remove display (I can't reproduce conditions, but it's unreliable).
  3. When I change display input with no signal and monitor goes to sleep.

Anyway, macOS somehow navigates displays power while going to sleep and waking up without DCC.
It would be great to control particular display same way macOS does (DCC agnostic).

@waydabber
Copy link
Owner

Yes, macOS does not use DDC at all for power control at all. We identified the required call that should initiate power saving mode without removing the framebuffer and keeping the display in the layout but for some reason it does not work currently, more research is needed on how to make it work.

@waydabber
Copy link
Owner

This will be #1424

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DDC DDC related issue enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants