diff --git a/Cartfile.resolved b/Cartfile.resolved index 2a795ea..8e615d2 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ -github "reitermarkus/DDC.swift" "05141d5bb5d5fd77b22701d03fbec7586aad8fd7" +github "reitermarkus/DDC.swift" "c77f27c2f2e0c38a1cd95426084a6960e3de2132" github "rnine/AMCoreAudio" "3.2.1" github "shpakovski/MASPreferences" "1.3" github "the0neyouseek/MediaKeyTap" "abfe09f53ccabb1aa14a0f4ab99cfb8812f41919" diff --git a/MonitorControl.xcodeproj/project.pbxproj b/MonitorControl.xcodeproj/project.pbxproj index fadfe58..677eec3 100644 --- a/MonitorControl.xcodeproj/project.pbxproj +++ b/MonitorControl.xcodeproj/project.pbxproj @@ -429,7 +429,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi"; + shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\" >&2\nfi\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/MonitorControl/Display.swift b/MonitorControl/Display.swift index 363e219..9ba54a1 100644 --- a/MonitorControl/Display.swift +++ b/MonitorControl/Display.swift @@ -27,21 +27,21 @@ class Display { return } - _ = self.ddc?.write(command: .onScreenDisplay, value: 1) - _ = self.ddc?.write(command: .onScreenDisplay, value: 1) + _ = self.ddc?.write(command: .osd, value: UInt16(1)) + _ = self.ddc?.write(command: .osd, value: UInt16(1)) } func mute() { var value = 0 if self.isMuted { - value = self.prefs.integer(forKey: "\(DDC.Command.audioSpeakerVolume.value)-\(self.identifier)") + value = self.prefs.integer(forKey: "\(DDC.Command.audioSpeakerVolume.rawValue)-\(self.identifier)") self.isMuted = false } else { self.isMuted = true } DispatchQueue.global(qos: .userInitiated).async { - guard self.ddc?.write(command: .audioSpeakerVolume, value: UInt8(value)) == true else { + guard self.ddc?.write(command: .audioSpeakerVolume, value: UInt16(value)) == true else { return } @@ -60,7 +60,7 @@ class Display { } DispatchQueue.global(qos: .userInitiated).async { - guard self.ddc?.write(command: .audioSpeakerVolume, value: UInt8(value)) == true else { + guard self.ddc?.write(command: .audioSpeakerVolume, value: UInt16(value)) == true else { return } @@ -79,23 +79,23 @@ class Display { if self.prefs.bool(forKey: Utils.PrefKeys.lowerContrast.rawValue) { if value == 0 { DispatchQueue.global(qos: .userInitiated).async { - _ = self.ddc?.write(command: .contrast, value: UInt8(value)) + _ = self.ddc?.write(command: .contrast, value: UInt16(value)) } if let slider = contrastSliderHandler?.slider { slider.intValue = Int32(value) } - } else if self.prefs.integer(forKey: "\(DDC.Command.brightness.value)-\(self.identifier)") == 0 { - let contrastValue = self.prefs.integer(forKey: "\(DDC.Command.contrast.value)-\(self.identifier)") + } else if self.prefs.integer(forKey: "\(DDC.Command.brightness.rawValue)-\(self.identifier)") == 0 { + let contrastValue = self.prefs.integer(forKey: "\(DDC.Command.contrast.rawValue)-\(self.identifier)") DispatchQueue.global(qos: .userInitiated).async { - _ = self.ddc?.write(command: .contrast, value: UInt8(contrastValue)) + _ = self.ddc?.write(command: .contrast, value: UInt16(contrastValue)) } } } DispatchQueue.global(qos: .userInitiated).async { - guard self.ddc?.write(command: .brightness, value: UInt8(value)) == true else { + guard self.ddc?.write(command: .brightness, value: UInt16(value)) == true else { return } diff --git a/MonitorControl/Info.plist b/MonitorControl/Info.plist index 7e8cc82..4e6ba48 100644 --- a/MonitorControl/Info.plist +++ b/MonitorControl/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.5.1 CFBundleVersion - 318 + 333 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/MonitorControl/Support/Utils.swift b/MonitorControl/Support/Utils.swift index 6406934..97e5192 100644 --- a/MonitorControl/Support/Utils.swift +++ b/MonitorControl/Support/Utils.swift @@ -42,6 +42,18 @@ class Utils: NSObject { var values: (UInt16, UInt16)? + if display.ddc?.supported() == true { + os_log("Display supports DDC.", type: .debug) + } else { + os_log("Display does not support DDC.", type: .debug) + } + + if display.ddc?.enableAppReport() == true { + os_log("Display supports DDC (enableAppReport).", type: .debug) + } else { + os_log("Display does not support DDC (enableAppReport).", type: .debug) + } + if display.needsLongerDelay { values = display.ddc?.read(command: command, tries: 10, minReplyDelay: UInt64(20 * kMillisecondScale)) } else { diff --git a/MonitorControl/UI/SliderHandler.swift b/MonitorControl/UI/SliderHandler.swift index 2c1c845..2330641 100644 --- a/MonitorControl/UI/SliderHandler.swift +++ b/MonitorControl/UI/SliderHandler.swift @@ -23,7 +23,7 @@ class SliderHandler { slider.integerValue = value } - _ = self.display.ddc?.write(command: self.cmd, value: UInt8(value)) + _ = self.display.ddc?.write(command: self.cmd, value: UInt16(value)) self.display.saveValue(value, for: self.cmd) } } diff --git a/MonitorControlHelper/Info.plist b/MonitorControlHelper/Info.plist index 1fa178f..e1b3ac6 100644 --- a/MonitorControlHelper/Info.plist +++ b/MonitorControlHelper/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.5.1 CFBundleVersion - 318 + 333 LSApplicationCategoryType public.app-category.utilities LSBackgroundOnly