2.4 KiB
Internal KVM Switch
FastAPI dashboard and polling service for Alienware-only KVM switching.
Trigger Logic
The Samsung monitor is trigger-only and uses fixed input codes:
- Tower trigger:
15 - Laptop trigger:
19
Each installation of this tool is for one device only. The UI lets you choose:
-
this device role:
towerorlaptop -
this device Alienware target port:
-
DP1 -
DP2 -
HDMI
The device role can also still be provided by:
- environment variable
KVM_DEVICE_ROLE - or
config.jsonfielddevice_role
Valid values are:
towerlaptop
Examples:
- Tower role with UI port
DP1-> on Samsung trigger15, sendDDM.exe /1:WriteActiveInput DP1 - Laptop role with UI port
DP2-> on Samsung trigger19, sendDDM.exe /1:WriteActiveInput DP2
Retry behavior:
- Only attempts switching while the Samsung screen is connected
- After each switch attempt, waits
5seconds and rechecks - Tries at most
3times per Samsung-connected session - After success, it will not try again until the Samsung screen disconnects and reconnects
Run
uv run kvm-switch
The dashboard is served at http://localhost:4000.
Test
uv run pytest -q
Diagnostic Script
Use this to inspect connected DDC/CI monitors and current input values:
uv run monitorcontrol_main.py
Autostart
Easiest option: Startup folder
You can now set the role in the UI, so this step is optional.
If you prefer a default role before opening the dashboard, set it for that Windows user:
Tower machine:
[System.Environment]::SetEnvironmentVariable("KVM_DEVICE_ROLE", "tower", "User")
Laptop machine:
[System.Environment]::SetEnvironmentVariable("KVM_DEVICE_ROLE", "laptop", "User")
- Press
Win + R - Run:
shell:startup
- Create a shortcut in that folder pointing to:
C:\Users\LagoWorkStation\OneDrive\Documentos\BE-terna\Internal - KVM Switch\start_kvm_switch.cmd
This will start the app when you log in. It opens a console window.
Cleaner option: Task Scheduler
Use Task Scheduler if you want it to start automatically at logon with better control.
Program/script:
cmd.exe
Arguments:
/c "C:\Users\LagoWorkStation\OneDrive\Documentos\BE-terna\Internal - KVM Switch\start_kvm_switch.cmd"
Set the trigger to At log on.