<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: SHIV GARG</title>
    <description>The latest articles on DEV Community by SHIV GARG (@shiv_garg_ec7172f9eeb7cff).</description>
    <link>https://dev.to/shiv_garg_ec7172f9eeb7cff</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1797054%2F6b2fec9f-4437-43b5-8388-e50265b7a8fc.jpg</url>
      <title>DEV Community: SHIV GARG</title>
      <link>https://dev.to/shiv_garg_ec7172f9eeb7cff</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shiv_garg_ec7172f9eeb7cff"/>
    <language>en</language>
    <item>
      <title>I Spent $4 in AI Tokens to Avoid Buying a $10 HDMI Switch (And It Was Worth It)</title>
      <dc:creator>SHIV GARG</dc:creator>
      <pubDate>Tue, 04 Aug 2026 19:19:33 +0000</pubDate>
      <link>https://dev.to/shiv_garg_ec7172f9eeb7cff/i-spent-4-in-ai-tokens-to-avoid-buying-a-10-hdmi-switch-and-it-was-worth-it-1pem</link>
      <guid>https://dev.to/shiv_garg_ec7172f9eeb7cff/i-spent-4-in-ai-tokens-to-avoid-buying-a-10-hdmi-switch-and-it-was-worth-it-1pem</guid>
      <description>&lt;p&gt;&lt;em&gt;A journey into DDC/CI — the remote-control protocol that has been hiding inside your display cable for over twenty years, and how it turned my monitor into a KVM.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The desk that started it all
&lt;/h2&gt;

&lt;p&gt;My setup looks ordinary: a MacBook Air open on the desk (my primary machine), and an LG 32UN880K — a 32" 4K monitor with two HDMI ports, DisplayPort, and USB-C. The less ordinary part is behind the MacBook: an ASUS gaming laptop running Linux whose internal screen died. It now lives as a headless tower. The external monitor isn't an accessory for it; it's the &lt;em&gt;only&lt;/em&gt; display it has — BIOS, boot menu, everything.&lt;/p&gt;

&lt;p&gt;Keyboard and mouse were already solved: &lt;strong&gt;Input Leap&lt;/strong&gt;, a software KVM, lets me type on the ASUS using the Mac's keyboard and mouse. The unsolved problem was the dumbest one: &lt;strong&gt;switching the monitor between the two machines.&lt;/strong&gt; The LG's physical OSD button works, but with several switches a day I could feel its lifespan ticking away under my thumb.&lt;/p&gt;

&lt;p&gt;Spoiler: the monitor turned out to speak its own private dialect, and figuring that out is most of this story.&lt;/p&gt;

&lt;h2&gt;
  
  
  Chapter 1: The sensible options
&lt;/h2&gt;

&lt;p&gt;I priced hardware. A 4K@60 HDMI switch with an IR remote runs about $10 — Mac on a 3-in-1 USB-C dongle, ASUS on HDMI, click a remote. It would have worked. It also meant a permanent dongle in the Mac's path, a gamble on whether that dongle even does 4K@60, another box, another remote — a drawer already full of exactly this kind of solution.&lt;/p&gt;

&lt;p&gt;I was one "Buy Now" click away when, mid-discussion with an AI agent I was using to plan the rewiring, it said something that rerouted the whole project:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;"Your monitor already speaks DDC/CI. You may not need any of this."&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Chapter 2: The protocol nobody told me about
&lt;/h2&gt;

&lt;p&gt;Here's what I learned, and what most people genuinely don't know: inside every HDMI, DisplayPort, and USB-C display cable, alongside the wires carrying gigabits of video, there are two extra wires carrying a humble little I²C bus. It exists so your computer can read the monitor's EDID — its name tag of resolutions and timings.&lt;/p&gt;

&lt;p&gt;But VESA didn't stop there. The &lt;strong&gt;DDC/CI standard&lt;/strong&gt; (with the MCCS command set) lets the computer send &lt;em&gt;commands to the monitor&lt;/em&gt; over that same bus. Brightness (&lt;code&gt;0x10&lt;/code&gt;), volume (&lt;code&gt;0x62&lt;/code&gt;), power (&lt;code&gt;0xD6&lt;/code&gt;) — and the crown jewel:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;VCP code &lt;code&gt;0x60&lt;/code&gt;: input source selection.&lt;/strong&gt; Send the right value and the monitor changes inputs. No OSD button. No IR remote. No KVM box. The monitor &lt;em&gt;is&lt;/em&gt; the switch — it has been, the whole time.&lt;/p&gt;

&lt;p&gt;Every OS has tools for this: &lt;code&gt;m1ddc&lt;/code&gt; and BetterDisplay on macOS, &lt;code&gt;ddcutil&lt;/code&gt; on Linux, ControlMyMonitor and Monitorian on Windows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Chapter 3: The blink
&lt;/h2&gt;

&lt;p&gt;First attempt, with the minimalist tool &lt;code&gt;m1ddc&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;m1ddc display 2 &lt;span class="nb"&gt;set &lt;/span&gt;input 17
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The screen &lt;strong&gt;blinked&lt;/strong&gt; — and stayed on the Mac. &lt;code&gt;get input&lt;/code&gt; returned &lt;code&gt;0&lt;/code&gt;, which is nonsense. I tried other values. Blink, blink, nothing. Yet switching manually with the OSD button worked fine, so the ASUS signal was there.&lt;/p&gt;

&lt;p&gt;The command was clearly &lt;em&gt;reaching&lt;/em&gt; the monitor — something was happening — but the switch itself was being vetoed. If you've ever tried DDC input switching on an LG and concluded "it just doesn't work," you have been exactly here.&lt;/p&gt;

&lt;h2&gt;
  
  
  Chapter 4: The dialect
&lt;/h2&gt;

&lt;p&gt;The breakthrough came from installing BetterDisplay and asking it what inputs the monitor &lt;em&gt;claims&lt;/em&gt; to have:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;betterdisplaycli get &lt;span class="nt"&gt;-nameLike&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;LG &lt;span class="nt"&gt;-inputSourceList&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1  - DisplayPort 1           [DDCController]
3  - HDMI 1                  [DDCController]
...
14 - DisplayPort 1 (LG alt)  [DDCController]
15 - DP 2 / USB-C (LG alt)   [DDCController]
16 - USB-C (LG alt)          [DDCController]
17 - HDMI 1 (LG alt)         [DDCController]
18 - HDMI 2 (LG alt)         [DDCController]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There it was. &lt;strong&gt;Many LG monitors require an alternate DDC addressing scheme for input switching.&lt;/strong&gt; Standard-addressed commands arrive, hiccup the link (the blink), and get ignored. LG-alt-addressed commands are honored. My monitor wasn't refusing to speak — I was just speaking the wrong dialect.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;betterdisplaycli perform &lt;span class="nt"&gt;-nameLike&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;LG &lt;span class="nt"&gt;-changeInputSource&lt;/span&gt; &lt;span class="nt"&gt;-value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;17
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Mac desktop vanished and the Linux penguin wallpaper filled the screen. I may have said something out loud to no one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Chapter 5: The way back
&lt;/h2&gt;

&lt;p&gt;Switching &lt;em&gt;to&lt;/em&gt; the ASUS was solved. Switching back was a new puzzle: &lt;code&gt;16&lt;/code&gt; ("USB-C (LG alt)") did nothing. So we swept the candidates — my terminal on the MacBook's little screen printing &lt;code&gt;TRYING 16&lt;/code&gt;, &lt;code&gt;TRYING 6&lt;/code&gt;, &lt;code&gt;TRYING 15&lt;/code&gt;... while the big monitor still showed Linux, waiting for one command to bring the Mac home.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Came back at 15"&lt;/strong&gt; — &lt;em&gt;DP 2 / USB-C (LG alt)&lt;/em&gt;. In hindsight it makes sense: USB-C alt mode &lt;em&gt;is&lt;/em&gt; DisplayPort, and this firmware files its USB-C port under DP.&lt;/p&gt;

&lt;p&gt;Two things worth writing down that day:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;DDC works on the inactive input.&lt;/strong&gt; The Mac can pull the monitor back even while you're looking at the ASUS. You don't have to be on screen to claim the screen.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read-back lies.&lt;/strong&gt; This monitor answers &lt;code&gt;get input&lt;/code&gt; with &lt;code&gt;0&lt;/code&gt; no matter what. Verify codes by watching the screen, then hardcode them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Chapter 6: I broke it
&lt;/h2&gt;

&lt;p&gt;Emboldened, I scripted a test loop and fired about ten input switches in under a minute. The monitor responded by dropping the USB-C link &lt;em&gt;entirely&lt;/em&gt;. macOS removed the display from its device list, the screen went to "no signal," DDC went dark, and every subsequent command returned &lt;code&gt;Failed.&lt;/code&gt; Unplugging and replugging the cable didn't even revive it — the physical button did.&lt;/p&gt;

&lt;p&gt;New rule, now embedded in my aliases as a &lt;code&gt;sleep&lt;/code&gt;: treat input switching like a physical relay, not a function call. One command, a beat of silence, then the next.&lt;/p&gt;

&lt;h2&gt;
  
  
  Chapter 7: The problem no hardware could fix
&lt;/h2&gt;

&lt;p&gt;Just when I thought I was done, I noticed the flaw in paradise — and it's the one the $10 switch never could have solved, because it isn't a video problem at all.&lt;/p&gt;

