haimgel / display-switch

Turn a $30 USB switch into a full-featured multi-monitor KVM switch
https://haim.dev/posts/2020-07-28-dual-monitor-kvm/
MIT License
2.85k stars 112 forks source link

Crash on Startup: Cannot initialize InputSource from invalid String #14

Closed nathang21 closed 4 years ago

nathang21 commented 4 years ago

Reproduce/Error

➜  bin pwd
/usr/local/bin
➜  bin ./display_switch
2020-09-07 13:23:21.912 Initializing
Fatal error: Error raised at top level: Swift.DecodingError.dataCorrupted(Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "monitorInput", intValue: nil)], debugDescription: "Cannot initialize InputSource from invalid String value DisplayPort-1", underlyingError: nil)): file /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-1103.8.25.8/swift/stdlib/public/core/ErrorType.swift, line 200
[1]    22694 illegal hardware instruction  ./display_switch

.ini file

➜  bin cat ~/Library/Preferences/display-switch.ini
usb_device = "8086:a36d"
monitor_input = "DisplayPort-1"

Steps taken:

  1. I have right click > Open'ed to ensure Mac will allow it to run.
  2. Loaded, and unloaded the LaunchAgent
  3. Checked Console/Syslogs. No logs there, likely due to crash on startup.
nathang21 commented 4 years ago

I fixed by modifying the .ini file to reference DisplayPort1