Display-switch: Turn a $30 USB switch into a full-featured multi-monitor KVM
github.com
github.com
As well as Dell's 40" ultrawide, that also has the built-in KVM (there are not that many models that have the built-in KVM).
Whoah. How do I obtain these ddc commands on macOS?
:~$ sudo ddcutil detect
Invalid display
I2C bus: /dev/i2c-1
EDID synopsis:
Mfg id: AUO
Model:
Serial number:
Manufacture year: 2009
EDID version: 1.3
DDC communication failed
This appears to be a laptop display. Laptop displays do not support DDC/CI.
Display 1
I2C bus: /dev/i2c-2
EDID synopsis:
Mfg id: DEL
Model: DELL U2415
Serial number: CFV9N94S0Y2S
Manufacture year: 2019
EDID version: 1.3
VCP version: 2.1I have a short script that will allow me to change input on a specific display. Very handy. However please note, that while this does work for HDMI, DVI and Displayport only DVI/HDMI seems to have an active connection when another input has been selected.
That means that while I can switch to another input I can not switch back from the same computer but must install something on the other machine to give it back. This is of course exactly what the linked article is doing, but with HDMI/DVI I don't have to have that requirement. And on top of that, operating systems in general seem to believe that, when using displayport, switching to another input is equivalent to disconnecting the display altogether and thus remove it and rearrange windows etc. Insanely frustrating.
Again, no problem with HDMI/DVI. So although Displayport is a much better interface and I've been a strong advocate for it, these issues makes me hate it with passion.
DDC can also be used to change display brightness, which in my opinion is way too cumbersome to do manually (especially if you have more than one display).
#!/bin/bash
ddcutil setvcp 60 0x11
On my Windows guest desktop, I set up a shortcut for Dell Display manager to switch back to my Linux host and primary graphics card on my display's DisplayPort input "C:\Program Files (x86)\Dell\Dell Display Manager\ddm.exe" SetActiveInput DP
Trivial to set up and works great.So for linux (e.g. fedora):
dnf install ddcutil
ddcutil capabilities -d 1 # show the available commands
ddcutil setvcp 60 0x11 # for example switch to HDMI 1
# assign a global shortcut key to the `ddcutil setvcp` command you need
And for windows: - download the "Dell Display Manager" software from their support site
- assign a shortcut key in the Dell Display Manager: "Input Manager" tab => "Favourite Input Shortcut Key"
I used the same shortcut (Ctrl-Alt-ScrollLock) for both linux(kde)/windowsAlso the functionality is completely free, the Pro license isn’t needed if you only switch inputs and occasionally adjust brightness or volume.
This might be a more comfortable solution if your monitor allows input switching through DDC.
Any idea why?
I also use this setup with gaming consoles so that I don't have to dedicate an entire monitor.
Few more notes:
- I use PCIE rather than USB for the capture card
- Can be costly if you need 4k + multiple inputs (for multiple "monitors" as different OBS windows)
- I had issues getting the capture card to recognize scaled HiDPI resolutions from my work Mac
No help with consoles of course, and perhaps not an option for a work machine.
edit: feature list also mentions "KVM remote control of any workstation running Scan Converter from NDI Studio Monitor"
I use two capture cards and them on th bottom monitors when needed (use 4 screens). This way I can also easily stream and records the screens when on a meeting that is on another machine.
https://github.com/fiddyschmitt/SimpleKVM
The GUI makes things (hopefully) a little easier to set up.
It was inspired by Haimgel's project.
It's nice to be able to run the monitor at native resolution and refresh rate, without paying hundreds for a KVM.
I've removed that external dependency and published a new release.
Yes Windows only; I'll add mac & linux when I get a bit more time.
Cheers, Fidel
Apparently Thunderbolt/DisplayPort are not really a thing yet for some reason, so I ended up getting a USB (KM) switch instead. With this project, it looks like I'll be able to have my cake and eat it too.
One pro is that it's able to get power from any of the USB inputs, so no extra cable!
One con is that for some reason it only does USB 2...
Amazon FR link : https://www.amazon.fr/gp/product/B08Q7J3B82
There's plenty of different hardware out there but not a whole lot of reviews; and my experience with the HDMI interface has, on the whole, not been the best. HDMI is great for consumer stuff, and for plugging in a generic source to a screen (AppleTV, Firestick, Xbox, cable box, etc) -- but, as soon as you want to do anything even slightly more advanced, you often run into hiccups quite rapidly (EDID & handshake/negotiation issues, cable & port quality, HDCP, etc).
I have several 'screens' (TVs) and I wanted to be able to mirror my 'main' display to other screens on occasion, for instance. It's easy to do that with a cheap-ish "splitter" [though they are finnicky), but if you want to "scale" that at all then you rapidly run into proprietary and/or high-cost solutions or have to make substantial quality & capability concessions (and >=10G LAN connectivity is pre-existing).
I was annoyed by the lack of good options & and the extreme prices and/or the limitations of the options that do exist -- enough so that I'm working on (and already actively using) my own IP-based "video distribution" solution, heh.
I can’t say how well a balun/extender setup will work but I believe they make boxes that specifically do that - a combination matrix and extender. I have no issues with HDCP. Happy to answer any other questions.
Search Monoprice for Audio/Video splitters but pay very close attention to the description. Make sure you understand the number of sources and sinks it offers.
Would you care to post the brand and serial for the matrix?
The 16x16 I bought from a small online company called “HDTV Supply” - model number HDCVT4K1616. They were a pleasure to work with.
(Mods please let me know if there are any issues sharing these vendors.)
I wish it were easier to hack on monitor firmware. I'd love to improve it.
I cannot guarantee that. At. All.
The only thing I would still buy from Samsung these days is storage devices.
Unfortunately, HP bought their printer business in 2017. My ML1640 is still truckin' along just fine, however...
I will never buy Samsung or LG again - the displays themselves were great but the UI/UX for switching inputs and brightness etc are simply too excruciating.
#!/bin/bash
src="pc"
while true; do
lsusb -d 04d9:a0d1 >/dev/null # Keyboard connected?
ret=$?
if [ $ret -eq 0 -a "$src" != "pc" ]; then
src="pc"
ddcutil --noverify setvcp 60 0x0f # Switch monitor input to DP
elif [ $ret -eq 1 -a "$src" = "pc" ]; then
src="laptop"
ddcutil --noverify setvcp 60 0x11 # Switch monitor input to HDMI
fi
sleep 1
doneOne second latency ... not ideal.
Is there any way to sleepwait on a USB config change instead?
[EDIT]: this might help:
https://stackoverflow.com/questions/469243/how-can-i-listen-...
ACTION=="add", DEVPATH=="*/input/*", RUN+="/usr/local/bin/script.sh $devnode"Now for my 2022 project I want to build one those promicro/QMK based custom keyboards with a direct I2c connection to my monitor and control it via hot keys. Eventually I'd add promicros for each computer all talking I2c and the keyboard is smart enough to forward keypresses to the active computer. That's my idea anyway.
I'm having a hard time understanding how a USB switch can manipulate a monitor, directly or indirectly, to behave as an alternative to a KVM switch. The project README fails to provide practical examples and detail this hack in the simplest way possible. I'd love to have this solution working for a personal homelab, as prices for KVM switches are too high to financially bear.
If I get this solution working, I will contribute back to the README to address this issue.
UPDATE: Never mind! I found a relevant thread: https://news.ycombinator.com/item?id=29609573
https://github.com/debauchee/barrier
the general concept is you could have 2, 3, 4 or more individual desktop PCs at one desk, each connected to their own displays, and one keyboard and one mouse. The keyboard and mouse are on the primary workstation, you can roll the mouse off the edge of one screen and onto another.
The secondary and tertiary workstation PCs have no keyboard/mouse i/o plugged into them, just power, ethernet and display.
I also have a few PCs and use the input selection on my monitor to achieve the KVM aspect. The only issue I found is that if no monitor is actively connected to a windows machine, barrier server doesn’t work well, and also you can’t Remote Desktop to it. I solved both of these by adding a dummy HDMI dongle, set to a low resolution so application windows can’t get stuck there.
Not a perfect solution but the best I’ve found since my goals were: to use a Bluetooth keyboard and mouse, and not worry about limitations to refresh rate, etc.
Installed on macOS 12.1 and Windows 10 or 11, and nothing happens!
It sees the client and server just fine. But never moves over!
Maybe I should the try the paid Synergy!
The Logitech solution has the lag when you bang against the side of the screen, and thats no good! :-)
I'll give it another go :-)
Author's site: https://haim.dev/posts/2020-07-28-dual-monitor-kvm/
BTW, for some reason I could never get this working on my Hackintosh, keeps crashing the system and never took the time to look into it.
Not only does every monitor I’ve owned take seconds to do this, it often screws with the desktop layout and such when display devices seemingly come and go. Or am I misunderstanding this?
Documentation for most consumer monitors is pretty lacking in this regard, it seems to be a feature mostly on monitors targeted to the professional market.
Reminds me of an i2c motor controller I bought years ago, based off some avr microcontroller. I spent an afternoon trying to understand how I'd hooked things up wrong, trying to understand why I couldn't read the control values. Turns the soft i2c interface just didn't implement reading values off the controller at all, but served ok if I treated it as a write-only device. Frustrating tricky devices. Sometimes they lie.
But yeah, also a >15% chance your monitor doesn't support switching inputs via DDC/CI. Would be so nice if review sites would cover this sort of thing. As it is, it's just a tech-secret, something invisible to the market, no push to include it, no points deducted for getting it wrong/bad. It leaves a lot of room for the situation to sit & not improve. Better reviewing would help move things along.
My corporate Dell XPS 13 is completely useless outdoors because it's incompatible with sunglasses.
My only gripe is that when I press the USB switch to change inputs, I must follow with a press on the keyboard to wake up the other computer, otherwise the monitor sees that the new input has no signal and switches back to the previous input. In which case I must either manually change inputs on the screen, or press the usb switch a couple more things to try again. But I guess there's not much display-switch can do about that..
You could probably get that result at the moment using the external command feature and something like xdotool (on Linux)
I reckon it's probably 25 or 30 lines or Rust if you make it use the uinput crate to create a fake input device and send a mouse-move event that way.
Also bought Synergy that works fine but I need keep the software running(a wifi switch will lose the connection, so it's not the same as the hardware kvm switch).
I now use usb-switch for keyboard/mouse only, and use my monitor's own button to switch displays, so far it is not convenient but "works".
One of the computers is a work issued laptop and with this solution i won't have to install any software.
The monitor is rather slow to switch inputs, but otherwise all is good.
The only visible thing on the desk is the button for switching USB devices.
I have 2x Dell P2319H (1080p) monitors and have my work laptop connected via DP with my gaming desktop connected via HDMI. Then I have a dumb USB switch with a button on it to switch my USB devices between the two computers.
If the other computer is off/sleeping the screens most of the time automatically switch to the correct inputs, but sometimes I need to use the screen controls to do it.
This set up cost 10s of dollars as opposed to 100s for a proper KVM switch and it’s worked pretty well for the last 2.5 years.
I’ll try this utility when I get home and it will hopefully make it so the USB switch’s button is all I’ll need to press and it will work, even if both the computers are turned on.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
... really such a great idea? Even ignoring the curl | sh it's going to bork many systems now having two rusts. Rust projects you're supposed to compile are not ready for use by anyone but other bleeding edge Rust devs.
The big downside is that switching inputs on my monitor takes ~5 seconds where a proper kvm would be instant.
This is something the industry should address. It's ridiculous.
Too bad, I often need a KVM switch exactly when I'm installing a new OS on an embedded system (and from that point on I don't need the switch because I can just use the network to log in and install software).
So this solution doesn't work for me at precisely the moment I need it.
It also seems like you can switch from any computer currently connected. Have your normal computer switch to the other computer's input.
I'm using this command
sudo virsh start win10;sudo ddcutil -d 1 setvcp 0x60 0x03
To start Windows and change display input to DVI, which is the GPU for my Windows VM.
Changing back can be done either by powering the VM down or running the command
sudo ddcutil -d 1 setvcp 0x60 0x0F
Could a compromised computer listen for keystrokes or send input to an adjacent node or similar?
I do not know if other monitors would be faster. I looked at KVM that support high resolution, but they are insanely expensive and I am not even sure they would not introduce any latency.
It would definitely help having a figure or diagram showing how things are meant to be wired up.
This is the USB switch I use with it: https://www.iogear.com/product/GUS402/
It needs to run on each computer in the setup since it watches for the USB devices to connect.
Without this phrase, your comment would be far friendlier and also not break the HN guidelines.
A project about cooperatively switching display inputs to get rid of a video switcher should say so in the title.
This device switches your keyboards and mice and so on between two computers. The software in OP reacts to these events and switches monitor inputs using some equivalent of HDMI CEC called DDC/CI.
[0]: https://smile.amazon.com/Switcher-Selector-Computers-Keyboar...
I dunno man, this worked pretty ok for me:
> This utility watches for USB device connect/disconnect events and switches monitor inputs via DDC/CI.
And then a couple lines latter, a sample config that makes it pretty obvious how simple this goes:
> usb_device = "1050:0407" \ on_usb_connect = "Hdmi1" \ on_usb_disconnect = "Hdmi2"
Plug in a device & switches to hdmi1. Unplug & it switches to hdmi2. A USB switch is optional, one could just move where they plug their mouse into by hand, for example. But you don't seem to be interested in helping fill yourself in on anything here, on learning, on using search engines to find anything out. Honestly filling in the neophyte knowledge like that is not what project descriptions are for, in my book.
Generally, dude: relax, chill out. Most everything on this planet could use better description. But this seemed pretty clear & simple to me, at least. I think it'll work for a lot a lot of people as is. No need to be aggressively rude. Have you ever dealt with any kind of soft-kvm like technology before? Perhaps people would more self-select into this kind of project, versus rando's walking in on the street. I think that's ok.
A "USB switch" reads like a switch with a USB cable on it, that the computer it is plugged into can see when it changes. Which is fine, except the fact that a keyboard and mouse are also presumed to be plugged in is not said or hinted.
"DDC/CI" is similarly undefined. A program switching video inputs makes no sense: a computer produces video output, not input. You would need to know the program is sending commands to the monitor to tell that to switch to a different input.
Both of these facts could easily have been in the first sentence. Without, the whole article is noise.
The USB switch button will send a connect/disconnect event to both computers and they will then react accordingly.
I wrote a similar program, you just listen for something connected to the hub disappearing
if mouse no longer connected:
tell monitor to switch output via DDC
else if mouse now connected:
tell monitor to switch back via DDCWhen you press the button on the USB switch to go to another PC, the software detects this and sends data commands over the monitor connection (using DDC standard) to trigger the monitors to switch inputs. You can use this same data communications standard to do things like adjust the brightness of your display. For example, I have these setup on my Mac to adjust the brightness of my two attached displays (complexity increased with multiple displays and desire for each to change at same time, simpler commands with a single display):
alias day="seq 3 | xargs -n 1 -P 3 sh -c 'ddcctl -d \$1 -b 80' sh" alias evening="seq 3 | xargs -n 1 -P 3 sh -c 'ddcctl -d \$1 -b 32' sh" alias night="seq 3 | xargs -n 1 -P 3 sh -c 'ddcctl -d \$1 -b 10' sh"
Does that make sense? As mentioned earlier, you're limited by the minimum number of inputs on the monitor(s) and/or the minimum number of computers the USB switch can be connected to. The simplicity of this system is that the display connections do not go through any switching layer and are instead directly connected to the computers (which avoids a number of compatibility issues).
I should be clear that I haven't used this yet but I'm going to try it. The Acer monitors I'm using have two HDMI ports and 1 DisplayPort so I can in practice attach 3 computers assuming I buy a USB switch which can connect to 3 or more computers.
If you only want a single monitor, there are switches that also switch between different video inputs. These are commonly referred to as "KVM switches" (KVM being Keyboard, Video, Mouse.) But KVM switches cost more money...
My understanding is this project allows you to use a plain USB switch and the multiple video inputs on your monitor to simulate a full blown KVM switch.
Now I got it, thanks!
Invalid display
I2C bus: /dev/i2c-15
EDID synopsis:
Mfg id: LGD
Model:
Serial number:
Manufacture year: 2013
EDID version: 1.4
DDC communication failed
This is an eDP laptop display. Laptop displays do not support DDC/CI.
Display 1 I2C bus: /dev/i2c-17
EDID synopsis:
Mfg id: GSM
Model: LG HDR 4K
Serial number:
Manufacture year: 2018
EDID version: 1.3
VCP version: 2.1
So knowing that my LG monitor is display device #1, I then ran "ddcutil -d 1 capabilities"MCCS version: 2.1
VCP Features:
Feature: 02 (New control value)
Feature: 04 (Restore factory defaults)
Feature: 05 (Restore factory brightness/contrast defaults)
Feature: 08 (Restore color defaults)
Feature: 10 (Brightness)
Feature: 12 (Contrast)
Feature: 14 (Select color preset)
Values:
05: 6500 K
08: 9300 K
0b: User 1
Feature: 16 (Video gain: Red)
Feature: 18 (Video gain: Green)
Feature: 1A (Video gain: Blue)
Feature: 52 (Active control)
Feature: 60 (Input Source)
Values:
0f: DisplayPort-1
10: DisplayPort-2
11: HDMI-1
12: HDMI-2
Feature: AC (Horizontal frequency)
Feature: AE (Vertical frequency)
Feature: B2 (Flat panel sub-pixel layout)
Feature: B6 (Display technology type)
Feature: C0 (Display usage time)
Feature: C6 (Application enable key)
Feature: C8 (Display controller type)
Feature: C9 (Display firmware level)
Feature: D6 (Power mode)
Values:
01: DPM: On, DPMS: Off
04: DPM: Off, DPMS: Off
Feature: DF (VCP Version)
Feature: 62 (Audio speaker volume)
Feature: 8D (Audio Mute)
Feature: F4 (manufacturer specific feature)
Feature: F5 (manufacturer specific feature)
Values: 00 01 02 (interpretation unavailable)
Feature: F6 (manufacturer specific feature)
Values: 00 01 02 (interpretation unavailable)
Feature: 4D (unrecognized feature)
Feature: 4E (unrecognized feature)
Feature: 4F (unrecognized feature)
Feature: 15 (unrecognized feature)
Values: 01 06 09 10 11 13 14 28 29 32 44 48 (interpretation unavailable)
Feature: F7 (manufacturer specific feature)
Values: 00 01 02 03 (interpretation unavailable)
Feature: F8 (manufacturer specific feature)
Values: 00 01 (interpretation unavailable)
Feature: F9 (manufacturer specific feature)
Feature: E4 (manufacturer specific feature)
Feature: E5 (manufacturer specific feature)
Feature: E6 (manufacturer specific feature)
Feature: E7 (manufacturer specific feature)
Feature: E8 (manufacturer specific feature)
Feature: E9 (manufacturer specific feature)
Feature: EA (manufacturer specific feature)
Feature: EB (manufacturer specific feature)
Feature: EF (manufacturer specific feature)
Feature: FD (manufacturer specific feature)
Values: 00 01 (interpretation unavailable)
Feature: FE (manufacturer specific feature)
Values: 00 01 02 (interpretation unavailable)
Feature: FF (manufacturer specific feature)quirred
So I pretty much have control of all monitor features!