&lt;p&gt;With a direct USB-C connection, the link between Mac and monitor &lt;em&gt;stays alive&lt;/em&gt; even when the monitor displays another input — that's precisely why DDC still works. So macOS thinks the LG is right there. Switch to the ASUS, and all my Mac windows stay parked on a desktop I can't see. The old HDMI switch "fixed" this by amputation: cutting the link so macOS panics and dumps every window onto the laptop screen — never to return them.&lt;/p&gt;

&lt;p&gt;The better answer: &lt;strong&gt;don't cut the link, mirror it.&lt;/strong&gt; When switching to the ASUS, mirror the MacBook's display onto the LG's desktop. Nothing moves; every window just becomes simultaneously visible on the laptop screen. On the way back, unmirror. I tested both directions with a paranoid eye on window positions: layout intact, layout intact.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;betterdisplaycli &lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Built-in Display"&lt;/span&gt; &lt;span class="nt"&gt;-mirror&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;on  &lt;span class="nt"&gt;-targetNameLike&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;LG
betterdisplaycli &lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Built-in Display"&lt;/span&gt; &lt;span class="nt"&gt;-mirror&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;off
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The destination
&lt;/h2&gt;

&lt;p&gt;The whole workflow, end to end, is two shell aliases:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 17 = HDMI 1 (LG alt) -&amp;gt; ASUS | 15 = DP 2 / USB-C (LG alt) -&amp;gt; Mac&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;asus_display&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'betterdisplaycli perform -nameLike=LG -changeInputSource -value=17; sleep 1; betterdisplaycli set -name="Built-in Display" -mirror=on -targetNameLike=LG'&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;mac_display&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'betterdisplaycli set -name="Built-in Display" -mirror=off; sleep 1; betterdisplaycli perform -nameLike=LG -changeInputSource -value=15'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wiring: MacBook → one USB-C cable (4K@60 + 60W charging + the monitor's USB hub). ASUS → HDMI direct, so its BIOS and boot screen always work — non-negotiable with a dead panel. Keyboard/mouse on a cheap USB 2-host switch for dedicated ASUS sessions; Input Leap covers the other 90%.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Total hardware spend on display switching: $0.&lt;/strong&gt; Everything used from BetterDisplay is free-tier; it lives in my login items and I have never once opened its GUI. Total &lt;em&gt;token&lt;/em&gt; spend: about $4, which bought me a debugging partner that knows DDC dialects — and, fine, a blog post hook.&lt;/p&gt;

&lt;p&gt;Two aliases, typed from either machine, and the screen just knows where it's supposed to be looking.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd tell my past self
&lt;/h2&gt;

&lt;p&gt;The one thing worth carrying forward, if you're about to do this yourself: &lt;strong&gt;your monitor's DDC implementation is a snowflake, and the only way to know its dialect is to test it, not read about it.&lt;/strong&gt; Codes differ by vendor and firmware, read-back can lie outright, and some models (NVIDIA's proprietary Linux driver in particular) hide the DDC bus from &lt;code&gt;ddcutil&lt;/code&gt; before you ever get to the fun part. Budget ten minutes: send a code, watch the screen, write down what actually happened — not what the spec sheet promised.&lt;/p&gt;

&lt;p&gt;And two hard boundaries worth knowing before you start: DDC needs a running OS, so anything that needs pre-boot access (BIOS, GRUB) stays on dumb HDMI regardless of how clever your setup gets. And the target machine has to be awake — switch to a sleeping laptop and you'll earn a "no signal" screen and a walk to the monitor button anyway.&lt;/p&gt;

&lt;h2&gt;
  
  
  The point
&lt;/h2&gt;

&lt;p&gt;DDC/CI has ridden inside every display cable for more than two decades, and almost nobody knows it exists. We keep buying plastic boxes and IR remotes to solve with hardware a problem our computers could already solve with a protocol that's already plugged in.&lt;/p&gt;

&lt;p&gt;Right now, switching desks means typing &lt;code&gt;asus_display&lt;/code&gt; into a terminal that isn't even visible on the screen I'm about to hijack. The cable never moves. The button never gets pressed. Before you buy a KVM switch, give &lt;code&gt;betterdisplaycli&lt;/code&gt;, &lt;code&gt;ddcutil&lt;/code&gt;, or ControlMyMonitor ten minutes — worst case, you're out ten minutes; best case, your monitor was the KVM all along.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Setup: MacBook Air (Apple Silicon), ASUS laptop on Linux with a dead internal display, LG 32UN880K, BetterDisplay 4.3.5 (free tier), Input Leap for keyboard/mouse. Your input codes will differ — test empirically. Debugging credit: one persistent human, one AI agent, and $4 of tokens.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>hardware</category>
      <category>linux</category>
      <category>tools</category>
    </item>
  </channel>
</rss>
