Skip to content

Commit ec83769

Browse files
authored
Fixed Samsung 28E850 being treated as a dummy. (MonitorControl#788)
1 parent 5c82b99 commit ec83769

File tree

5 files changed

+20
-17
lines changed

5 files changed

+20
-17
lines changed

MonitorControl/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundleShortVersionString</key>
2020
<string>$(MARKETING_VERSION)</string>
2121
<key>CFBundleVersion</key>
22-
<string>6956</string>
22+
<string>6957</string>
2323
<key>LSApplicationCategoryType</key>
2424
<string>public.app-category.utilities</string>
2525
<key>LSMinimumSystemVersion</key>

MonitorControl/Support/Arm64DDC.swift

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class Arm64DDC: NSObject {
99
var service: IOAVService?
1010
var serviceLocation: Int = 0
1111
var isDiscouraged: Bool = false
12+
var isDummy: Bool = false
1213
}
1314

1415
#if arch(arm64)
@@ -26,7 +27,8 @@ class Arm64DDC: NSObject {
2627
for ioregServiceForMatching in ioregServicesForMatching {
2728
let score = self.ioregMatchScore(displayID: displayID, ioregEdidUUID: ioregServiceForMatching.edidUUID, ioregProductName: ioregServiceForMatching.productName, ioregSerialNumber: ioregServiceForMatching.serialNumber, serviceLocation: ioregServiceForMatching.serviceLocation)
2829
let isDiscouraged = self.checkIfDiscouraged(ioregService: ioregServiceForMatching)
29-
let displayService = DisplayService(displayID: displayID, service: ioregServiceForMatching.service, serviceLocation: ioregServiceForMatching.serviceLocation, isDiscouraged: isDiscouraged)
30+
let isDummy = self.checkIfDummy(ioregService: ioregServiceForMatching)
31+
let displayService = DisplayService(displayID: displayID, service: ioregServiceForMatching.service, serviceLocation: ioregServiceForMatching.serviceLocation, isDiscouraged: isDiscouraged, isDummy: isDummy)
3032
if scoredCandidateDisplayServices[score] == nil {
3133
scoredCandidateDisplayServices[score] = []
3234
}
@@ -260,21 +262,22 @@ class Arm64DDC: NSObject {
260262
return ioregServicesForMatching
261263
}
262264

265+
// Check if display is a dummy
266+
private static func checkIfDummy(ioregService: IOregService) -> Bool {
267+
// This is a well known dummy plug
268+
if ioregService.manufacturerID == "AOC", ioregService.productName == "28E850" {
269+
return true
270+
}
271+
return false
272+
}
273+
263274
// Check if it is problematic to enable DDC on the display
264275
private static func checkIfDiscouraged(ioregService: IOregService) -> Bool {
265276
var modelIdentifier: String = ""
266277
let platformExpertDevice = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"))
267278
if let modelData = IORegistryEntryCreateCFProperty(platformExpertDevice, "model" as CFString, kCFAllocatorDefault, 0).takeRetainedValue() as? Data, let modelIdentifierCString = String(data: modelData, encoding: .utf8)?.cString(using: .utf8) {
268279
modelIdentifier = String(cString: modelIdentifierCString)
269280
}
270-
// This is a well known dummy plug (not a real display) but it breaks DDC communication on M1
271-
if ioregService.manufacturerID == "AOC", ioregService.productName == "28E850" {
272-
return true
273-
}
274-
// If the display contains the string "Dummy", then it is highly suspicious
275-
if ioregService.productName.contains("Dummy") || ioregService.productName.contains("dummy") {
276-
return true
277-
}
278281
// First service location of Mac Mini HDMI is broken for DDC communication
279282
if ioregService.transportDownstream == "HDMI", ioregService.serviceLocation == 1, modelIdentifier == "Macmini9,1" {
280283
return true

MonitorControl/Support/DisplayManager.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,11 @@ class DisplayManager {
313313
os_log("Display service match successful for display %{public}@", type: .info, String(serviceMatch.displayID))
314314
if serviceMatch.isDiscouraged {
315315
os_log("Display %{public}@ is flagged as discouraged by Arm64DDC.", type: .info, String(serviceMatch.displayID))
316-
otherDisplay.isDiscouraged = serviceMatch.isDiscouraged
316+
otherDisplay.isDiscouraged = true
317+
} else if serviceMatch.isDummy {
318+
os_log("Display %{public}@ is flagged as dummy by Arm64DDC.", type: .info, String(serviceMatch.displayID))
319+
otherDisplay.isDiscouraged = true
320+
otherDisplay.isDummy = true
317321
} else {
318322
otherDisplay.arm64ddc = DEBUG_SW ? false : true // MARK: (point of interest when testing)
319323
}
@@ -396,7 +400,7 @@ class DisplayManager {
396400
static func isDummy(displayID: CGDirectDisplayID) -> Bool {
397401
let rawName = DisplayManager.getDisplayRawNameByID(displayID: displayID)
398402
var isDummy: Bool = false
399-
if rawName == "28E850" || rawName.lowercased().contains("dummy") {
403+
if rawName.lowercased().contains("dummy") {
400404
os_log("NOTE: Display is a dummy!", type: .info)
401405
isDummy = true
402406
}

MonitorControlHelper/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundleShortVersionString</key>
2020
<string>$(MARKETING_VERSION)</string>
2121
<key>CFBundleVersion</key>
22-
<string>6956</string>
22+
<string>6957</string>
2323
<key>LSApplicationCategoryType</key>
2424
<string>public.app-category.utilities</string>
2525
<key>LSBackgroundOnly</key>

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,7 @@ _* With some limitations - full functionality available on macOS 11 Big Sur or n
9999
- 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).
100100
- 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).
101101
- DisplayLink, Airplay and Sidecar are supported using shade (dark overlay) control.
102-
103-
Dummy compatibility:
104-
105102
- The app is compatible with [BetterDummy](https://github.com/waydabber/BetterDummy) mirrored sets.
106-
- The app is compatible with mirrored sets that include a dummy dongle identifying as `28E850`
107103

108104
Notable exceptions for hardware control compatibility:
109105

0 commit comments

Comments
 (0)