<table><tr><td style="">ahiemstra added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D25018">View Revision</a></tr></table><br /><div><div><p>You are right, sorry. I was confusing /sys with /proc, which does have a lot of "put all of this information in a single file" stuff going on. It would still be nice if there was a better way of getting this information, but that is not related to this change. So then I mostly have style nitpicks as comment.</p></div></div><br /><div><strong>INLINE COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D25018#inline-142065">View Inline</a><span style="color: #4b4d51; font-weight: bold;">acpi.c:96</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">  <span class="bright"></span><span style="color: #aa4000"><span class="bright">if</span></span><span class="bright"> </span><span class="p"><span class="bright">(</span></span><span class="bright"> </span><span class="p"><span class="bright">(</span></span><span class="bright"> </span><span class="n">d</span> <span style="color: #aa2211">=</span> <span class="n">opendir</span><span class="p">(<span class="bright"></span></span><span class="bright"> </span><span style="color: #766510"><span class="bright">"/proc/acpi/battery"</span></span><span class="bright"> </span><span class="p"><span class="bright">)</span></span><span class="bright"> </span><span class="p"><span class="bright">)</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">==</span></span><span class="bright"> </span><span style="color: #304a96"><span class="bright">NULL</span></span><span class="bright"> </span><span class="p"><span class="bright">)</span></span><span class="bright"> </span><span class="p"><span class="bright">{</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"><span class="bright">  </span><span class="n"><span class="bright">AcpiBatteryNum</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">=</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">-</span></span><span class="bright"></span><span style="color: #601200"><span class="bright">1</span></span><span class="bright"></span><span class="p"><span class="bright">;</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">  <span class="n">d</span> <span style="color: #aa2211">=</span> <span class="n">opendir</span><span class="p">(<span class="bright"></span></span><span class="bright"></span><span style="color: #766510"><span class="bright">"/sys/class/power_supply/"</span></span><span class="bright"></span><span class="p"><span class="bright">);</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span class="bright">  </span><span style="color: #aa4000"><span class="bright">if</span></span><span class="bright"> </span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">d</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">!=</span></span><span class="bright"> </span><span style="color: #304a96"><span class="bright">NULL</span></span><span class="bright"></span><span class="p"><span class="bright">)</span></span><span class="bright"> </span><span class="p"><span class="bright">{</span></span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Can you clean up the indentation of this function? It should use 4 spaces for indentation.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D25018#inline-142064">View Inline</a><span style="color: #4b4d51; font-weight: bold;">acpi.c:112</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #aa4000">void</span> <span style="color: #004012">printSysBatteryCharge</span><span class="p">(</span><span style="color: #aa4000">const</span> <span style="color: #aa4000">char</span> <span style="color: #aa2211">*</span><span class="n">cmd</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">int</span> <span class="n">zone</span> <span style="color: #aa2211">=</span> <span style="color: #601200">0</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Braces on newline for function definitions please.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D25018#inline-142063">View Inline</a><span style="color: #4b4d51; font-weight: bold;">acpi.c:151</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span style="color: #aa4000">i<span class="bright">f</span></span><span class="bright"> </span><span class="p"><span class="bright">(</span></span><span class="bright"> </span><span class="n"><span class="bright">AcpiBatCapacity</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">></span></span><span class="bright"> </span><span style="color: #601200"><span class="bright">0</span></span><span class="bright"> </span><span class="p"><span class="bright">)</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span class="bright">  </span><span class="n"><span class="bright">AcpiBatteryCharge</span></span><span class="bright"></span><span class="p"><span class="bright">[</span></span><span class="bright"> </span><span class="n"><span class="bright">i</span></span><span class="bright"> </span><span class="p"><span class="bright">]</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">=</span></span><span class="bright"> </span><span class="n"><span class="bright">AcpiBatRemainingCapacity</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">*</span></span><span class="bright"> </span><span style="color: #601200"><span class="bright">100</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">/</span></span><span class="bright"> </span><span class="n"><span class="bright">AcpiBatCapacity</span></span><span class="bright"></span><span class="p"><span class="bright">;</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span class="bright"></span><span style="color: #aa4000"><span class="bright">else</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">      <span class="n">AcpiBatteryCharge</span><span class="p">[</span> <span class="n">i</span> <span class="p">]</span> <span style="color: #aa2211">=</span> <span style="color: #601200">0</span><span class="p">;</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">i<span class="bright">nt</span></span><span class="bright"> </span><span class="n"><span class="bright">state</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">=</span></span><span class="bright"> </span><span style="color: #601200"><span class="bright">0</span></span><span class="bright"></span><span class="p"><span class="bright">;</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="bright"></span><span style="color: #aa4000"><span class="bright">if</span></span><span class="bright"> </span><span class="p"><span class="bright">(</span></span><span class="bright"></span><span class="n"><span class="bright">current</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">></span></span><span class="bright"> </span><span style="color: #601200"><span class="bright">0</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">&&</span></span><span class="bright"> </span><span class="n"><span class="bright">maximum</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">></span></span><span class="bright"> </span><span style="color: #601200"><span class="bright">0</span></span><span class="bright"></span><span class="p"><span class="bright">)</span></span><span class="bright"> </span><span class="p"><span class="bright">{</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="bright">    </span><span class="n"><span class="bright">state</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">=</span></span><span class="bright"> </span><span class="n"><span class="bright">current</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">*</span></span><span class="bright"> </span><span style="color: #601200"><span class="bright">100</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">/</span></span><span class="bright"> </span><span class="n"><span class="bright">maximum</span></span><span class="bright"></span><span class="p"><span class="bright">;</span></span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">I don't see why current needs to be >0 ? What if I have an empty battery?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D25018#inline-142062">View Inline</a><span style="color: #4b4d51; font-weight: bold;">acpi.c:170</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"><span style="color: #aa4000">void</span> <span style="color: #004012">print<span class="bright">AcpiBatUsage</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span class="bright"> </span><span style="color: #aa4000">const</span> <span style="color: #aa4000">char<span class="bright"></span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">*</span></span><span class="bright"> </span><span class="n">cmd</span><span class="p">)</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"><span class="bright"></span><span class="p"><span class="bright">{</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #aa4000">void</span> <span style="color: #004012">print<span class="bright">SysBatteryRate</span></span><span class="bright"></span><span class="p"><span class="bright">(</span></span><span style="color: #aa4000">const</span> <span style="color: #aa4000">char<span class="bright"></span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">*</span></span><span class="n">cmd</span><span class="p">)<span class="bright"></span></span><span class="bright"> </span><span class="p"><span class="bright">{</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span class="bright">    </span><span style="color: #aa4000"><span class="bright">int</span></span><span class="bright"> </span><span class="n"><span class="bright">zone</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">=</span></span><span class="bright"> </span><span style="color: #601200"><span class="bright">0</span></span><span class="bright"></span><span class="p"><span class="bright">;</span></span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Braces on newline for function definitions please.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D25018#inline-142061">View Inline</a><span style="color: #4b4d51; font-weight: bold;">acpi.c:328</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);"><span style="color: #aa4000">static</span> <span style="color: #aa4000">int</span> <span style="color: #004012">getSysFileValue</span><span class="p">(</span><span style="color: #aa4000">const</span> <span style="color: #aa4000">char</span> <span style="color: #aa2211">*</span><span class="n">group</span><span class="p">,</span> <span style="color: #aa4000">int</span> <span class="n">value</span><span class="p">,</span> <span style="color: #aa4000">const</span> <span style="color: #aa4000">char</span> <span style="color: #aa2211">*</span><span class="n">file</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #aa4000">static</span> <span style="color: #aa4000">int</span> <span style="color: #004012">getSysFileValue</span><span class="p">(</span><span style="color: #aa4000">const</span> <span style="color: #aa4000">char</span> <span style="color: #aa2211">*<span class="bright"></span></span><span class="bright"></span><span class="n"><span class="bright">class</span></span><span class="bright"></span><span class="p"><span class="bright">,</span></span><span class="bright"> </span><span style="color: #aa4000"><span class="bright">const</span></span><span class="bright"> </span><span style="color: #aa4000"><span class="bright">char</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">*</span></span><span class="n">group</span><span class="p">,</span> <span style="color: #aa4000">int</span> <span class="n">value</span><span class="p">,</span> <span style="color: #aa4000">const</span> <span style="color: #aa4000">char</span> <span style="color: #aa2211">*</span><span class="n">file</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; ">    <span style="color: #aa4000">static</span> <span style="color: #aa4000">int</span> <span class="n">shownError</span> <span style="color: #aa2211">=</span> <span style="color: #601200">0</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Using <tt style="background: #ebebeb; font-size: 13px;">class</tt> as name here seems a bit dangerous to me, if this code ever gets compiled with a C++ compiler it will trip over this name. Maybe use className instead?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D25018#inline-142060">View Inline</a><span style="color: #4b4d51; font-weight: bold;">acpi.c:332</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; ">    <span style="color: #aa4000">char</span> <span class="n">input_buf</span><span class="p">[</span> <span style="color: #601200">100</span> <span class="p">];</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span class="n">snprintf</span><span class="p">(</span><span class="n">th_file</span><span class="p">,</span> <span style="color: #aa4000">sizeof</span><span class="p">(</span><span class="n">th_file</span><span class="p">),</span> <span style="color: #766510">"/sys/class/<span class="bright">thermal</span>/%s%d/%s"</span><span class="p">,</span><span class="n">group</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">file</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">snprintf</span><span class="p">(</span><span class="n">th_file</span><span class="p">,</span> <span style="color: #aa4000">sizeof</span><span class="p">(</span><span class="n">th_file</span><span class="p">),</span> <span style="color: #766510">"/sys/class/<span class="bright">%s</span>/%s%d/%s"</span><span class="p">,<span class="bright"></span></span><span class="bright"></span><span class="n"><span class="bright">class</span></span><span class="bright"></span><span class="p"><span class="bright">,</span></span><span class="bright"> </span><span class="n">group</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">file</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; ">    <span style="color: #aa4000">int</span> <span class="n">fd</span> <span style="color: #aa2211">=</span> <span class="n">open</span><span class="p">(</span><span class="n">th_file</span><span class="p">,</span> <span class="n">O_RDONLY</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Please add a space between , and class</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R106 KSysguard</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D25018">https://phabricator.kde.org/D25018</a></div></div><br /><div><strong>To: </strong>jjorge, davidedmundson, Plasma, ahiemstra<br /><strong>Cc: </strong>plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart<br /></div>