ScriptGod1337 / kvm

Utility to work with the integrated hardware KVM switch of modern monitors.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KVM utilities (DELL)

Utility to work with the integrated hardware KVM switch of modern monitors.

Currently the focus of this tool is the DELL U4919DW

Components

The tool consists of two components

  1. KVM Util: python based tool to send commands to the KVM switch and control it
  2. MonitorTool Hook: reverse engineering tool for Windows closed source tools of the monitor manufacturers. It allows to spy on them to gather the VCP commands they write and read on the display

KVM Util

Prerequisites

Installed Python 3 of course.

a) Windows

b) Linux

  • External git repository cloned into kvm\ddcci
  • Installed Python package python-smbus pip3 install smbus
  • Installed ddcutil for pbpswitch commands (see https://www.ddcutil.com) sudo apt-get install ddcutil
  • User must have access to the i2c devices /dev/i2c-X: e.g. add user to group i2c

Usage

First determine the device ID of the display. You can use ddccontrol -p on Linux. On Windows it's the 0-based index of the attached monitors.

Get the src folder, navigate to src\kvmutil and execute kvmutil.py.

kvmutil.py [-h] deviceid {inputselect,pbp,pbpsubinputselect,pbpswitch,pbpswitch2,pbpswap} ...

Usage examples

In the sub folders of kvmutil there are some examples of real usages of the tool in Windows (kvmutil\win) and Linux (kvmutil\linux)

MonitorTool Hook

The tool is written in C# and uses the EasyHook framework (see https://easyhook.github.io/).

You can download the latest/nightly build: https://raw.githubusercontent.com/ScriptGod1337/kvm/master/downloads/MonitorToolHook.7z
Usage: Monitor.exe MonitorToolToSpy
For example for DELL Monitor.exe "C:\Program Files (x86)\Dell\Dell Display Manager\ddm.exe"

Important: the monitor must be the parent process of the program to hook - e.g. by doing a fresh start of it. This means close Dell Display Manager prior starting the monitor

The monitor logs the VCP commands send by the program to the console. You can execute a functionality of the monitor manufacture tool and find out which VCP command with which parameter was written or read

Monitor.exe "C:\Program Files (x86)\Dell\Dell Display Manager\ddm.exe"
...
**read  OK GetVCPFeatureAndVCPFeatureReply_Hook 0x0 0xE5 0x0 0xFF
**read  OK GetVCPFeatureAndVCPFeatureReply_Hook 0x0 0xE7 0xFF20 0xFFAA
**read  OK GetVCPFeatureAndVCPFeatureReply_Hook 0x0 0xE8 0x12 0xFFFF
**read  OK GetVCPFeatureAndVCPFeatureReply_Hook 0x0 0xE9 0x0 0xFF
...
**write SetcVCPFeature 0x0 0xE9 0x24
...

These values can be used in the KVM Util or in custom scripts

Run the code locally

  1. Download the code or clone the repo
  2. Copy the EasyHook dll's over from the download linked above into the src\MonitorToolHook\Monitor folder
  3. Open the solution file
  4. Go to the properties page of Monitor.csproj and add the location of ddm.exe to the Debug settings 'command line arguments': "C:\Program Files (x86)\Dell\Dell Display Manager\ddm.exe"
  5. Run the Monitor project (set as startup project)

About

Utility to work with the integrated hardware KVM switch of modern monitors.

License:Apache License 2.0


Languages

Language:Python 72.2%Language:C# 24.2%Language:Shell 2.8%Language:Batchfile 0.8%