<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Knowledge Base (Posts about ddccontrol)</title><link>https://bgstack15.ddns.net/blog/</link><description></description><atom:link href="https://bgstack15.ddns.net/blog/categories/ddccontrol.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2022 &lt;a href="mailto:bgstack15@gmail.com"&gt;bgstack15&lt;/a&gt; 
&lt;a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/"&gt;
&lt;img alt="Creative Commons License BY-SA"
style="border-width:0; margin-bottom:12px;"
src="https://bgstack15.ddns.net/.images/l_by-sa_4.0_88x31.png"&gt;&lt;/a&gt;</copyright><lastBuildDate>Wed, 12 Oct 2022 13:00:32 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>ddccontrol for monitors</title><link>https://bgstack15.ddns.net/blog/posts/2022/10/12/ddcontrol-for-monitors/</link><dc:creator>bgstack15</dc:creator><description>&lt;h2&gt;The story&lt;/h2&gt;
&lt;p&gt;I use an Nvidia graphics card on my Devuan Ceres desktop. I also use two monitors, and a kvm switch for one of the monitors. On the other monitor I have a 3-input HDMI input switcher. Some article I read on the Internet suggested that one can use software to interact with the monitors, using the ddc protocol. I think DDC is how my old computers could recognize what was plugged in to my VGA port (and nowadays, VGA, displayport, and unfortunately some HDMI) by name.&lt;/p&gt;
&lt;p&gt;On GNU/Linux, that software is ddccontrol. To enable Nvidia to pass through ddc protocol, I had to enable a module parameter. I set value in new file &lt;code&gt;/etc/modprobe.d/nvidia-registry.conf&lt;/code&gt; which turns on the i2c capabilities of my &lt;code&gt;01:00.0 VGA compatible controller: NVIDIA Corporation GP107 [GeForce GTX 1050 Ti] (rev a1)&lt;/code&gt;.&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;nvidia&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;NVreg_RegistryDwords&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"RMUseSwI2c=1"&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;I re-ran update-initramfs to ensure even the initram has this new setting.&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;sudo update-initramfs -u -k $( uname -r )
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;After a reboot (just to be sure), in userspace, I can now query the monitor. To learn the input field:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;$ ddccontrol dev:/dev/i2c-4 -d &lt;span class="p"&gt;|&lt;/span&gt; grep -i input
 Control 0x60: +/5/3 C &lt;span class="o"&gt;[&lt;/span&gt;Input Source Select &lt;span class="o"&gt;(&lt;/span&gt;Main&lt;span class="o"&gt;)]&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;My two identical Samsung monitors ended up needing slightly different ddccontrol commands. I suspect this is due to one is connected via HDMI and one via DP.&lt;/p&gt;
&lt;p&gt;My &lt;code&gt;monitor-left-hdmi.sh&lt;/code&gt; command:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;ddccontrol dev:/dev/i2c-4 -r 0x60 -w '5'
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;monitor-left-dp.sh&lt;/code&gt;:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;ddccontrol dev:/dev/i2c-4 -r 0x60 -w '3'
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;monitor-right-vga.sh&lt;/code&gt;:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;ddccontrol dev:/dev/i2c-2 -r 0x60 -w '1'
ddccontrol dev:/dev/i2c-2 -r 0xdb -w '4'
ddccontrol dev:/dev/i2c-2 -r 0xdc -w '6'
ddccontrol dev:/dev/i2c-2 -r 0xeb -w '253'
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;monitor-right-hdmi.sh&lt;/code&gt;:&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;ddccontrol dev:/dev/i2c-2 -r 0xdb -w '253'
ddccontrol dev:/dev/i2c-2 -r 0xdc -w '260'
ddccontrol dev:/dev/i2c-2 -r 0xeb -w '9'
ddccontrol dev:/dev/i2c-2 -r 0x60 -w '5'
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;I learned all those by evaluating the output of &lt;code&gt;ddccontrol dev:/dev/i2c-4 -d&lt;/code&gt; after manually choosing the inputs I cared about.&lt;/p&gt;
&lt;p&gt;These monitors didn't have prebuilt profiles in the ddccontrol-db.&lt;/p&gt;</description><category>ddccontrol</category><category>display</category><category>driver</category><category>graphics</category><category>monitors</category><category>shell</category><guid>https://bgstack15.ddns.net/blog/posts/2022/10/12/ddcontrol-for-monitors/</guid><pubDate>Wed, 12 Oct 2022 12:58:53 GMT</pubDate></item></channel></rss>