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

How to identify monitors #46

Open
x11x opened this issue Mar 5, 2021 · 5 comments
Open

How to identify monitors #46

x11x opened this issue Mar 5, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@x11x
Copy link

x11x commented Mar 5, 2021

How can we identify monitors?
If the order of monitors is guaranteed to be the same across reboots, we can just use its index in the get_monitors() list.
I'm not sure this is the case though. On Linux the i2c bus number could change across reboots (source). I think the same is the case with HMONITOR on Windows.
There is the EDID, which I believe can be parsed out into Manufacturer code, Model number and Serial number (ddcutil does this and you can use --mfg, --model and --sn flags resp. to target a specific monitor).
monitorcontrol could extract either the raw EDID or some other identifying information similar to how ddcutil does it. Simply being able to sort the output of get_monitors() on some stable key and use the index should be enough for many uses (rather than trying to replicate all the features of ddcutil).

@newAM
Copy link
Owner

newAM commented Mar 6, 2021

At the moment there is no way to identify unique monitors, this would be a good feature to have though.

I'll accept a pull-request, but I will not be working on this for a long time, I made tons of commitments for other projects people are waiting on.

@newAM newAM added the enhancement New feature or request label Mar 6, 2021
@x11x
Copy link
Author

x11x commented Mar 8, 2021

Thanks, I understand. And thanks for this library.
I may have a go at some point, can't at the moment though.
I will need to learn a bit more about I2c and the Windows APIs.
Just a few notes that may help anyone (me) trying to implement this.
On Windows, we might want EnumDisplayDevices and the DeviceID member of DISPLAY_DEVICE structure, as long as there's a way to cross reference this with a HMONITOR or some other info returned by the EnumDisplayMonitors API which we are currently using. Haven't found that yet.
Another possibility on Windows is WMI, apparently some monitor info can be read from there. (Either wmi python module or shelling out the wmic command line tool).
On Linux, it looks like EDID can be read from the I2C bus at address 0x50.

@newAM
Copy link
Owner

newAM commented Mar 9, 2021

On Windows, we might want EnumDisplayDevices and the DeviceID member of DISPLAY_DEVICE structure, as long as there's a way to cross reference this with a HMONITOR or some other info returned by the EnumDisplayMonitors API which we are currently using. Haven't found that yet.

Looks promising! The "DeviceID: Not used" remark is a bit annoying, but since it is 128 bytes you're probably right to assume this is the EDID.

On Linux, it looks like EDID can be read from the I2C bus at address 0x50.

Yeah Linux is much easier in this regard, I have 3 identical monitors, and the EDID hexdump from ddcutil detect -vvv returns deterministic unique values for each monitor.

@hawktang
Copy link

Identification should be added. Currently --monitor 1 or --monitor 1 are constantly changing

@char101
Copy link

char101 commented Jun 7, 2022

If your monitors are of different models or input types (dvi vs hdmi), it can be identified by the model & input field from monitor.get_vcp_capabilities().

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

No branches or pull requests

4 participants