Add more logging and update DDC.swift.

This commit is contained in:
Markus Reiter 2019-05-10 16:13:24 +02:00
parent 6b12e3cb6f
commit 26c3c08267
7 changed files with 27 additions and 15 deletions

View file

@ -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"

View file

@ -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 */

View file

@ -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
}

View file

@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.5.1</string>
<key>CFBundleVersion</key>
<string>318</string>
<string>333</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>

View file

@ -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 {

View file

@ -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)
}
}

View file

@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.5.1</string>
<key>CFBundleVersion</key>
<string>318</string>
<string>333</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSBackgroundOnly</key>