top | item 37486058

(no title)

bdd | 2 years ago

> I'm not sure if KVM switching can be controlled over DDC but it's likely.

They do. Here's my shell function that helps me switch between DisplayPort-1 + USB uplink cable to the host AND USB-C cable with DisplayPort Alt Mode+Charging+uplink to display's USB hub.

  # x0f: DisplayPort-1
  # x1b: USB-C
  DDC_SOURCES=("x0f" "x1b")

  switchkvm() {
    local vcp_input_src="x60"
    local current next src
    current=$(ddcutil -t getvcp ${vcp_input_src} | awk '{ print $4 }')
    for src in "${DDC_SOURCES[@]}"; do
      if [[ ${src} != "${current}" ]]; then
        next=${src}
      fi
    done
  
    if [[ -z ${next} ]]; then
      echo "No eligible alternate input in \$DDC_SOURCES" >&2
      echo "\$DDC_SOURCES=(${DDC_SOURCES[*]}); current=${current}"
      return 1
    fi

    ddcutil setvcp "${vcp_input_src}" "${next}"
  }

discuss

order

boffinAudio|2 years ago

Thanks for sharing that - its very useful to know that there is a way to do this, I just need to select the right hardware ..