<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to capture CTRL+C in a native C&#x2F;C++ compiled application]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I have this C++ framework that compiles across Win32 and Linux on x86/ARM/MIPS.. so far so good.</p>
<p dir="auto">To be able to trap the user pressing CTRL+C I have installed following signal handlers that work fine under Linux on x86 and ARM (Raspberry) platforms.</p>
<pre><code>signal(SIGINT, sigproc);
signal(SIGQUIT, quitproc);
</code></pre>
<p dir="auto">Unfortunately these don't seem to work on OpenWRT/Omega</p>
<p dir="auto">Anybody an idea which signals I should use?</p>
<p dir="auto">thx</p>
]]></description><link>http://community.onion.io/topic/583/how-to-capture-ctrl-c-in-a-native-c-c-compiled-application</link><generator>RSS for Node</generator><lastBuildDate>Tue, 17 Mar 2026 07:05:41 GMT</lastBuildDate><atom:link href="http://community.onion.io/topic/583.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 28 Feb 2016 17:16:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to capture CTRL+C in a native C&#x2F;C++ compiled application on Sun, 28 Feb 2016 17:16:18 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I have this C++ framework that compiles across Win32 and Linux on x86/ARM/MIPS.. so far so good.</p>
<p dir="auto">To be able to trap the user pressing CTRL+C I have installed following signal handlers that work fine under Linux on x86 and ARM (Raspberry) platforms.</p>
<pre><code>signal(SIGINT, sigproc);
signal(SIGQUIT, quitproc);
</code></pre>
<p dir="auto">Unfortunately these don't seem to work on OpenWRT/Omega</p>
<p dir="auto">Anybody an idea which signals I should use?</p>
<p dir="auto">thx</p>
]]></description><link>http://community.onion.io/post/4317</link><guid isPermaLink="true">http://community.onion.io/post/4317</guid><dc:creator><![CDATA[Johan Simons]]></dc:creator><pubDate>Sun, 28 Feb 2016 17:16:18 GMT</pubDate></item><item><title><![CDATA[Reply to How to capture CTRL+C in a native C&#x2F;C++ compiled application on Sat, 05 Mar 2016 15:00:22 GMT]]></title><description><![CDATA[<p dir="auto">Seems like my framework was doing just fine... but I was using the new GPIO library from Kit Bishop !?</p>
<p dir="auto">Once I backed out this library and used the fast GPIO instead, CTRL+C worked as expected.</p>
<p dir="auto">Possibly the new GPIO library also sets a hook for CTRL+C</p>
]]></description><link>http://community.onion.io/post/4414</link><guid isPermaLink="true">http://community.onion.io/post/4414</guid><dc:creator><![CDATA[Johan Simons]]></dc:creator><pubDate>Sat, 05 Mar 2016 15:00:22 GMT</pubDate></item><item><title><![CDATA[Reply to How to capture CTRL+C in a native C&#x2F;C++ compiled application on Sat, 05 Mar 2016 18:53:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/742">@Johan-Simons</a> Sorry you are having issues with my new-gpio library <img src="http://community.onion.io/plugins/nodebb-plugin-emoji/emoji/android/1f61e.png?v=ic093v0mjao" class="not-responsive emoji emoji-android emoji--disappointed" title=":-(" alt="😞" /><br />
It is possible that it has some issues with trapping CTRL+C - I'll take a look and make any changes needed.</p>
]]></description><link>http://community.onion.io/post/4415</link><guid isPermaLink="true">http://community.onion.io/post/4415</guid><dc:creator><![CDATA[Kit Bishop]]></dc:creator><pubDate>Sat, 05 Mar 2016 18:53:44 GMT</pubDate></item><item><title><![CDATA[Reply to How to capture CTRL+C in a native C&#x2F;C++ compiled application on Sat, 05 Mar 2016 19:36:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/19">@Kit-Bishop</a> Thx for looking into it.</p>
<p dir="auto">I also noticed that my app uses 4% system memory with the fast GPIO libs... and 10% with your new GPIO lib. Guess that has to do with the usage of threads in your lib.</p>
]]></description><link>http://community.onion.io/post/4416</link><guid isPermaLink="true">http://community.onion.io/post/4416</guid><dc:creator><![CDATA[Johan Simons]]></dc:creator><pubDate>Sat, 05 Mar 2016 19:36:46 GMT</pubDate></item><item><title><![CDATA[Reply to How to capture CTRL+C in a native C&#x2F;C++ compiled application on Sun, 06 Mar 2016 00:55:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/742">@Johan-Simons</a> Probably more to do with the usage of C++ objects than the threads, though thread usage may well have some impact too.  I will look at this too in case I can reduce it.</p>
<p dir="auto">Can you let me know how you are using the new-gpio libraries?  What calls you are making etc?  This may help me diagnose what needs doing. thanks</p>
]]></description><link>http://community.onion.io/post/4431</link><guid isPermaLink="true">http://community.onion.io/post/4431</guid><dc:creator><![CDATA[Kit Bishop]]></dc:creator><pubDate>Sun, 06 Mar 2016 00:55:24 GMT</pubDate></item><item><title><![CDATA[Reply to How to capture CTRL+C in a native C&#x2F;C++ compiled application on Sun, 06 Mar 2016 02:38:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/742">@Johan-Simons</a> FYI: I have found why my new-gpio code is not trapping CTRL-C<br />
My mistake in the coding, there is a line left over from some testing I was doing that should not be in there.<br />
I am in the process of changing some of the code and the fix will be in the next release.</p>
<p dir="auto">For now, if you are building libnew-gpio from the sources I supplied, you can fix this yourself by removing the line that reads:</p>
<pre><code>      sigaddset(&amp;irqSigset, SIGINT); //	Ctrl+C
</code></pre>
<p dir="auto">from the file <strong>GPIOAccess.cpp</strong></p>
<p dir="auto">Regarding the memory usage, I think this can be attributed to the following reasons:</p>
<ul>
<li><strong>new-gpio</strong> provides significant increased functionality over <strong>fast-gpio</strong> so there is more code</li>
<li><strong>new-gpio</strong> has quite extensive error checking and returning that does not exist in <strong>fast-gpio</strong> so again more code</li>
<li><strong>new-gpio</strong> uses C++ classes rather than straight C code and this carries some overhead</li>
<li>In order to properly implement both PWM and IRQ handling some of the object instances of the classes have to hang around during the program execution</li>
<li>Both PWM and IRQ currently use an object or data structure for each pin.  At present, these are actually allocated as soon as the system is initialised.  On closer consideration, this is not actually needed until such time as PWM or IRQ is used for a pin.  So I will make a change that ensures they are only allocated when actually needed.</li>
</ul>
<p dir="auto">Finally, there may be some savings to be had by ensuring unneeded symbols are stripped from the object code.</p>
]]></description><link>http://community.onion.io/post/4432</link><guid isPermaLink="true">http://community.onion.io/post/4432</guid><dc:creator><![CDATA[Kit Bishop]]></dc:creator><pubDate>Sun, 06 Mar 2016 02:38:04 GMT</pubDate></item><item><title><![CDATA[Reply to How to capture CTRL+C in a native C&#x2F;C++ compiled application on Sun, 06 Mar 2016 04:30:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/742">@Johan-Simons</a> After a bit of extra digging and changes, I have managed to make a small reduction in the memory usage of new-gpio (stripping symbols made negligible difference, some code changes made a small difference).<br />
As far as I can see the main factors affecting the size of new-gpio vs fast-gpio are primarily:</p>
<ul>
<li>Extra code in new-gpio to handle the extra functionality</li>
<li>Memory used by additional system libraries that new-gpio code uses.</li>
</ul>
<p dir="auto">Unless this is a major issue for you, I don't think there is much more I can do.</p>
]]></description><link>http://community.onion.io/post/4433</link><guid isPermaLink="true">http://community.onion.io/post/4433</guid><dc:creator><![CDATA[Kit Bishop]]></dc:creator><pubDate>Sun, 06 Mar 2016 04:30:52 GMT</pubDate></item><item><title><![CDATA[Reply to How to capture CTRL+C in a native C&#x2F;C++ compiled application on Sun, 06 Mar 2016 11:37:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/19">@Kit-Bishop</a></p>
<p dir="auto">I was just using set pin direction and get/set pin value, so it was quite a large difference in memory usage between fast and new GPIO.</p>
<p dir="auto">But as you state, your code is more extensive and provides more functionality.</p>
<p dir="auto">For my application the extra memory is no problem as it will be the sole app running on the Onion. My eye fell on it while debugging a memory leak.</p>
<p dir="auto">Anyway, it would be great to have the CTRL+C issue fixed.</p>
<p dir="auto">Thx for the effort</p>
]]></description><link>http://community.onion.io/post/4437</link><guid isPermaLink="true">http://community.onion.io/post/4437</guid><dc:creator><![CDATA[Johan Simons]]></dc:creator><pubDate>Sun, 06 Mar 2016 11:37:37 GMT</pubDate></item><item><title><![CDATA[Reply to How to capture CTRL+C in a native C&#x2F;C++ compiled application on Sun, 06 Mar 2016 21:00:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/742">@Johan-Simons</a> All good - let me know if you find any issues.</p>
<p dir="auto">Have you managed to deal with the Ctrl-C issues using the fix I posted above?</p>
<p dir="auto">Just to assist me in diagnosing possible memory related issues, can you let me know how you are using the <strong>fast-gpio</strong> code to manipulate the pins:</p>
<ul>
<li>Are you compiling the code in <a href="https://github.com/OnionIoT/fast-gpio/blob/master/src/fastgpio.cpp" rel="nofollow">https://github.com/OnionIoT/fast-gpio/blob/master/src/fastgpio.cpp</a> and calling the methods there in?</li>
<li>Or are you running the <strong>fast-gpio</strong> program from within your program?</li>
</ul>
]]></description><link>http://community.onion.io/post/4440</link><guid isPermaLink="true">http://community.onion.io/post/4440</guid><dc:creator><![CDATA[Kit Bishop]]></dc:creator><pubDate>Sun, 06 Mar 2016 21:00:25 GMT</pubDate></item><item><title><![CDATA[Reply to How to capture CTRL+C in a native C&#x2F;C++ compiled application on Sun, 06 Mar 2016 22:21:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/19">@Kit-Bishop</a></p>
<p dir="auto">Removing the sigaddset(&amp;irqSigset, SIGINT); did NOT solve the problem of CTRL+C not working.</p>
<p dir="auto">I compile the fast-gpio sources in my own C++ app, so it is all in my executable, no libraries linked, no external apps called or processes spawned.</p>
]]></description><link>http://community.onion.io/post/4449</link><guid isPermaLink="true">http://community.onion.io/post/4449</guid><dc:creator><![CDATA[Johan Simons]]></dc:creator><pubDate>Sun, 06 Mar 2016 22:21:26 GMT</pubDate></item><item><title><![CDATA[Reply to How to capture CTRL+C in a native C&#x2F;C++ compiled application on Sun, 06 Mar 2016 22:30:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="http://community.onion.io/uid/742">@Johan-Simons</a> Thanks for the quick reply.</p>
<ul>
<li>Surprised to hear that removing the <strong>sigaddset</strong> doesn't work for you - it seems to do so for me.  I will have a closer look and get back to you as and when I find anything.</li>
<li>Thanks for the info on how you are building - this implies that the extra memory usage for <strong>new-gpio</strong> is down to the extra code functionality</li>
</ul>
]]></description><link>http://community.onion.io/post/4451</link><guid isPermaLink="true">http://community.onion.io/post/4451</guid><dc:creator><![CDATA[Kit Bishop]]></dc:creator><pubDate>Sun, 06 Mar 2016 22:30:43 GMT</pubDate></item></channel></rss>