Fixed Samsung 28E850 being treated as a dummy. (#788)

This commit is contained in:
Istvan T 2021-11-15 07:25:03 +01:00 committed by GitHub
parent 5c82b996ed
commit ec83769e21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 17 deletions

View file

@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>6956</string>
<string>6957</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>

View file

@ -9,6 +9,7 @@ class Arm64DDC: NSObject {
var service: IOAVService?
var serviceLocation: Int = 0
var isDiscouraged: Bool = false
var isDummy: Bool = false
}
#if arch(arm64)
@ -26,7 +27,8 @@ class Arm64DDC: NSObject {
for ioregServiceForMatching in ioregServicesForMatching {
let score = self.ioregMatchScore(displayID: displayID, ioregEdidUUID: ioregServiceForMatching.edidUUID, ioregProductName: ioregServiceForMatching.productName, ioregSerialNumber: ioregServiceForMatching.serialNumber, serviceLocation: ioregServiceForMatching.serviceLocation)
let isDiscouraged = self.checkIfDiscouraged(ioregService: ioregServiceForMatching)
let displayService = DisplayService(displayID: displayID, service: ioregServiceForMatching.service, serviceLocation: ioregServiceForMatching.serviceLocation, isDiscouraged: isDiscouraged)
let isDummy = self.checkIfDummy(ioregService: ioregServiceForMatching)
let displayService = DisplayService(displayID: displayID, service: ioregServiceForMatching.service, serviceLocation: ioregServiceForMatching.serviceLocation, isDiscouraged: isDiscouraged, isDummy: isDummy)
if scoredCandidateDisplayServices[score] == nil {
scoredCandidateDisplayServices[score] = []
}
@ -260,6 +262,15 @@ class Arm64DDC: NSObject {
return ioregServicesForMatching
}
// Check if display is a dummy
private static func checkIfDummy(ioregService: IOregService) -> Bool {
// This is a well known dummy plug
if ioregService.manufacturerID == "AOC", ioregService.productName == "28E850" {
return true
}
return false
}
// Check if it is problematic to enable DDC on the display
private static func checkIfDiscouraged(ioregService: IOregService) -> Bool {
var modelIdentifier: String = ""
@ -267,14 +278,6 @@ class Arm64DDC: NSObject {
if let modelData = IORegistryEntryCreateCFProperty(platformExpertDevice, "model" as CFString, kCFAllocatorDefault, 0).takeRetainedValue() as? Data, let modelIdentifierCString = String(data: modelData, encoding: .utf8)?.cString(using: .utf8) {
modelIdentifier = String(cString: modelIdentifierCString)
}
// This is a well known dummy plug (not a real display) but it breaks DDC communication on M1
if ioregService.manufacturerID == "AOC", ioregService.productName == "28E850" {
return true
}
// If the display contains the string "Dummy", then it is highly suspicious
if ioregService.productName.contains("Dummy") || ioregService.productName.contains("dummy") {
return true
}
// First service location of Mac Mini HDMI is broken for DDC communication
if ioregService.transportDownstream == "HDMI", ioregService.serviceLocation == 1, modelIdentifier == "Macmini9,1" {
return true

View file

@ -313,7 +313,11 @@ class DisplayManager {
os_log("Display service match successful for display %{public}@", type: .info, String(serviceMatch.displayID))
if serviceMatch.isDiscouraged {
os_log("Display %{public}@ is flagged as discouraged by Arm64DDC.", type: .info, String(serviceMatch.displayID))
otherDisplay.isDiscouraged = serviceMatch.isDiscouraged
otherDisplay.isDiscouraged = true
} else if serviceMatch.isDummy {
os_log("Display %{public}@ is flagged as dummy by Arm64DDC.", type: .info, String(serviceMatch.displayID))
otherDisplay.isDiscouraged = true
otherDisplay.isDummy = true
} else {
otherDisplay.arm64ddc = DEBUG_SW ? false : true // MARK: (point of interest when testing)
}
@ -396,7 +400,7 @@ class DisplayManager {
static func isDummy(displayID: CGDirectDisplayID) -> Bool {
let rawName = DisplayManager.getDisplayRawNameByID(displayID: displayID)
var isDummy: Bool = false
if rawName == "28E850" || rawName.lowercased().contains("dummy") {
if rawName.lowercased().contains("dummy") {
os_log("NOTE: Display is a dummy!", type: .info)
isDummy = true
}

View file

@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>6956</string>
<string>6957</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSBackgroundOnly</key>

View file

@ -99,11 +99,7 @@ _* With some limitations - full functionality available on macOS 11 Big Sur or n
- LCD and LED Televisions usually do not implement DDC, these are supported using software alternatives to dim the image (some higher-end sets are able to translate this into hardware backlight dimming).
- OLED or mini/micro-LED displays and televisions are fully supported using gamma table manipulation (this is a no-compromise solution for this class of displays).
- DisplayLink, Airplay and Sidecar are supported using shade (dark overlay) control.
Dummy compatibility:
- The app is compatible with [BetterDummy](https://github.com/waydabber/BetterDummy) mirrored sets.
- The app is compatible with mirrored sets that include a dummy dongle identifying as `28E850`
Notable exceptions for hardware control compatibility: