Crozzers / screen_brightness_control

A Python tool for controlling the brightness of your monitor
https://crozzers.github.io/screen_brightness_control
MIT License
50 stars 9 forks source link

Question about a monitor and how would one implement support for it. #26

Open KosiAl opened 1 year ago

KosiAl commented 1 year ago

I am trying to use screen_brightness_control project for my Asus Zenbook Pro Duo, but it appears that my second monitor is not currently supported. Is it possible to add support for this monitor? Are there any specific challenges or differences with this monitor that make it difficult to control? Are there any known issues or reasons why the current implementation may not be working for this monitor? The reason for this is because the official software is very bad and unreliable. I have been searcing google for some soultion but I did not find any for windows OS. Trying to control this monitor with VCP method did not work. This is the information about the second monitor.

{'name': 'BOE Display Technology 085F', 'model': '085F', 'serial': '4&e97741b&0&UID41025', 'manufacturer': 'BOE Display Technology', 'manufacturer_id': 'BOE', 'edid': '00ffffffffffff0009e55f08000000001c1f0104a5220a7802de50a3544c99260f505400000001010101010101010101010101010101a86b00a0f04c30403020350058631000001a225600a0f04c30403020350058631000001a2e1d80a0702630203020350058631000001a5c1780a0702630203020350058631000001a009e', 'method': <class 'screen_brightness_control.windows.VCP'>, 'index': 0}

I belive this is the monitor ... https://www.panelook.com/NV140XTM-N52_BOE_14.1_LCM_overview_46502.html The only difference i could find is that on the website it says it is not touchscreen.

If this project is not the right place to add suport for this monitor, the I would kindly ask you where can i seek help for this problem. Meybe some developer or somebody that is very experianced in this regard.

Crozzers commented 1 year ago

I think the monitor should be supported. The linked specsheet says the panel supports the eDP interface, which is supported by windows and the screen_brightness_control.windows.WMI method.

When you say the library isn't working, do both displays show up? Are you adjusting the brightness but nothing is happening?

KosiAl commented 1 year ago

Yes, both monitors show up.

[ { 'name': 'None 415F', 'model': '415F', 'serial': '4&e97741b&0&UID8388688', 'manufacturer': None, 'manufacturer_id': 'SDC', 'index': 0, 'method': <class 'screen_brightness_control.windows.WMI'> }, { 'name': 'BOE Display Technology 085F', 'model': '085F', 'serial': '4&e97741b&0&UID41025', 'manufacturer': 'BOE Display Technology', 'manufacturer_id': 'BOE', 'index': 0, 'method': <class 'screen_brightness_control.windows.VCP'> } ]

When I change the brightness of first monitor it works. ( sbc.set_brightness(10, display=0) ) but when i try to change the second monitor nothing happens. ( sbc.set_brightness(10, display=1) ) I have also tried with adding additional parameter to the function ( method='wmi' and method='vcp')

If i try to get current brightness from second monitor I get back an error

screen_brightness_control.helpers.ScreenBrightnessError: no valid output was received from brightness methods

Crozzers commented 1 year ago

Seems that its just not responding to any VCP input. It might not support brightness over VCP, if Asus has decided to implement their own nonsense. You could try something like this to grab the VCP capabilities of your monitors:

import screen_brightness_control as sbc
import ctypes
from ctypes import windll
from ctypes.wintypes import DWORD

for index, handle in enumerate(sbc.windows.VCP.iter_physical_monitors()):
    caps_string_length = DWORD()
    if not windll.dxva2.GetCapabilitiesStringLength(handle, ctypes.byref(caps_string_length)):
        continue
    caps_string = (ctypes.c_char * caps_string_length.value)()
    if not windll.dxva2.CapabilitiesRequestAndCapabilitiesReply(handle, caps_string, caps_string_length):
        continue
    print(index, caps_string.value.decode('ASCII'))

This should print out the capabilities of any VCP capable displays you have connected

KosiAl commented 1 year ago

Unfortunaly I do not get any response back from this code :( .

print(sbc.windows.VCP.iter_physical_monitors()) -> reurns <generator object VCP.iter_physical_monitors at 0x000001FBD624F8B0>

print(caps_string_length) -> returns c_ulong(0)

print(handle) -> returns None

Index goes only to 0 and those are the results above. Is it possible that it is not controlled via VCP?

Crozzers commented 1 year ago

It is possible, I suppose. I assumed it was because of this:

{'name': 'BOE Display Technology 085F', 'model': '085F', 'serial': '4&e97741b&0&UID41025', 'manufacturer': 'BOE Display Technology', 'manufacturer_id': 'BOE', 'edid': '00ffffffffffff0009e55f08000000001c1f0104a5220a7802de50a3544c99260f505400000001010101010101010101010101010101a86b00a0f04c30403020350058631000001a225600a0f04c30403020350058631000001a2e1d80a0702630203020350058631000001a5c1780a0702630203020350058631000001a009e', 'method': <class 'screen_brightness_control.windows.VCP'>, 'index': 0}

It shows up as a VCP display. It will only be controlled by WMI if it shows up in:

import wmi
w = wmi.WMI(namespace='wmi')
w.WmiMonitorBrightness()

Which I assume it doesn't?

KosiAl commented 1 year ago

As you suspected, only the first (primary) monitor shows up. But not the second one.

[<_wmi_object: b'\\LAPTOP\root\wmi:WmiMonitorBrightness.InstanceName="DISPLAY\\SDC415F\\4&e97741b&0&UID8388688_0"'>]

I assume then, that only ASUS could release a tool that controls the brightnes of a screen that uses proprietary driver.

Crozzers commented 1 year ago

It definitely looks that way. From the specsheet you listed, the signal interface is listed as eDP, which doesn't support VCP control and it doesn't expose any functionality through WMI so Asus must have implemented some proprietary protocol, or one that I don't know about. Bit of a shame.

If I find anything I'll let you know but I'm not hopeful

KosiAl commented 1 year ago

Thank you for your help and time.