Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have found no conceputally better way than what you list as "Tried". But I found a solution for the ambiguity issue of comparing only vendor id and product id.</p> <p><code>oldInfoDict</code> and <code>newInfoDict</code> in your code contain an additional entry for key <code>kIODisplayEDIDKey</code> (defined in <a href="http://www.opensource.apple.com/source/IOGraphics/IOGraphics-233/IOGraphicsFamily/IOKit/graphics/IOGraphicsTypes.h" rel="nofollow">IOGraphicsTypes.h</a>) which contains the <a href="http://en.wikipedia.org/wiki/Extended_display_identification_data" rel="nofollow">EDID</a> of each connected display. My observations show that this data as a whole stays persistent between GPU switches. For example:</p> <pre><code> CGDirectDisplayID displayId = [[[screen deviceDescription] valueForKey:@"NSScreenNumber"] unsignedIntValue]; io_service_t displayPort = CGDisplayIOServicePort(displayId); if (displayPort == MACH_PORT_NULL) return nil; // No physical device to get a name from. CFDictionaryRef infoDict = IODisplayCreateInfoDictionary(displayPort, kIODisplayOnlyPreferredName); NSData *displayEdid = (NSData *)CFDictionaryGetValue(infoDict, CFSTR(kIODisplayEDIDKey)); NSLog(@"EDID: %@", displayEdid); CFRelease(infoDict); </code></pre> <p>Looking at the data description of <a href="http://en.wikipedia.org/wiki/Extended_display_identification_data" rel="nofollow">EDID</a> in Wikipedia, this blob already contains manufacturer, product id and serial. So it's enough to compare displays by using the EDID data (or for example a hash of it if you only want to compare a shorter number).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload