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

Second successive input source retrieve fails #344

Open
rosshardy opened this issue Apr 22, 2024 · 2 comments
Open

Second successive input source retrieve fails #344

rosshardy opened this issue Apr 22, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@rosshardy
Copy link

rosshardy commented Apr 22, 2024

  • Monitor manufacturer and model number: ASUS VG27A
  • Input source (HDMI, VGA, display port, ect.): DisplayPort / HDMI
  • Output device (video card, discrete graphics, ect.): discrete nvidia 3080
  • Operating system: Windows 11
  • Python version: 3.8.3
  • monitorcontrol version (monitorcontrol --version): 3.1.0

Steps to Reproduce

The following python code errors:

from monitorcontrol import get_monitors

try:
    with get_monitors()[1] as monitor: 
        inputsource = monitor.get_input_source()
        print(inputsource)

        inputsourceagain = monitor.get_input_source()
        print(inputsourceagain)
except Exception as e:
    print(f"An error occurred: {e}")

Output:

InputSource.HDMI2
An error occurred: failed to get VCP feature: An error occurred while transmitting data to the device on the I2C bus.
@rosshardy
Copy link
Author

I think this is due to a second query too soon after the first. Adding a time.sleep(1) is a workaround, but it would be nice if maybe the library could handle this or provide better insight.

@newAM
Copy link
Owner

newAM commented May 7, 2024

There are rate limits defined in the DDC-CI specification, on Linux these are adjustable:

# timeouts
GET_VCP_TIMEOUT = 0.04 # at least 40ms per the DDCCI specification
CMD_RATE = 0.05 # at least 50ms between messages

Those values should be enough as-is, but sometimes monitors need a little bit more time. Sadly in Windows these values are fixed; Microsoft is in the right here, but it does make workarounds like this necessary for some monitors :(

@newAM newAM added the bug Something isn't working label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants