<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4355260969616063952</id><updated>2026-06-16T16:50:19.325+04:00</updated><category term="Arduino"/><category term="Linux"/><category term="Serial port"/><category term="BlueZ"/><category term="Bluetooth"/><category term="C#"/><category term="Flightgear"/><category term="Malolo"/><category term="R/C"/><category term="Servo"/><category term="Servo motor"/><category term="airplane"/><category term="ADXL335"/><category term="ASLR"/><category term="Accelerometer"/><category term="Atmega8U2"/><category term="DFU"/><category term="Facebook"/><category term="Javascript"/><category term="PWM"/><category term="Tx/Rx"/><category term="USB"/><category term="disable ASLR"/><category term="hcidump"/><category term="protocol"/><category term="receiver"/><category term="setarch"/><category term="sort by number of mutual friends"/><category term="syscall"/><category term="transmitter"/><category term="10.10"/><category term="Chrome"/><category term="EEPROM"/><category term="Firefox"/><category term="GNU build system"/><category term="Greasemonkey"/><category term="HCI"/><category term="HobbyKing"/><category term="LUFA"/><category term="PulseIn"/><category term="Samsung; galaxy; S2; SII; codes"/><category term="Ubuntu"/><category term="VirtualBox; shared; folder; fstab; mount; sudo; linux; Oracle; vboxsf"/><category term="WireShark"/><category term="_init; _finit; gcc; shared library;"/><category term="arm"/><category term="bug"/><category term="dfu-programmer"/><category term="exe"/><category term="exploit"/><category term="find; grep; xargs"/><category term="gdb"/><category term="gdbserver"/><category term="generic"/><category term="jpg"/><category term="personality"/><category term="print0; ASCII; NUL"/><category term="ptrace"/><category term="root"/><category term="security"/><category term="setcap"/><category term="setgid"/><category term="setuid"/><category term="ssh; tunnelling; port; forwarding;"/><category term="sticky bit"/><category term="strace"/><category term="sudo"/><category term="windows"/><title type='text'>Automated Systems and The Programming</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>34</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-9149309118405689562</id><published>2016-03-22T19:58:00.002+04:00</published><updated>2016-03-22T19:58:52.929+04:00</updated><title type='text'>List of beacon manufacturers</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
There are a lot of different companies in the beacon market today.&lt;br /&gt;
Here I tried to collect some of them with their product description. &lt;br /&gt;
&lt;br /&gt;
&lt;iframe height=&quot;400&quot; src=&quot;https://docs.google.com/spreadsheets/d/1f_t7sokX96XvbIi5BoQsPh1I31_UXnQ4Lhk-0FgTKk8/pubhtml?gid=0&amp;amp;single=true&amp;amp;widget=true&amp;amp;headers=false&quot; width=&quot;650&quot;&gt;&lt;/iframe&gt;

&lt;br /&gt;
The list will be updated periodically.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/9149309118405689562/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2016/03/list-of-beacon-manufacturers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/9149309118405689562'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/9149309118405689562'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2016/03/list-of-beacon-manufacturers.html' title='List of beacon manufacturers'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-2423847657751934562</id><published>2013-01-11T23:32:00.000+04:00</published><updated>2013-01-11T23:32:28.734+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ssh; tunnelling; port; forwarding;"/><title type='text'>ssh tunneling</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
The SSH tunneling (also know as port forwarding) is ability to access computer ip ports through third computer, assuming that direct access are forbidden and we have an ssh access to the third computer which has access to that port.&lt;br /&gt;
&lt;br /&gt;
This kind of techniques can be used also to securely connect to remotes computer&#39;s only locally open ports. For example lets we have some server running on port &lt;i&gt;5432&lt;/i&gt; on &lt;i&gt;dbserver&lt;/i&gt; machine. There is no permission to connect to &lt;i&gt;dbserver:5432&lt;/i&gt; from outside, but we have an access to &lt;i&gt;dbserver&lt;/i&gt; with ssh.&lt;br /&gt;
On our local computer by running the following&lt;br /&gt;
&lt;i&gt;ssh -NC -L 1234:127.0.0.1:5432 dbserver&lt;/i&gt;&lt;br /&gt;
the ssh will listen on local machine port &lt;i&gt;1234&lt;/i&gt; and all data packets will forward to &lt;i&gt;dbserver&lt;/i&gt;, where the ssh server will redirect them to &lt;i&gt;127.0.0.1:5432&lt;/i&gt;&lt;br /&gt;
The -C&lt;i&gt; &lt;/i&gt;option is for compressing the data, and the -N option for not executing any command remotely(by default ssh executes specified command or login to the shell)&lt;br /&gt;
&lt;br /&gt;
By adding -f we can send ssh to background &lt;br /&gt;
&lt;i&gt;ssh -NC -L 1234:127.0.0.1:5432 -f dbserver&lt;/i&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/2423847657751934562/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2013/01/ssh-tunneling.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/2423847657751934562'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/2423847657751934562'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2013/01/ssh-tunneling.html' title='ssh tunneling'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-7163348031744906064</id><published>2012-05-05T16:58:00.001+04:00</published><updated>2012-05-05T16:58:57.937+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Samsung; galaxy; S2; SII; codes"/><title type='text'>Samsung Galaxy S2 codes</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Here are some codes for Samsung Galaxy S2.&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;*#1234#&amp;nbsp; -- Firmware Version.&lt;/li&gt;
&lt;li&gt;*#232337#&amp;nbsp; -- Bluetooth MAC Address.&lt;/li&gt;
&lt;li&gt;*2767*3855# -- Factory Reset. &lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/7163348031744906064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2012/05/samsung-galaxy-s2-codes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/7163348031744906064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/7163348031744906064'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2012/05/samsung-galaxy-s2-codes.html' title='Samsung Galaxy S2 codes'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-5412617530800397048</id><published>2012-04-24T21:47:00.001+04:00</published><updated>2012-04-24T21:47:31.779+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="VirtualBox; shared; folder; fstab; mount; sudo; linux; Oracle; vboxsf"/><title type='text'>VirtualBox shared folders</title><content type='html'>In the Oracle VirtualBox, to add a shared folder to a Linux guest, open Devices&amp;gt;Shared Folders...&amp;nbsp; and click Add Shared Folder (a tiny &quot;plus&quot; icon on the right). Then fill folder path and folder name.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzwLJnUfacGwKyY0AGtcTxzOKWl7ig5l1HRyu4H6u7kBzJI9gMYVhNld_wsBPngXS7i5uY9fwz4M_S5peo4bulONR2ltRu3wwXHQnXRQdni6iycxhcfjjNnyUgHaKT-cEIF8d_lWWICC4/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzwLJnUfacGwKyY0AGtcTxzOKWl7ig5l1HRyu4H6u7kBzJI9gMYVhNld_wsBPngXS7i5uY9fwz4M_S5peo4bulONR2ltRu3wwXHQnXRQdni6iycxhcfjjNnyUgHaKT-cEIF8d_lWWICC4/s1600/1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
In Linux, do the mount by the following commands:&lt;br /&gt;
&lt;i&gt;&lt;b&gt;&amp;gt; sudo mkdir /home/shared &lt;/b&gt;&lt;/i&gt;# creating mount point &lt;i&gt;&lt;b&gt;&lt;br /&gt;&amp;gt; sudo mount -t vboxsf VShared /home/shared &lt;/b&gt;&lt;/i&gt;# use previously filled folder name&lt;br /&gt;
After every reboots the mount command is needed to repeat.&lt;br /&gt;
To do it automatically, just add the following lines to &lt;b&gt;fstab&lt;/b&gt;.&lt;br /&gt;
&amp;gt; &lt;b&gt;&lt;i&gt;sudo echo &quot;VShared&amp;nbsp;&amp;nbsp;&amp;nbsp; /home/shared&amp;nbsp;&amp;nbsp;&amp;nbsp; vboxsf&amp;nbsp;&amp;nbsp;&amp;nbsp; rw &amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&quot; &amp;gt;&amp;gt; /etc/fstab&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/i&gt;</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/5412617530800397048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2012/04/virtualbox-shared-folders.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/5412617530800397048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/5412617530800397048'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2012/04/virtualbox-shared-folders.html' title='VirtualBox shared folders'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzwLJnUfacGwKyY0AGtcTxzOKWl7ig5l1HRyu4H6u7kBzJI9gMYVhNld_wsBPngXS7i5uY9fwz4M_S5peo4bulONR2ltRu3wwXHQnXRQdni6iycxhcfjjNnyUgHaKT-cEIF8d_lWWICC4/s72-c/1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-5227205704703028681</id><published>2012-04-20T18:50:00.000+04:00</published><updated>2012-04-20T18:50:15.425+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="find; grep; xargs"/><category scheme="http://www.blogger.com/atom/ns#" term="print0; ASCII; NUL"/><title type='text'>find | xargs with spaces in filenames</title><content type='html'>The following command is one of the simplest way to find a text in the files. &lt;br /&gt;
&lt;b&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; find * | xargs grep &quot;text&quot;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
but if the file name contains a space then the &lt;b&gt;&lt;i&gt;xargs &lt;/i&gt;&lt;/b&gt;command split it and transfer spited items as a separate files to the grep, and an error occurs:&lt;br /&gt;
&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; grep: &quot;a part of file name&quot;: No such file or directory&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
To overcome this issue the &lt;b&gt;&lt;i&gt;find&lt;/i&gt; &lt;/b&gt;has an &lt;i&gt;&lt;b&gt;-print0&lt;/b&gt;&lt;/i&gt; option, which separates file names with ASCII NUL instead of new line. And the &lt;i&gt;&lt;b&gt;-0&lt;/b&gt;&lt;/i&gt; option will signal the &lt;i&gt;&lt;b&gt;xargs&lt;/b&gt;&lt;/i&gt; to use NUL as a separator instead of blank spaces.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;i&gt;&lt;b&gt;find * -print0 | xargs -0 grep &quot;text&quot;&lt;/b&gt;&lt;/i&gt;</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/5227205704703028681/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2012/04/find-xargs-with-spaces-in-filenames.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/5227205704703028681'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/5227205704703028681'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2012/04/find-xargs-with-spaces-in-filenames.html' title='find | xargs with spaces in filenames'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-1331963593308101767</id><published>2012-04-03T18:41:00.002+04:00</published><updated>2012-04-03T18:41:35.321+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="arm"/><category scheme="http://www.blogger.com/atom/ns#" term="gdb"/><category scheme="http://www.blogger.com/atom/ns#" term="gdbserver"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><title type='text'>Compile gdb for embedded devices</title><content type='html'>To debug a program on embedded devices with limited resources(memory, CPU) the gdbserver is used. The gdbserver is running on the embedded device, while the gdb is running on a regular PC and connect with gdbserver via network. The first step is to compile gdb for embedded device(platform). The following steps are for platform with ARM CPU.&lt;br /&gt;
&lt;br /&gt;
Get the sources from official site: &lt;a href=&quot;http://www.gnu.org/software/gdb/download/&quot;&gt;http://www.gnu.org/software/gdb/download/&lt;/a&gt;&lt;br /&gt;
&lt;b&gt;Compile gdb &lt;/b&gt;&lt;br /&gt;
&amp;gt;&lt;i&gt;tar -zxf gdb-7.4.tar.gz&lt;/i&gt; #extract the sources&lt;br /&gt;
&amp;gt;&lt;i&gt;cd gdb-7.4&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;gt; ./configure --prefix=/home/programs/gdb/ --build=x86 --host=x86 --target=arm-linux&lt;/i&gt;&lt;br /&gt;
&lt;b&gt;&quot;--prefix&quot;&lt;/b&gt;&amp;nbsp; - where to install the program&lt;br /&gt;
&lt;b&gt;&quot;--build&quot;&lt;/b&gt; - specify which platform is used for compilation.&lt;br /&gt;
&lt;b&gt;&quot;--host&quot;&lt;/b&gt;&amp;nbsp; - specify which platform is used for run gdb. &lt;br /&gt;
&lt;b&gt;&quot;--target&quot;&lt;/b&gt; - specify which platform is used for run the debugging program.&lt;br /&gt;
&lt;i&gt;&amp;gt;make&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&amp;gt;make install&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;
&lt;b&gt;Compile gdbserver&lt;/b&gt;(the gcc compiler for arm-linux is necessary)&lt;br /&gt;
&amp;gt;&lt;i&gt;tar -zxf gdb-7.4.tar.gz&lt;/i&gt; #extract the sources into new folder&lt;br /&gt;
&lt;i&gt;&amp;gt;cd gdb/gdbserver&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&amp;gt;./configure --host=arm-linux&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&amp;gt;make&lt;/i&gt;&lt;br /&gt;
during the compilation&lt;i&gt; linux-arm-low.c:642: error: `PTRACE_GETSIGINFO&#39; undeclared (first use in this function) &lt;/i&gt;error occurs. Seems a include is missing, but by adding the following line before the error line, the problem will be solved.&lt;br /&gt;
&lt;i&gt;#define PTRACE_GETSIGINFO&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x4202&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;gt;make&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Copy the gdbserver executable from current directory to the target device and run&lt;i&gt;:&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;gt;gdbserver :&amp;lt;port&amp;gt; &amp;lt;program&amp;gt;&lt;/i&gt;&lt;br /&gt;
From the PC run gdb and connect to gdbserver vi the network:&lt;br /&gt;
&lt;i&gt;(gdb)&amp;gt;target remote ip:port&lt;/i&gt;&lt;br /&gt;
Now the program can be debuged with usual gdb commands.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/1331963593308101767/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2012/04/compile-gdb-for-embedded-devices.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/1331963593308101767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/1331963593308101767'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2012/04/compile-gdb-for-embedded-devices.html' title='Compile gdb for embedded devices'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-5051479781721155151</id><published>2012-02-07T12:38:00.000+04:00</published><updated>2012-02-07T12:38:07.084+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="_init; _finit; gcc; shared library;"/><title type='text'>_init and _fini (obsolete functions)</title><content type='html'>There are two special functions for library construction and destruction. Despite they are obsolete and replaced by generic constructor/destructor functions, they are used in a lot of libraries. Lets write a simple library with one &lt;i&gt;some_func()&lt;/i&gt; function and with &lt;i&gt;_init()&lt;/i&gt;, &lt;i&gt;_fini() &lt;/i&gt;special functions.&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/1751052.js?file=3file.c&quot;&gt;
&lt;/script&gt;In the above code there are 3 files: the library&lt;i&gt; &lt;/i&gt;itself &lt;i&gt;- samplelib.h&lt;/i&gt;, &lt;i&gt;samplelib.c&lt;/i&gt;&amp;nbsp; and the application - &lt;i&gt;main.c&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
for compiling the library: &lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $ gcc -fPIC -c samplelib.c&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $ gcc -nostartfiles -shared -o libsamplelib.so samplelib.o&lt;/i&gt;&lt;br /&gt;
Here &lt;i&gt;&lt;b&gt;-fPIC&lt;/b&gt;&lt;/i&gt; option is standing for &lt;a href=&quot;http://en.wikipedia.org/wiki/Position-independent_code&quot;&gt;position independent code&lt;/a&gt;. The &lt;i&gt;&lt;b&gt;-shared&lt;/b&gt;&lt;/i&gt; option is for shared library creation. By default gcc uses &lt;i&gt;_fini ()&lt;/i&gt; and &lt;i&gt;_init()&lt;/i&gt; defined in &lt;i&gt;crti.o&lt;/i&gt;, so &lt;b&gt;&lt;i&gt;-nostartfiles&lt;/i&gt;&lt;/b&gt; signals to gcc to not do that.&lt;br /&gt;
&amp;nbsp;And to compile the application we run the following.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; $ &lt;i&gt;gcc -o main main.c -L. -lsamplelib&lt;/i&gt;&lt;br /&gt;
Here &lt;i&gt;&lt;b&gt;-L.&lt;/b&gt;&lt;/i&gt; option informs to gcc to search libraries in current directory, and &lt;b&gt;&lt;i&gt;-lsamplelib - &lt;/i&gt;&lt;/b&gt;to use &lt;i&gt;libsamplelib.so&lt;/i&gt; shared library.&lt;br /&gt;
&lt;br /&gt;
Finally by running the program the following will be outputted:&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; samplelib: _init is called&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/i&gt;&lt;i&gt;main: main is called&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/i&gt;&lt;i&gt;samplelib: some_func is called&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/i&gt;&lt;i&gt;samplelib: _fini is called&lt;/i&gt;</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/5051479781721155151/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2012/02/init-and-fini-obsolete-functions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/5051479781721155151'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/5051479781721155151'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2012/02/init-and-fini-obsolete-functions.html' title='_init and _fini (obsolete functions)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-4520848939536835755</id><published>2011-05-07T11:22:00.000+05:00</published><updated>2011-05-07T11:22:26.661+05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Atmega8U2"/><category scheme="http://www.blogger.com/atom/ns#" term="DFU"/><category scheme="http://www.blogger.com/atom/ns#" term="dfu-programmer"/><category scheme="http://www.blogger.com/atom/ns#" term="LUFA"/><category scheme="http://www.blogger.com/atom/ns#" term="Serial port"/><category scheme="http://www.blogger.com/atom/ns#" term="USB"/><title type='text'>Arduino Uno: Upload new firmware to the Atmega8U2</title><content type='html'>&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;In &lt;a href=&quot;http://autosysprogs.blogspot.com/2011/04/arduino-uno.html&quot;&gt;the previous article&lt;/a&gt; it is described how to put Arduino Uno into DFU mode. To upload a new firmware the dfu-programmer is needed (Ubuntu&lt;i&gt; &lt;/i&gt;users:&lt;i&gt; sudo apt-get install dfu-programmer&lt;/i&gt;). Windows user can try &lt;a href=&quot;http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3886&quot;&gt;FLIP &lt;/a&gt;software from Atmel. You can upload already compiled hex code from Arduino package or build it from sources (&lt;i&gt;/usr/share/arduino/hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial-uno.hex&lt;/i&gt; or the latest one from github &lt;a href=&quot;https://github.com/arduino/Arduino/raw/master/hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial-uno.hex&quot;&gt;https://github.com/arduino/Arduino/raw/master/hardware/arduino/firmwares/arduino-usbserial/Arduino-usbserial-uno.hex&lt;/a&gt;). The steps are: &lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;Put Uno into DFU mode, &lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;i&gt;sudo dfu-programmer at90usb82 erase&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;i&gt;sudo dfu-programmer at90usb82 flash .../Arduino-usbserial-uno.hex&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;i&gt;sudo dfu-programmer at90usb82 reset&lt;/i&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;reconnect the USB cable.&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
The LUFA library is needed for building hex file from sources. Download the lib version &lt;a href=&quot;http://www.fourwalledcubicle.com/files/LUFA/LUFA-100807.zip&quot;&gt;100807&lt;/a&gt;. Current sources doesn&#39;t compile with the latest LUFA(version 101122).&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;i&gt;mkdir uno&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;i&gt;cd uno&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;i&gt;cp -r /usr/share/arduino/hardware/arduino/firmwares/arduino-usbserial ./&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;i&gt;wget http://www.fourwalledcubicle.com/files/LUFA/LUFA-100807.zip&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;i&gt;unzip LUFA-100807.zip&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;i&gt;mv LUFA\ 100807/ LUFA&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;Fix the LUFA path in&lt;i&gt; &quot;arduino-usbserial/makefile&quot;:&lt;/i&gt; &lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt; # Path to the LUFA library&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LUFA_PATH = ../..&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;change to&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;# Path to the LUFA library&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LUFA_PATH = ../LUFA&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;i&gt;make all&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;After the successful build the file &quot;&lt;i&gt;Arduino-usbserial.hex&lt;/i&gt;&quot; is created. Now you can upload this hex file using above steps.&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
P.S. After the new firmware upload try to upload and run something using Arduino IDE(the Blink example), to make sure the &quot;USB to Serial converter&quot; firmware works fine.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: inherit;&quot;&gt;That&#39;s all. &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/4520848939536835755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2011/05/arduino-uno-upload-new-firmware-to.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/4520848939536835755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/4520848939536835755'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2011/05/arduino-uno-upload-new-firmware-to.html' title='Arduino Uno: Upload new firmware to the Atmega8U2'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-2196494470555389774</id><published>2011-04-26T20:11:00.000+05:00</published><updated>2011-04-26T20:11:12.145+05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Atmega8U2"/><category scheme="http://www.blogger.com/atom/ns#" term="DFU"/><category scheme="http://www.blogger.com/atom/ns#" term="Serial port"/><category scheme="http://www.blogger.com/atom/ns#" term="USB"/><title type='text'>Arduino Uno</title><content type='html'>Arduino Uno is the latest version of the Arduino boards (next to the Duemilanove). The major difference from the previous board is in that it uses the Atmega8U2 micro-controller (instead of FTDI) for communicating with a computer. The Atmega8U2 is programmed as a USB to serial converter by default, but it can be programmed as any other USB devices (keyboard, mouse, joystick and etc...).&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwv71VNpnbfLcIjKginj7fP0BWVpNlXyFQJzdiFaAX74j5ZQBUdKvJjZKpTqDu3azuY_nl_ki-g8rIDPX_ZdwapBPHU1yc2mvG6go-ylucn0ZAT0Sn8d3w2w8yavMQioAQWEzzxwIj9ys/s1600/ArduinoUnoFront.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;476&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwv71VNpnbfLcIjKginj7fP0BWVpNlXyFQJzdiFaAX74j5ZQBUdKvJjZKpTqDu3azuY_nl_ki-g8rIDPX_ZdwapBPHU1yc2mvG6go-ylucn0ZAT0Sn8d3w2w8yavMQioAQWEzzxwIj9ys/s640/ArduinoUnoFront.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;Arduino Uno&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;To upload a new firmware to the Atmega8U2, we need to reset the chip and put it into a &lt;a href=&quot;http://wiki.openmoko.org/wiki/USB_DFU&quot;&gt;DFU&lt;/a&gt; mode. There is a description in the &lt;a href=&quot;http://arduino.cc/en/Hacking/DFUProgramming8U2&quot;&gt;Ardunio site&lt;/a&gt; how to do that. It can be done easily using 2 M/M jumper wires&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOsars4ctRXjX1Iru91SsGOL-gfOgNNqvC2S_GD__0kKKDt8w1KGlk94cHMmYPCP798EQN5mYLCFoi1cKi-LuYvkjgdU6nt7bepY9O7RIUuj28By7ugNByfOFsP5fBleYNV6jN7B8r134/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;432&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOsars4ctRXjX1Iru91SsGOL-gfOgNNqvC2S_GD__0kKKDt8w1KGlk94cHMmYPCP798EQN5mYLCFoi1cKi-LuYvkjgdU6nt7bepY9O7RIUuj28By7ugNByfOFsP5fBleYNV6jN7B8r134/s640/1.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;M/M jumper wire&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;Instead of using ground pads(from the description in Arduino site), we can use Arduino&#39;s GND pins.&lt;br /&gt;
1)Connect Arduino Uno to the computer&lt;br /&gt;
2)Hold first wire as pictured in the below image.&lt;br /&gt;
3)Connect second wire.&lt;br /&gt;
4)Remove second wire then remove first.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhJhloPEdbsHBX-4WnyIz_Hlm1MXuw5_LEevGaI0caX2YKlPDCHfggRBwFicJ-B18-CW8Qqynxnk8pp8mwJSNHJYHAOPUy8vgI8q-w3vnnSteWJlt1pooFKN1eKvANhSCadBgHZ1Cc5zw/s1600/2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;476&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhJhloPEdbsHBX-4WnyIz_Hlm1MXuw5_LEevGaI0caX2YKlPDCHfggRBwFicJ-B18-CW8Qqynxnk8pp8mwJSNHJYHAOPUy8vgI8q-w3vnnSteWJlt1pooFKN1eKvANhSCadBgHZ1Cc5zw/s640/2.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Now your Arduino is in DFU mode&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOT8rH0uJJ1Pb0NmFMAEaazOyBCYBI5RJlTJmi5v2TCjR7zYkViZrRuuSLFv2jWQvohxEhzqDwO56JrBmOM5eu6_pp75p4eYnd2g0jIDyEhCdLqLjWtfiDkuN53jhsz6hz0A2GPOqsFWo/s1600/2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;384&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOT8rH0uJJ1Pb0NmFMAEaazOyBCYBI5RJlTJmi5v2TCjR7zYkViZrRuuSLFv2jWQvohxEhzqDwO56JrBmOM5eu6_pp75p4eYnd2g0jIDyEhCdLqLjWtfiDkuN53jhsz6hz0A2GPOqsFWo/s640/2.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;The Device manager (in windows 7)&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;To return to the USB to serial converter mode, just disconnect and connect Arduino.&lt;br /&gt;
The upload of a firmware will be in the next article.</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/2196494470555389774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2011/04/arduino-uno.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/2196494470555389774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/2196494470555389774'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2011/04/arduino-uno.html' title='Arduino Uno'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwv71VNpnbfLcIjKginj7fP0BWVpNlXyFQJzdiFaAX74j5ZQBUdKvJjZKpTqDu3azuY_nl_ki-g8rIDPX_ZdwapBPHU1yc2mvG6go-ylucn0ZAT0Sn8d3w2w8yavMQioAQWEzzxwIj9ys/s72-c/ArduinoUnoFront.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-344340756337213075</id><published>2011-04-25T17:28:00.000+05:00</published><updated>2011-04-25T17:28:22.424+05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Chrome"/><category scheme="http://www.blogger.com/atom/ns#" term="Facebook"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="sort by number of mutual friends"/><title type='text'>Facebook: Sort people by number of mutual friends(with Chrome support).</title><content type='html'>The script from &lt;a href=&quot;http://autosysprogs.blogspot.com/2011/04/facebook-sort-people-by-number-of.html&quot;&gt;the previous article &lt;/a&gt;can be used in Chrome also. Just click on the &lt;b&gt;view raw &lt;/b&gt;and then click &lt;b&gt;continue&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzfpBnN-REV-9GukIOjmIQ4xcuBJh3_hT2niTrRQhNIFePR4LNq6S35aj-xkjvT5kOPzsvOCYpJRSFIpXp_usqcMfLY1MkyouumPmdSUp16_p-A0VXsix4Q_APE4-_LzZRyM9D8BoMXFk/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;304&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzfpBnN-REV-9GukIOjmIQ4xcuBJh3_hT2niTrRQhNIFePR4LNq6S35aj-xkjvT5kOPzsvOCYpJRSFIpXp_usqcMfLY1MkyouumPmdSUp16_p-A0VXsix4Q_APE4-_LzZRyM9D8BoMXFk/s640/1.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Now install the script as an extension:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8QSxk9FHu-IapmRjKYXQ8UVUG1vtNMjCzBL6dTa-uiWUTFBDFNyP74P_P4ut4js9oAqccwDE3OLSlfqbtw1__OYwt0j_BGVWbJ-0NPaG-XRNSey9KLmDLTt1kxP1U3GtBKiqPL6kCIwE/s1600/2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8QSxk9FHu-IapmRjKYXQ8UVUG1vtNMjCzBL6dTa-uiWUTFBDFNyP74P_P4ut4js9oAqccwDE3OLSlfqbtw1__OYwt0j_BGVWbJ-0NPaG-XRNSey9KLmDLTt1kxP1U3GtBKiqPL6kCIwE/s1600/2.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Now go to &lt;b&gt;Facaebook&lt;/b&gt;-&amp;gt;&lt;b&gt;Find Friends&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQ_GN47hJWgmF9WHxrE3lDQCnQI00RaELMj5KQc_6qIQECqMHVf4bg6KbuODOaXkN6N8Sp6pfNvrKSTgWk886UvGgjJnMArfPc5p8PPnR4Xrx60xHlOkx2lsep8eJ9rAFVc6SUIwgQBg8/s1600/3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQ_GN47hJWgmF9WHxrE3lDQCnQI00RaELMj5KQc_6qIQECqMHVf4bg6KbuODOaXkN6N8Sp6pfNvrKSTgWk886UvGgjJnMArfPc5p8PPnR4Xrx60xHlOkx2lsep8eJ9rAFVc6SUIwgQBg8/s1600/3.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;If the button doesn&#39;t appear, then refresh the page by pressing F5 (The script has an issue and sometimes the button isn&#39;t added, the temporary solution is refreshing the page until the problem will be fixed).&lt;br /&gt;
That&#39;s all.</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/344340756337213075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2011/04/facebook-sort-people-by-number-of_25.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/344340756337213075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/344340756337213075'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2011/04/facebook-sort-people-by-number-of_25.html' title='Facebook: Sort people by number of mutual friends(with Chrome support).'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzfpBnN-REV-9GukIOjmIQ4xcuBJh3_hT2niTrRQhNIFePR4LNq6S35aj-xkjvT5kOPzsvOCYpJRSFIpXp_usqcMfLY1MkyouumPmdSUp16_p-A0VXsix4Q_APE4-_LzZRyM9D8BoMXFk/s72-c/1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-276539551450995257</id><published>2011-04-25T13:17:00.000+05:00</published><updated>2011-04-25T13:17:45.086+05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="airplane"/><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Flightgear"/><category scheme="http://www.blogger.com/atom/ns#" term="Malolo"/><category scheme="http://www.blogger.com/atom/ns#" term="protocol"/><category scheme="http://www.blogger.com/atom/ns#" term="R/C"/><category scheme="http://www.blogger.com/atom/ns#" term="receiver"/><category scheme="http://www.blogger.com/atom/ns#" term="transmitter"/><category scheme="http://www.blogger.com/atom/ns#" term="Tx/Rx"/><title type='text'>Flightgear and Tx/Rx system</title><content type='html'>In the &lt;a href=&quot;http://autosysprogs.blogspot.com/2011/04/flightgear-control-aircraft-externally.html&quot;&gt;previous article&lt;/a&gt; the Flightgear&#39;s aircraft controlled using external program and in &lt;a href=&quot;http://autosysprogs.blogspot.com/2011/04/arduino-and-txrx-system.html&quot;&gt;another article&lt;/a&gt; the Tx/Rx system connected to computer using Arduino. Today we will use those knowledges to connect Tx/Rx to Flightgear. Download the project from &lt;a href=&quot;https://github.com/MKo/FlightGear.ArdControl&quot;&gt;github&lt;/a&gt; and do the following steps.&lt;br /&gt;
1)Copy protocol files from &lt;i&gt;Protocol/&lt;/i&gt; to &lt;i&gt;C:\Program Files (x86)\FlightGear\data\Protocol\&lt;/i&gt;&lt;br /&gt;
2)Compile and upload &lt;i&gt;Rxreader/Rxreader.pde&lt;/i&gt; to the Arduino.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRouBdJN2Kip1o805u0pYwr2One2Fh6IoMnr-_yiwo38sl5e7LkYA3b3jArES0zrk6SlpFiOpwO0y1JFajRRMwi4u9ddSLX3TwV-YylqIuBVSZerMml2x_1QQRth4tJBMqQNL3wlofAFQ/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRouBdJN2Kip1o805u0pYwr2One2Fh6IoMnr-_yiwo38sl5e7LkYA3b3jArES0zrk6SlpFiOpwO0y1JFajRRMwi4u9ddSLX3TwV-YylqIuBVSZerMml2x_1QQRth4tJBMqQNL3wlofAFQ/s1600/1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;3)Connect Receiver to the Arduino&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirdOPDnjaOjGiz3-naJLNp3ciGwLJoYZ3437sK-SApq8RQzguOhRJ7Xz3Phskzvi4CGBpUIFskIINEhUmZdfpnCbX2NfeAlOsTBwNIwXa2AF9qAFQrJJF0SUeRysfMQa9J_QX6SsEpkz8/s1600/Image089.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirdOPDnjaOjGiz3-naJLNp3ciGwLJoYZ3437sK-SApq8RQzguOhRJ7Xz3Phskzvi4CGBpUIFskIINEhUmZdfpnCbX2NfeAlOsTBwNIwXa2AF9qAFQrJJF0SUeRysfMQa9J_QX6SsEpkz8/s400/Image089.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;4)Run the C# program and connect to the Arduino and click to calibrate (this determines min-max values). When min-max values determined, finish the calibration. &lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTmodq96zQpw4EZFNaXsc_SYOlE0vKuWyhXGnGN6juE7ABbz6gdPlcbY39OJr0SsR_HnAQaTAsFV-Ha4Wa3nZzeivuGQzUEghy4yBXiZjWRHKn_vzTdkn0CMENYre6bDtSIdz_iO-uxxU/s1600/2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;299&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTmodq96zQpw4EZFNaXsc_SYOlE0vKuWyhXGnGN6juE7ABbz6gdPlcbY39OJr0SsR_HnAQaTAsFV-Ha4Wa3nZzeivuGQzUEghy4yBXiZjWRHKn_vzTdkn0CMENYre6bDtSIdz_iO-uxxU/s400/2.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;5)Run Flightgear with the following arguments.&lt;br /&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;div class=&quot;line&quot; id=&quot;LC1&quot;&gt;&lt;span class=&quot;s2&quot;&gt;&quot;C:\Program Files (x86)\FlightGear\bin\Win32\fgfs&quot;&lt;/span&gt; ^&lt;/div&gt;&lt;div class=&quot;line&quot; id=&quot;LC2&quot;&gt;&amp;nbsp;&lt;span class=&quot;s2&quot;&gt;&quot;--fg-root=C:\Program Files (x86)\FlightGear\data&quot;&lt;/span&gt; ^&lt;/div&gt;&lt;div class=&quot;line&quot; id=&quot;LC3&quot;&gt;&amp;nbsp;&lt;span class=&quot;s2&quot;&gt;&quot;--aircraft=Malolo1&quot;&lt;/span&gt; ^&lt;/div&gt;&lt;div class=&quot;line&quot; id=&quot;LC4&quot;&gt;&amp;nbsp;&lt;span class=&quot;s2&quot;&gt;&quot;--generic=socket,out,10,127.0.0.1,49001,udp,outputprotocol&quot;&lt;/span&gt; ^&lt;/div&gt;&lt;div class=&quot;line&quot; id=&quot;LC5&quot;&gt;&amp;nbsp;&lt;span class=&quot;s2&quot;&gt;&quot;--generic=socket,in,10,,49000,udp,inputprotocol&quot;&lt;/span&gt; ^&lt;/div&gt;&lt;div class=&quot;line&quot; id=&quot;LC7&quot;&gt;&amp;nbsp;&lt;span class=&quot;s2&quot;&gt;&quot;--timeofday=noon&quot;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;line&quot; id=&quot;LC8&quot;&gt;
&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;6) Connect to Arduino, and connect the input and the output to Flightgear.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIGCY5rbIufR4xy-3Yggw50Hlgzf5W0pJ5jDzf88tACLrzfR0bqXgn0XU-Ojd_dGFWqqcbNLJYas1VZtlqFyKxPPjwDMrrVciOztDxLTsEuolW-Eb0L42gbBnBbOeuUjUcm-wMaN1FMgQ/s1600/3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;298&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIGCY5rbIufR4xy-3Yggw50Hlgzf5W0pJ5jDzf88tACLrzfR0bqXgn0XU-Ojd_dGFWqqcbNLJYas1VZtlqFyKxPPjwDMrrVciOztDxLTsEuolW-Eb0L42gbBnBbOeuUjUcm-wMaN1FMgQ/s400/3.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&amp;nbsp;&lt;/div&gt;7)Try do not crash the airplane :) &lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3swv4C7gpHJcrL3yxMfZTZDET9krVqfVmkBTFSJHMLUh3QcAwSKYsgdWaX6RCCdvx1TltcxrJV2wTx7Ox1CX5wqAzxfatDWAQNXA1c8dqujIWjJ_tIzixgupmUBDa0K4yCCi_y92sMsQ/s1600/4.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;499&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3swv4C7gpHJcrL3yxMfZTZDET9krVqfVmkBTFSJHMLUh3QcAwSKYsgdWaX6RCCdvx1TltcxrJV2wTx7Ox1CX5wqAzxfatDWAQNXA1c8dqujIWjJ_tIzixgupmUBDa0K4yCCi_y92sMsQ/s640/4.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;That&#39;s all.</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/276539551450995257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2011/04/flightgear-and-txrx-system.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/276539551450995257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/276539551450995257'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2011/04/flightgear-and-txrx-system.html' title='Flightgear and Tx/Rx system'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRouBdJN2Kip1o805u0pYwr2One2Fh6IoMnr-_yiwo38sl5e7LkYA3b3jArES0zrk6SlpFiOpwO0y1JFajRRMwi4u9ddSLX3TwV-YylqIuBVSZerMml2x_1QQRth4tJBMqQNL3wlofAFQ/s72-c/1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-1538349463113545467</id><published>2011-04-20T16:50:00.000+05:00</published><updated>2011-04-20T16:50:53.523+05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="exe"/><category scheme="http://www.blogger.com/atom/ns#" term="jpg"/><category scheme="http://www.blogger.com/atom/ns#" term="windows"/><title type='text'>executable jpg files</title><content type='html'>On the following screenshot there are 3 files with the same thumbnail picture. The file extensions aren&#39;t hided. Now can you guess the formats of those files? &lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivKYUaihkuFoH8f2C64em90cN1o_jf6rhOPHVqfJr6QiW6cQgLCxzar6C8s6yHU0aMBdvwNzfl-7jLz9H3WsdzOvseS6K8ygI4NNmAxwLPqVVT7OPy_AKKvkr4fB_x4IBOSGnIx9aar5M/s1600/Untitled.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;414&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivKYUaihkuFoH8f2C64em90cN1o_jf6rhOPHVqfJr6QiW6cQgLCxzar6C8s6yHU0aMBdvwNzfl-7jLz9H3WsdzOvseS6K8ygI4NNmAxwLPqVVT7OPy_AKKvkr4fB_x4IBOSGnIx9aar5M/s640/Untitled.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
The first and the second files are executable, while the third file is an icon file. But, you can say, the file with &quot;&lt;i&gt;jpg&lt;/i&gt;&quot; extension is a picture not an executable. It is true. But the problem is that the extension of &quot;&lt;i&gt;imggoofyrcs.jpg&lt;/i&gt;&quot; isn&#39;t &quot;&lt;i&gt;jpg&lt;/i&gt;&quot;. How is it possible? The cause of this is the Unicode symbol \u202E(Right-To-Left Override):&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/kEsOszCwv48?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;The executable can open a picture to deceive a user and do anything in the background. The following code demonstrate how to open a picture and run a &quot;calc&quot; program. &lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/931057.js?file=Program.cs&quot;&gt;
&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/1538349463113545467/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2011/04/executable-jpg-files.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/1538349463113545467'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/1538349463113545467'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2011/04/executable-jpg-files.html' title='executable jpg files'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivKYUaihkuFoH8f2C64em90cN1o_jf6rhOPHVqfJr6QiW6cQgLCxzar6C8s6yHU0aMBdvwNzfl-7jLz9H3WsdzOvseS6K8ygI4NNmAxwLPqVVT7OPy_AKKvkr4fB_x4IBOSGnIx9aar5M/s72-c/Untitled.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-5719014945356140979</id><published>2011-04-16T17:49:00.000+05:00</published><updated>2011-04-16T17:49:49.842+05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Facebook"/><category scheme="http://www.blogger.com/atom/ns#" term="Firefox"/><category scheme="http://www.blogger.com/atom/ns#" term="Greasemonkey"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="sort by number of mutual friends"/><title type='text'>Facebook: Sort people by number of mutual friends</title><content type='html'>The&amp;nbsp;Facebook&#39;s Find-Friends&amp;nbsp;page lists people, whom Facebook thinks we may know. There are some ways to filter people by hometown or college (and etc...), but it lacks the simple ability to sort people by the number of mutual friends. Using &lt;a href=&quot;http://www.mozilla.com/en-US/firefox/new/&quot;&gt;Firefox&lt;/a&gt; and &lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/&quot;&gt;Greasemonkey add-on&lt;/a&gt;&amp;nbsp;and the following script it can be done easily.&lt;br /&gt;
Add new user script in the Greasemonkey:&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-Rb_VwcYtk39576nM_lptMcbom4dghyphenhyphenR2LrfWXTIGp1pDiFrEAsP_xfbbkBhWJkAtUTCCwAgvFFQwhQBI5jOKCIAm5AScpVXBTMtnOMr2ONLjNefvB75YSROnrqtQqRaAkdA0tLGBdkE/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-Rb_VwcYtk39576nM_lptMcbom4dghyphenhyphenR2LrfWXTIGp1pDiFrEAsP_xfbbkBhWJkAtUTCCwAgvFFQwhQBI5jOKCIAm5AScpVXBTMtnOMr2ONLjNefvB75YSROnrqtQqRaAkdA0tLGBdkE/s1600/1.png&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Add new user script.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;Fill up the following information:&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCMMpaBtkxaqwr31we6QVom5P2Y498ElNs_-5asibPK6SXXijph6oZ8W2KaxPuDtskEm0YVtCt7Y6BINFAhyX1kaBlT8rUJ2WFCg8tTtKJEuH0WogTmvfF4IMIbitwkP0b6w9WRp4eXCk/s1600/2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCMMpaBtkxaqwr31we6QVom5P2Y498ElNs_-5asibPK6SXXijph6oZ8W2KaxPuDtskEm0YVtCt7Y6BINFAhyX1kaBlT8rUJ2WFCg8tTtKJEuH0WogTmvfF4IMIbitwkP0b6w9WRp4eXCk/s320/2.png&quot; width=&quot;306&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Fill-up.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;Then copy the following script and past it to the newly opened &lt;i&gt;sortby.user.js&lt;/i&gt; file and save it.&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/923077.js?file=sortby.user.js&quot;&gt;
&lt;/script&gt;&lt;br /&gt;
In the Facebook&#39;s Find Friends page now you can see a button near the hometown filter.&lt;br /&gt;
Click it and it will sort people by number of mutual friends.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJo6QxihU-8DfjJSfV20W7238O9f-kyx1M45EbYJhdwIh-uoTxs7dhXzVatkabAcO5pP8q0lfJ4t2HQ1a0Z9T0uznSafN7E5hctopuXR9i6xMVRu_E-e_4yYpJnynd3i6x_yF4whmNnNc/s1600/3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;459&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJo6QxihU-8DfjJSfV20W7238O9f-kyx1M45EbYJhdwIh-uoTxs7dhXzVatkabAcO5pP8q0lfJ4t2HQ1a0Z9T0uznSafN7E5hctopuXR9i6xMVRu_E-e_4yYpJnynd3i6x_yF4whmNnNc/s640/3.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
That&#39;s all.</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/5719014945356140979/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2011/04/facebook-sort-people-by-number-of.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/5719014945356140979'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/5719014945356140979'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2011/04/facebook-sort-people-by-number-of.html' title='Facebook: Sort people by number of mutual friends'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-Rb_VwcYtk39576nM_lptMcbom4dghyphenhyphenR2LrfWXTIGp1pDiFrEAsP_xfbbkBhWJkAtUTCCwAgvFFQwhQBI5jOKCIAm5AScpVXBTMtnOMr2ONLjNefvB75YSROnrqtQqRaAkdA0tLGBdkE/s72-c/1.png" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-6278502931622562789</id><published>2011-04-12T19:40:00.000+05:00</published><updated>2011-04-12T19:40:28.995+05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="HobbyKing"/><category scheme="http://www.blogger.com/atom/ns#" term="PulseIn"/><category scheme="http://www.blogger.com/atom/ns#" term="PWM"/><category scheme="http://www.blogger.com/atom/ns#" term="receiver"/><category scheme="http://www.blogger.com/atom/ns#" term="Servo"/><category scheme="http://www.blogger.com/atom/ns#" term="Servo motor"/><category scheme="http://www.blogger.com/atom/ns#" term="transmitter"/><category scheme="http://www.blogger.com/atom/ns#" term="Tx/Rx"/><title type='text'>Arduino and Tx/Rx system</title><content type='html'>&lt;a href=&quot;http://autosysprogs.blogspot.com/2011/04/servo-motors-and-pwm.html&quot;&gt;In the previous article&lt;/a&gt; the PWM signal was described, which used to control servo motors. Today we will use the following Transmitter/Receiver (Tx/Rx) and the Arduino to read PWM signals.&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUS9_25d0fRoowkGQfXqP160yEFkjGwzfQ8gAUX9R32pn5Wyi7-qAanyUc3ZlZ9yOQCECH5Xgnt4prz1cpKWiySWn08LMofOhRpezJvDHaqvCoSYxz97z8ka6RW3v3wD5HFeCPPfuBxqA/s1600/HK-T6XV2-M1%25282%2529.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUS9_25d0fRoowkGQfXqP160yEFkjGwzfQ8gAUX9R32pn5Wyi7-qAanyUc3ZlZ9yOQCECH5Xgnt4prz1cpKWiySWn08LMofOhRpezJvDHaqvCoSYxz97z8ka6RW3v3wD5HFeCPPfuBxqA/s1600/HK-T6XV2-M1%25282%2529.jpg&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Tx/Rx manufactured by &lt;a href=&quot;http://www.hobbyking.com/&quot;&gt;www.HobbyKing.com&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;The above Tx/Rx systems usually used for controlling airplanes, helicopters and other remote vehicles. This one has 6 channel, which means it can control 6 different motors (servos and other types).&lt;br /&gt;
In the following picture you can see 7 row of pins(6 channels + battery).&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSZE0Hl4CxUAm-lz3VBUgVYv9iiBQJ9Vq-drZ3ZAAe_uOT3J16X9UWooCIFCKyjnBY_Ue8iip3PsMjqCC_3WOi3FNT0qxdS3gH2NXwYqOP5IH_b0zw4ncCXG_9t46KMRR41nLKPjmuYyA/s1600/HK-T6XV2-M1-1%25282%2529.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSZE0Hl4CxUAm-lz3VBUgVYv9iiBQJ9Vq-drZ3ZAAe_uOT3J16X9UWooCIFCKyjnBY_Ue8iip3PsMjqCC_3WOi3FNT0qxdS3gH2NXwYqOP5IH_b0zw4ncCXG_9t46KMRR41nLKPjmuYyA/s1600/HK-T6XV2-M1-1%25282%2529.jpg&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Receiver&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;This Tx/Rx system comes without any documentation, so the only way to get more information is to google the Internet. Actually I thought that the receiver gets it&#39;s power from the battery pins(I don&#39;t know why 3 pins) and generate appropriate PWM signals on all channels, but I discover the following:&lt;br /&gt;
If connect only(without battery connected) channel pins to appropriate Arduino pins(+5V to +5V, Gnd to Gnd, and Signal to digital port 2), then the receiver will work and on the signal pin it generates PWM signal, coming from transmitter. To read the signal, connect 2nd channel pins to Arduino appropriate pins(The 2nd channel corresponds to throttle). Connect signal pin to Arduino digital pin 2.&lt;br /&gt;
&lt;br /&gt;
The Arduino has a &lt;a href=&quot;http://www.arduino.cc/en/Reference/PulseIn&quot;&gt;PulseIn&lt;/a&gt; function, which can be used to read the PWM pulse width. The &lt;a href=&quot;http://www.arduino.cc/en/Reference/Micros&quot;&gt;micros&lt;/a&gt; function returns the number of microseconds since the Arduino began running. Compile and upload the following code and run it then switch-on the transmitter.&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/915557.js?file=rxreader.pde&quot;&gt;
&lt;/script&gt;Before switching on the transmitter, the time interval is about 100ms, which is equal to 50ms timeout time + Serial print times, and the pulse width is 0(no signal). When the transmitter switched-on, the pulse width is near to 1460us and time interval reduced to ~66ms, which now is equal to ~20ms period time + Serial print times.&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDJ6-8Z_aCyHek3wWnwvtOmt6AYCltCPAq3y8EU8-bJFQhsb_9KGRzJttckr1Y4e_47QdOvth8Z423mJVgiL60xJUq0YWw-YR3TUYbK2wEfNiuqMKubxl6A4BmfSkXa_66m0OePPrc-aM/s1600/Untitled.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDJ6-8Z_aCyHek3wWnwvtOmt6AYCltCPAq3y8EU8-bJFQhsb_9KGRzJttckr1Y4e_47QdOvth8Z423mJVgiL60xJUq0YWw-YR3TUYbK2wEfNiuqMKubxl6A4BmfSkXa_66m0OePPrc-aM/s1600/Untitled.png&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Switching-on transmitter&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;And this is the screenshot of Serial output when the throttle is changed by moving joystick up and down.&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixEJfsTI7lmi8XF7elUlda9s8cSr_F_Q2Wjko7LLFW-B91GOQMtkiXoPg1ybZTUVtZiXQprQxnUrcz4x0ygG6EAL2ju0Sn2IVeYndlLYl4BJl9WY4vVjZJzevbiWGL-TOjy0_OiWZI-JU/s1600/2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixEJfsTI7lmi8XF7elUlda9s8cSr_F_Q2Wjko7LLFW-B91GOQMtkiXoPg1ybZTUVtZiXQprQxnUrcz4x0ygG6EAL2ju0Sn2IVeYndlLYl4BJl9WY4vVjZJzevbiWGL-TOjy0_OiWZI-JU/s1600/2.png&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Moving throttle joystick up/down&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;That&#39;s all.</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/6278502931622562789/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2011/04/arduino-and-txrx-system.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/6278502931622562789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/6278502931622562789'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2011/04/arduino-and-txrx-system.html' title='Arduino and Tx/Rx system'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUS9_25d0fRoowkGQfXqP160yEFkjGwzfQ8gAUX9R32pn5Wyi7-qAanyUc3ZlZ9yOQCECH5Xgnt4prz1cpKWiySWn08LMofOhRpezJvDHaqvCoSYxz97z8ka6RW3v3wD5HFeCPPfuBxqA/s72-c/HK-T6XV2-M1%25282%2529.jpg" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-2628811717135184057</id><published>2011-04-11T20:17:00.000+05:00</published><updated>2011-04-11T20:17:28.334+05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="PWM"/><category scheme="http://www.blogger.com/atom/ns#" term="Servo"/><category scheme="http://www.blogger.com/atom/ns#" term="Servo motor"/><title type='text'>Servo motors and PWM</title><content type='html'>In &lt;a href=&quot;http://autosysprogs.blogspot.com/2011/03/arduino-and-servo-motors.html&quot;&gt;the previous article&lt;/a&gt; we use Arduino&#39;s &lt;i&gt;Servo&lt;/i&gt; library to control servo motors. Today we will try to understand how Servo library works. The &lt;a href=&quot;http://en.wikipedia.org/wiki/Servomechanism&quot;&gt;servo motors&lt;/a&gt; are controlled by digital &lt;a href=&quot;http://en.wikipedia.org/wiki/Pulse-width_modulation&quot;&gt;PWM &lt;/a&gt;signals. Those signals are square waves with a period about 20-22ms. And the pulse width(usually ~0.5-2.5ms) is corresponds to the position of servo motor.&lt;br /&gt;
This a sample signal&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9Ft3GYDSpVIxdPEqdlDNfFhzS-wrncZnaTa4VnNoNRBdd-v7DBf_Qm0uTzqMVKN0Xl7cBUxSW2Wo98nIrh3O-UUYSBQNA_BCm0Hl74A-0dG367pjdR3w91ioKb5ORt0TRbDCXuTxQcXs/s1600/123.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;246&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9Ft3GYDSpVIxdPEqdlDNfFhzS-wrncZnaTa4VnNoNRBdd-v7DBf_Qm0uTzqMVKN0Xl7cBUxSW2Wo98nIrh3O-UUYSBQNA_BCm0Hl74A-0dG367pjdR3w91ioKb5ORt0TRbDCXuTxQcXs/s320/123.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;There is another overloaded Servo.attach function (used to attach servo to the pin) with 3 arguments:&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;&lt;i&gt;&lt;em&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; servo&lt;/em&gt;.attach(pin, min, max)&amp;nbsp; &lt;/i&gt;&lt;/div&gt;(min,max) are the pulse minimum and maximum widths in microseconds. Default values are &lt;a href=&quot;http://arduino.cc/en/Reference/ServoAttach&quot;&gt;544us and 2400us&lt;/a&gt;(you can also check them in the &amp;lt;Arduino-dir&amp;gt;\libraries\Servo\Servo.h file, MIN_PULSE_WIDTH and MAX_PULSE_WIDTH macros). Most of hobby servo motors have those default values, but if your servo doesn&#39;t work, then you need to dig into the documentation to find out right values. This Servo library takes minimum 20ms for signal period: see &amp;lt;Arduino-dir&amp;gt;\libraries\Servo\Servo.h file:&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #define REFRESH_INTERVAL&amp;nbsp;&amp;nbsp;&amp;nbsp; 20000 // minumim time to refresh servos in microseconds&lt;/i&gt; &lt;br /&gt;
That&#39;s all.</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/2628811717135184057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2011/04/servo-motors-and-pwm.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/2628811717135184057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/2628811717135184057'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2011/04/servo-motors-and-pwm.html' title='Servo motors and PWM'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9Ft3GYDSpVIxdPEqdlDNfFhzS-wrncZnaTa4VnNoNRBdd-v7DBf_Qm0uTzqMVKN0Xl7cBUxSW2Wo98nIrh3O-UUYSBQNA_BCm0Hl74A-0dG367pjdR3w91ioKb5ORt0TRbDCXuTxQcXs/s72-c/123.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-1470939131938700198</id><published>2011-04-06T20:14:00.000+05:00</published><updated>2011-04-06T20:14:40.040+05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="airplane"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="Flightgear"/><category scheme="http://www.blogger.com/atom/ns#" term="generic"/><category scheme="http://www.blogger.com/atom/ns#" term="Malolo"/><category scheme="http://www.blogger.com/atom/ns#" term="protocol"/><category scheme="http://www.blogger.com/atom/ns#" term="R/C"/><title type='text'>Flightgear: control aircraft externally</title><content type='html'>In &lt;a href=&quot;http://autosysprogs.blogspot.com/2011/04/flightgear.html&quot;&gt;the previous article&lt;/a&gt; the Flightgear program&#39;s some features were discussed. Today&#39;s topic will be about controlling aircraft through sockets from another program. There is a command line option &quot;--generic&quot; , which can be used for modifying items of property tree(see &lt;a href=&quot;http://autosysprogs.blogspot.com/2011/04/flightgear.html&quot;&gt;previous article&lt;/a&gt;, about &lt;a href=&quot;http://localhost:1234/&quot;&gt;http://localhost:1234&lt;/a&gt;).&lt;br /&gt;
Run the program with the following options. &lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/905725.js?file=run.bat&quot;&gt;
&lt;/script&gt;The first generic argument means: Use sockets, for sending data out, 10 times a second, to the 127.0.0.1 machine(this is localhost&#39;s ip address), using the port 49001, use UDP protocol, the actual data which sent out are described in file &quot;outputprotocol&quot;.&lt;br /&gt;
The second generic argument means: Use sockets again, for getting data from out, 10 times a second, skip the ip address, using the port 49000, use UDP protocol again, the coming data described in the file &quot;inputprotocol&quot;.&lt;br /&gt;
If the program hangs, this means you are using the Flightgear version 2.0.0, which has a known bug and you need to downgrade to &lt;a href=&quot;http://ftp.igh.cnrs.fr/pub/flightgear/ftp/Win32/fgsetup-1.9.1b.exe&quot;&gt;the version 1.9.1&lt;/a&gt;. Now if the hanging is over, then the program must give an error(see console&#39;s screen), because &quot;outputprotocol&quot; and &quot;inputprotocol&quot; files doesn&#39;t exists.&lt;br /&gt;
The following is &quot;inputprotocol.xml&quot; file&#39;s content, which describes 3 values, that the program will wait for input(aileron, elevator and throttle).&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/905752.js?file=inputprotocol.xml&quot;&gt;
&lt;/script&gt;The following is &quot;outputtprotocol.xml&quot; file&#39;s content,which describes the same 3 values from input and plus one more (the speed of aircraft).&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/905756.js?file=outputprotocol.xml&quot;&gt;
&lt;/script&gt;Now copy those files to the &quot;C:\Program Files (x86)\FlightGear\data\Protocol&quot; directory and run the program again. It will again give error(&lt;i&gt;Error reading data&lt;/i&gt;), because no one send data to the input.&lt;br /&gt;
Now lets write a program in C#, which will send the input data to and receive output data from Flightgear. Add the controls to the main form as pictured in the screenshot:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl8GHs0wQP8kglf078ovgGnasMNqn0Ug_STwZ1-9K_t-uXWcd_a_I6k6MeXYDuip8u4Ntr4g0lDzPcCwd7nR0cWGaOPpgiubfY9up8dnBPjCL7GgAJwa1S2Qx26vkjMbx6NAsq-V-_Rh8/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl8GHs0wQP8kglf078ovgGnasMNqn0Ug_STwZ1-9K_t-uXWcd_a_I6k6MeXYDuip8u4Ntr4g0lDzPcCwd7nR0cWGaOPpgiubfY9up8dnBPjCL7GgAJwa1S2Qx26vkjMbx6NAsq-V-_Rh8/s1600/1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;We will use timer to send data in every 100ms(10 times in a second as described in the argument). This is sending part code:&amp;nbsp;&lt;script src=&quot;https://gist.github.com/905793.js?file=send.cs&quot;&gt;
&lt;/script&gt;We will use threads to asynchronously get data from Flightgear. This is it:&lt;script src=&quot;https://gist.github.com/905796.js?file=receive.cs&quot;&gt;
&lt;/script&gt;That&#39;s all.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizJt7Ig01qs2ueLFKhQmmJcP3C5HyripdXt3lFcmUVPfm0Vmoww40diGPueztpGxFDmC7-n6f90IhdVkVw1o7YE7yQ1HWF15rPes3h413CzpvaIxcHJr25n2VnO7Or7y-x5q7yaac22yk/s1600/2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;250&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizJt7Ig01qs2ueLFKhQmmJcP3C5HyripdXt3lFcmUVPfm0Vmoww40diGPueztpGxFDmC7-n6f90IhdVkVw1o7YE7yQ1HWF15rPes3h413CzpvaIxcHJr25n2VnO7Or7y-x5q7yaac22yk/s400/2.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/1470939131938700198/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2011/04/flightgear-control-aircraft-externally.html#comment-form' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/1470939131938700198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/1470939131938700198'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2011/04/flightgear-control-aircraft-externally.html' title='Flightgear: control aircraft externally'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl8GHs0wQP8kglf078ovgGnasMNqn0Ug_STwZ1-9K_t-uXWcd_a_I6k6MeXYDuip8u4Ntr4g0lDzPcCwd7nR0cWGaOPpgiubfY9up8dnBPjCL7GgAJwa1S2Qx26vkjMbx6NAsq-V-_Rh8/s72-c/1.png" height="72" width="72"/><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-3665831792502612613</id><published>2011-04-05T20:37:00.000+05:00</published><updated>2011-04-05T20:37:18.904+05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="airplane"/><category scheme="http://www.blogger.com/atom/ns#" term="Flightgear"/><category scheme="http://www.blogger.com/atom/ns#" term="Malolo"/><category scheme="http://www.blogger.com/atom/ns#" term="R/C"/><title type='text'>Flightgear</title><content type='html'>&lt;a href=&quot;http://www.flightgear.org/&quot;&gt;Flightgear&lt;/a&gt; is open source flight simulator. It is weighted ~300MB for windows (relatively low compared to other simulators). It can be used not only for gaming. There are some R/C models, which can be used to practice on them. For example &lt;a href=&quot;ftp://mirrors.ibiblio.org/pub/mirrors/flightgear/ftp/Aircraft-2.0.0/Malolo1_0.0.zip&quot;&gt;Malolo aircraft.&lt;/a&gt; Download and extract it to&amp;nbsp; &lt;i&gt;C:\Program Files (x86)\FlightGear\data\Aircraft&lt;/i&gt; (Ubuntu: &lt;i&gt;/usr/share/games/FlightGear/Aircraft/&lt;/i&gt;).&lt;br /&gt;
Then run the following from command line:&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;C:\Program Files (x86)\FlightGear\bin\Win32\fgfs&quot; ^&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;--fg-root=C:\Program Files (x86)\FlightGear\data&quot;&amp;nbsp; ^&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;--aircraft=Malolo1&quot; &lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&lt;/i&gt;or in Ubuntu&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;fgfs --aircraft=Malolo1 &lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Wait a minute, while the program finish loading, then you can drive the airplane using following keys.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; V&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : Change viewpoint&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Page-Up&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : Increase throttle&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Page-Down&amp;nbsp; : Decrease throttle&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; X&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : Zoom-in&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Shift-X&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; : Zoom-out&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Arrow keys&amp;nbsp;&amp;nbsp; : Control elevator and aileron.&lt;br /&gt;
It is OK when you crash a plane just after a few seconds of flying :). Do some practice.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwWuUlNi_5YVW7UWqyU6VWdAPGGjQ03uptJUy5mTaVBmK6wCBw2ALIcCPlc7Sbi6935jLFR1hmowHDxzSvNRoSa4zv1tG22VNHj4EzAmDeZsMh815Tj7xltZp2ZmpfokKeptQDIgIAaJY/s1600/Untitled.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;312&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwWuUlNi_5YVW7UWqyU6VWdAPGGjQ03uptJUy5mTaVBmK6wCBw2ALIcCPlc7Sbi6935jLFR1hmowHDxzSvNRoSa4zv1tG22VNHj4EzAmDeZsMh815Tj7xltZp2ZmpfokKeptQDIgIAaJY/s400/Untitled.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Flightgear has many useful features, and one of them is the ability to show the status of every components in the environment. Just run it adding the &quot;--httpd=1234&quot; argument and it creates a local web server. Navigating to &lt;a href=&quot;http://localhost:1234/&quot;&gt;http://localhost:1234&lt;/a&gt; you can see a tree structure of all elements, which can be modified from browser also. For example start the program, change the viewpoint and navigate to &lt;a href=&quot;http://localhost:1234/controls/engines/engine&quot;&gt;http://localhost:1234/controls/engines/engine&lt;/a&gt; and click on &lt;b&gt;throttle &lt;/b&gt;and change the value to 0.2.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/3665831792502612613/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2011/04/flightgear.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/3665831792502612613'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/3665831792502612613'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2011/04/flightgear.html' title='Flightgear'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwWuUlNi_5YVW7UWqyU6VWdAPGGjQ03uptJUy5mTaVBmK6wCBw2ALIcCPlc7Sbi6935jLFR1hmowHDxzSvNRoSa4zv1tG22VNHj4EzAmDeZsMh815Tj7xltZp2ZmpfokKeptQDIgIAaJY/s72-c/Untitled.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-9093246711306381662</id><published>2011-03-31T20:50:00.000+05:00</published><updated>2011-03-31T20:50:51.439+05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="root"/><category scheme="http://www.blogger.com/atom/ns#" term="setgid"/><category scheme="http://www.blogger.com/atom/ns#" term="setuid"/><category scheme="http://www.blogger.com/atom/ns#" term="sticky bit"/><category scheme="http://www.blogger.com/atom/ns#" term="sudo"/><title type='text'>Linux and SETUID (SETGID, Sticky bit)</title><content type='html'>Every file in Linux has read, write and execute rights for the owner, group and others. Besides those attributes there are 3 extra attributes &lt;i&gt;setuid&lt;/i&gt;, &lt;i&gt;setgid &lt;/i&gt;and &lt;i&gt;sticky bit&lt;/i&gt;.&lt;br /&gt;
1) The &lt;i&gt;setuid &lt;/i&gt;attribute is meaningful for executable files. If this bit is set then the user ID would be set as that of the owner of executable rather than the current user. For example the &lt;i&gt;sudo&lt;/i&gt; tool owner is &lt;i&gt;root&lt;/i&gt; and the &lt;i&gt;setuid&lt;/i&gt; bit is set on, and when another user run this program, it will be executed as &lt;i&gt;root&lt;/i&gt;. If set off the &lt;i&gt;setuid &lt;/i&gt;attribute, then the sudo tool will not work, because it will run as a normal user without &lt;i&gt;root&lt;/i&gt; permissions.&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/896501.js?file=setuid.bash&quot;&gt;
&lt;/script&gt;&lt;br /&gt;
&amp;nbsp;2) &lt;i&gt;Setgid &lt;/i&gt;attribute is the analog to &lt;i&gt;setuid, &lt;/i&gt;but for group ID.&lt;br /&gt;
&lt;br /&gt;
3) In Linux sticky bit is meaningful for directories only(in old *nix systems it had another meaning also). If this bit is enabled on directory then the files in that directory may only be deleted or renamed by root or by their owner.&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/896536.js?file=sticky%20bit.sh&quot;&gt;
&lt;/script&gt;&lt;br /&gt;
One more sample related to &lt;i&gt;setuid&lt;/i&gt;&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/896596.js?file=setuid2.bash&quot;&gt;
&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/9093246711306381662/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2011/03/linux-and-setuid-setgid-sticky-bit.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/9093246711306381662'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/9093246711306381662'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2011/03/linux-and-setuid-setgid-sticky-bit.html' title='Linux and SETUID (SETGID, Sticky bit)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-4849806959269040954</id><published>2011-03-29T23:30:00.000+05:00</published><updated>2011-03-29T23:30:40.302+05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Serial port"/><category scheme="http://www.blogger.com/atom/ns#" term="Servo"/><category scheme="http://www.blogger.com/atom/ns#" term="Servo motor"/><title type='text'>Arduino and Servo motors</title><content type='html'>Arduino has a Servo library which allows to control servo motors. Today we will use the following small servo motor and write a program, which read a angle value from Serial port and rotate servo motor according to it.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYnVex74RECfxTJxy1GGwO19NaDJrFDOo68GcbuLgpwnLuGrdqsv_mbRwhGwIhqHc7SpjEETqG__nOJi3B5yjWnHCpTvZXjyJF9jyeeRIaLvgN5JUn_k994MpDvcilYXEN4DepOzexKUk/s1600/BA-TS-36%25281%2529.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;229&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYnVex74RECfxTJxy1GGwO19NaDJrFDOo68GcbuLgpwnLuGrdqsv_mbRwhGwIhqHc7SpjEETqG__nOJi3B5yjWnHCpTvZXjyJF9jyeeRIaLvgN5JUn_k994MpDvcilYXEN4DepOzexKUk/s320/BA-TS-36%25281%2529.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;This is the source code of program&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/892903.js?file=servo.pde&quot;&gt;
&lt;/script&gt;&lt;br /&gt;
Compile and upload above code to Arduino, then connect control pin(gray wire) of Servo motor to Arduino pin 11, connect black wire to Gnd of Arduino and red wire to +5V. This is how it looks:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggc3dEIQBOOWcyBaJCWuPI1YTkr5SMjZeM4RY2fiOVBXM1cY0sivnHuA1OyB5YepXd-Mk-v9XrfGc1KFwN52Qqf-pmiFrntuMVmOJP3C1wwKRa6s3oeYVgO_2ii2xgv5fzGsSkUfLGtgs/s1600/Image082.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggc3dEIQBOOWcyBaJCWuPI1YTkr5SMjZeM4RY2fiOVBXM1cY0sivnHuA1OyB5YepXd-Mk-v9XrfGc1KFwN52Qqf-pmiFrntuMVmOJP3C1wwKRa6s3oeYVgO_2ii2xgv5fzGsSkUfLGtgs/s320/Image082.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
And this is a video demonstration of moving Servo 0 -&amp;gt; 90 -&amp;gt; 180 -&amp;gt; 0 -&amp;gt; 90:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.blogger.com/video.g?token=AD6v5dwkk3o59nLY8WAPtnW6E-hWl1c25TACKcD5qaG86qtEXV9oqKJtdZ2MmwaiHTIsi_bNWtzfGxXZKdv5H6UCzQ&#39; class=&#39;b-hbp-video b-uploaded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/4849806959269040954/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2011/03/arduino-and-servo-motors.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/4849806959269040954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/4849806959269040954'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2011/03/arduino-and-servo-motors.html' title='Arduino and Servo motors'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYnVex74RECfxTJxy1GGwO19NaDJrFDOo68GcbuLgpwnLuGrdqsv_mbRwhGwIhqHc7SpjEETqG__nOJi3B5yjWnHCpTvZXjyJF9jyeeRIaLvgN5JUn_k994MpDvcilYXEN4DepOzexKUk/s72-c/BA-TS-36%25281%2529.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-1313932891365831271</id><published>2011-03-28T20:40:00.000+05:00</published><updated>2011-03-28T20:40:31.079+05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="10.10"/><category scheme="http://www.blogger.com/atom/ns#" term="bug"/><category scheme="http://www.blogger.com/atom/ns#" term="exploit"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="security"/><category scheme="http://www.blogger.com/atom/ns#" term="setcap"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Security bug in Ubuntu 10.10</title><content type='html'>Yes, Ubuntu also has security bugs. But &lt;a href=&quot;http://www.exploit-db.com/exploits/15944/&quot;&gt;this one&lt;/a&gt; can be used in the last steps of attacking. There are some requirements for this code to work. Attacker need to find a vulnerability in a process and run a &lt;a href=&quot;http://en.wikipedia.org/wiki/Shellcode&quot;&gt;shellcode&lt;/a&gt; and if that executable has CAP_SYS_ADMIN capability, then using this bug it can get root privileges.&lt;br /&gt;
&lt;br /&gt;
To run this exploit download source from &lt;a href=&quot;http://www.exploit-db.com/download/15944&quot;&gt;http://www.exploit-db.com/download/15944&lt;/a&gt; and do the following steps: &lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/890665.js?file=exploit.sh&quot;&gt;
&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/1313932891365831271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2011/03/security-bug-in-ubuntu-1010.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/1313932891365831271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/1313932891365831271'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2011/03/security-bug-in-ubuntu-1010.html' title='Security bug in Ubuntu 10.10'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-2440213761888523293</id><published>2011-03-28T17:33:00.000+05:00</published><updated>2011-03-28T17:33:52.263+05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Accelerometer"/><category scheme="http://www.blogger.com/atom/ns#" term="ADXL335"/><category scheme="http://www.blogger.com/atom/ns#" term="Arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="Serial port"/><title type='text'>How many G my car can pull?</title><content type='html'>In the &lt;a href=&quot;http://autosysprogs.blogspot.com/2011/02/adxl335-accelerometer.html&quot;&gt;previous article&lt;/a&gt; we study how to work with ADXL335 accelerometer. Today we will use it to measure car&#39;s acceleration. This is a sample program which get the values from sensor and send them through serial port to the computer. It measures every 20ms and do it 1000 times.&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/890286.js?file=ADXL335.pde&quot;&gt;
&lt;/script&gt;&lt;br /&gt;
Now lets connect ADXL335 to the Arduino and then compile and upload the above code.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Sensor placed in such way that Z axis is directed to front of car.(You can see it in the picture, on top of red box).&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP1qH1UfJLRXTyNc246rU_j1ZmlbouYCzbm8MuiQgIots-6eg4YoHlJBFYZWFA8EGutOFJcvQ7ukWyb7zn8T-LebKLUpzCeeK38O0MkvwG8pZoI93cNQVeQxnAeZpSUypB_jJXnKwtrW8/s1600/SAM_0155.JPG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP1qH1UfJLRXTyNc246rU_j1ZmlbouYCzbm8MuiQgIots-6eg4YoHlJBFYZWFA8EGutOFJcvQ7ukWyb7zn8T-LebKLUpzCeeK38O0MkvwG8pZoI93cNQVeQxnAeZpSUypB_jJXnKwtrW8/s640/SAM_0155.JPG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
I run the program, type something and press enter in the Serial Monitor and then drive as fast as possible and then brake the car. Copy the values to the Google Docs Spreadsheet and create a chart for the values of Z axis (in which direction the acceleration occurs). But before creating charts lets understand how those numbers map to the real acceleration values in g. The Z axis can be directed downward and measure value (+1g), then direct it upward and measure again(-1g) and taking account that the measured values dependance on acceleration is linear, calculate which value correspond to 0g and which interval correspond to 1g interval. I get following results (approximate results)&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0g --&amp;nbsp; 355&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1g interval -- 70 interval&lt;/i&gt;&lt;br /&gt;
The measured values also contain a lot of noise, so we need to filter out them.&lt;br /&gt;
&lt;br /&gt;
This is unfiltered chart: Z_i&lt;br /&gt;
&lt;img src=&quot;https://spreadsheets.google.com/oimg?key=0AnxI_O0qMF__dFB3N1lpRWZUbDhqZTFLYXhpeGd4YWc&amp;amp;oid=3&amp;amp;zx=8j5faa2riawx&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
This is filtered and converted to G chart: ((Z_i + Z_i+1) /2 - 355) / 70&lt;br /&gt;
&lt;img src=&quot;https://spreadsheets.google.com/oimg?key=0AnxI_O0qMF__dFB3N1lpRWZUbDhqZTFLYXhpeGd4YWc&amp;amp;oid=4&amp;amp;zx=ylt9fp7p9ljz&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
This is filtered(another filter) and converted to G chart:  ((Z_i + Z_i+1 + Z_i+2) / 3&amp;nbsp; - 355) / 705&lt;br /&gt;
&lt;script src=&quot;//ajax.googleapis.com/ajax/static/modules/gviz/1.0/chart.js&quot; type=&quot;text/javascript&quot;&gt;
 {&quot;chartType&quot;:&quot;LineChart&quot;,&quot;chartName&quot;:&quot;Chart 3&quot;,&quot;dataSourceUrl&quot;:&quot;//spreadsheets.google.com/tq?key=0AnxI_O0qMF__dFB3N1lpRWZUbDhqZTFLYXhpeGd4YWc&amp;transpose=0&amp;headers=1&amp;range=D1%3AD1001&amp;gid=0&amp;pub=1&quot;,&quot;options&quot;:{&quot;reverseCategories&quot;:false,&quot;fontColor&quot;:&quot;#fff&quot;,&quot;midColor&quot;:&quot;#36c&quot;,&quot;pointSize&quot;:&quot;0&quot;,&quot;headerColor&quot;:&quot;#3d85c6&quot;,&quot;vAxis&quot;:{&quot;format&quot;:&quot;#,##0.00&quot;},&quot;minValue&quot;:-1,&quot;headerHeight&quot;:40,&quot;is3D&quot;:false,&quot;logScale&quot;:false,&quot;hAxis&quot;:{&quot;maxAlternation&quot;:1},&quot;wmode&quot;:&quot;opaque&quot;,&quot;title&quot;:&quot;&quot;,&quot;maxValue&quot;:1,&quot;isStacked&quot;:false,&quot;mapType&quot;:&quot;hybrid&quot;,&quot;showTip&quot;:true,&quot;displayAnnotations&quot;:true,&quot;min&quot;:-1,&quot;dataMode&quot;:&quot;markers&quot;,&quot;max&quot;:1,&quot;colors&quot;:[&quot;#3366CC&quot;,&quot;#DC3912&quot;,&quot;#FF9900&quot;,&quot;#109618&quot;,&quot;#990099&quot;,&quot;#0099C6&quot;,&quot;#DD4477&quot;,&quot;#66AA00&quot;,&quot;#B82E2E&quot;,&quot;#316395&quot;],&quot;smoothLine&quot;:false,&quot;maxColor&quot;:&quot;#222&quot;,&quot;lineWidth&quot;:&quot;2&quot;,&quot;labelPosition&quot;:&quot;right&quot;,&quot;fontSize&quot;:&quot;14px&quot;,&quot;hasLabelsColumn&quot;:false,&quot;maxDepth&quot;:2,&quot;interpolateNulls&quot;:false,&quot;legend&quot;:&quot;right&quot;,&quot;allowCollapse&quot;:true,&quot;minColor&quot;:&quot;#ccc&quot;,&quot;reverseAxis&quot;:false,&quot;width&quot;:600,&quot;height&quot;:371},&quot;refreshInterval&quot;:5} 
&lt;/script&gt;&lt;br /&gt;
In the above chart you can see the shift of gear from 1 to 2 and then brake. After car stops and acceleration is 0.</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/2440213761888523293/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2011/03/how-many-g-my-car-can-pull.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/2440213761888523293'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/2440213761888523293'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2011/03/how-many-g-my-car-can-pull.html' title='How many G my car can pull?'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP1qH1UfJLRXTyNc246rU_j1ZmlbouYCzbm8MuiQgIots-6eg4YoHlJBFYZWFA8EGutOFJcvQ7ukWyb7zn8T-LebKLUpzCeeK38O0MkvwG8pZoI93cNQVeQxnAeZpSUypB_jJXnKwtrW8/s72-c/SAM_0155.JPG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-71586183621138685</id><published>2011-03-25T17:47:00.000+04:00</published><updated>2011-03-25T17:47:56.343+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASLR"/><category scheme="http://www.blogger.com/atom/ns#" term="disable ASLR"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="personality"/><category scheme="http://www.blogger.com/atom/ns#" term="setarch"/><category scheme="http://www.blogger.com/atom/ns#" term="syscall"/><title type='text'>ASLR and Linux personality syscall</title><content type='html'>In the &lt;a href=&quot;http://autosysprogs.blogspot.com/2011/03/address-space-layout-randomization-aslr.html&quot;&gt;previous article &lt;/a&gt;we talk about ASLR and how to disable it. There was a way to disable ASLR for a single process using &lt;i&gt;setarch&lt;/i&gt; command. Now we are going to understand how &lt;i&gt;setarch&lt;/i&gt; command do that. Lets use &lt;a href=&quot;http://autosysprogs.blogspot.com/2011/03/strace-tool-for-system-call-tracing.html&quot;&gt;strace&lt;/a&gt; command to trace all system calls of setarch command with and without -R option&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/886805.js?file=shell.personality.1.log&quot;&gt;
&lt;/script&gt;&lt;br /&gt;
There are a lot of differences, because of the ASLR: In the log there are a lot memory addresses and they will be different. Now lets disable it for all processes and then do above steps again to filter out memory differences.&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/886808.js?file=shell.personality.2.log&quot;&gt;
&lt;/script&gt;Now we see that there is a system call named &lt;i&gt;personality&lt;/i&gt;. It is difficult to understand from the &lt;i&gt;man personality&lt;/i&gt; what this syscall actually do. So we can get a information from include file of &lt;i&gt;personality &lt;/i&gt;syscall&lt;i&gt;(&lt;/i&gt;in case of Ubuntu 10.10 it located at &lt;i&gt;/usr/include/sys/personality.h). &lt;/i&gt;Here it is:&lt;i&gt; &lt;/i&gt;&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/886820.js?file=personality.h&quot;&gt;
&lt;/script&gt;There is enum &lt;i&gt;ADDR_NO_RANDOMIZE&lt;/i&gt; equal to 0x0040000 which passed in as an argument in personality in above difference logs. So we understand that we can disable the process&#39;s ASLR by calling &lt;i&gt;personality&lt;/i&gt; syscall with &lt;i&gt;ADDR_NO_RANDOMIZE &lt;/i&gt;argument&lt;i&gt;. &lt;/i&gt;Lets modify the program from &lt;a href=&quot;http://autosysprogs.blogspot.com/2011/03/ptrace-linux-system-call.html&quot;&gt;previous article &lt;/a&gt;and check is this works.&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/886824.js?file=aslr.c&quot;&gt;
 
&lt;/script&gt;Enable ASLR by &lt;i&gt;echo 2 | sudo tee /proc/sys/kernel/randomize_va_space&lt;/i&gt;. Run above code twice and when they wait for input, dump the memory maps (get &lt;i&gt;pid&lt;/i&gt; from htop and then cat /proc/pid/maps) and compare them: it works, the maps are the same. You can also comment out the line containing personality and get different memory maps.</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/71586183621138685/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2011/03/aslr-and-linux-personality-syscall.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/71586183621138685'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/71586183621138685'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2011/03/aslr-and-linux-personality-syscall.html' title='ASLR and Linux personality syscall'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-2357151798322825468</id><published>2011-03-25T13:27:00.000+04:00</published><updated>2011-03-25T13:27:50.842+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASLR"/><category scheme="http://www.blogger.com/atom/ns#" term="disable ASLR"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="setarch"/><title type='text'>Address space layout randomization (ASLR)</title><content type='html'>&lt;a href=&quot;http://en.wikipedia.org/wiki/Address_space_layout_randomization&quot;&gt;ASLR&lt;/a&gt; is a technique which randomly arranges the libraries, heap, stack and other pages in the memory in random positions. This technique designed for standing against security attacks. If the ASLR is disabled, the memory addresses of libraries and the stack are predefined, so the vulnerable codes(&lt;a href=&quot;http://en.wikipedia.org/wiki/Shellcode&quot;&gt;shellcodes&lt;/a&gt;) can use these information and directly call library functions. To check if the ASLR is enabled in the system we can run some program twice and compare memory maps.&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/886557.js?file=shell.log&quot;&gt;
&lt;/script&gt;&lt;br /&gt;
The memory positions are different, that means the ASLR is enabled. From the debugging point of view it sometimes distrurbs and we need to disable it. There are 2 ways(known to me) to disable ASLR.&lt;br /&gt;
1) Disable ASLR using &lt;i&gt;setarch&lt;/i&gt; command&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/886591.js?file=shell2.log&quot;&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
2) Disable ASLR for entire system&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/886593.js?file=shell3.log&quot;&gt;
&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/2357151798322825468/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2011/03/address-space-layout-randomization-aslr.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/2357151798322825468'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/2357151798322825468'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2011/03/address-space-layout-randomization-aslr.html' title='Address space layout randomization (ASLR)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-8654499825232773729</id><published>2011-03-24T18:14:00.000+04:00</published><updated>2011-03-24T18:14:18.861+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="ptrace"/><category scheme="http://www.blogger.com/atom/ns#" term="strace"/><title type='text'>ptrace -- Linux system call</title><content type='html'>In the previous &lt;a href=&quot;http://autosysprogs.blogspot.com/2011/03/strace-tool-for-system-call-tracing.html&quot;&gt;article&lt;/a&gt; the &lt;i&gt;strace&lt;/i&gt; command observed, today we are going to understand how the &lt;i&gt;strace&lt;/i&gt; tool works and write a simple system tracer program to trace system calls of &lt;i&gt;ls&lt;/i&gt; program.&lt;br /&gt;
At first let &lt;i&gt;strace&lt;/i&gt; the &lt;i&gt;ls&lt;/i&gt; program&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;i&gt;strace -o ls.strace ls&lt;/i&gt;&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/885068.js?file=ls.strace.c&quot;&gt;
&lt;/script&gt;&lt;br /&gt;
To know which system calls the strace uses lets run it on itself.&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; strace -o strace.strace strace ls&lt;/i&gt;&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/885071.js?file=strace.strace.c&quot;&gt;
&lt;/script&gt;&lt;br /&gt;
As we can see the &lt;i&gt;strace&lt;/i&gt; use a lot of system calls, but the one of them (&lt;i&gt;ptrace&lt;/i&gt;) appears a lot in the log. The &lt;i&gt;ptrace&lt;/i&gt; provides a means to get information from the child process (see &lt;i&gt;man ptrace&lt;/i&gt;).The following simple program uses the ptrace to trace system calls of ls program&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/885090.js?file=trace.c&quot;&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We also need to know the names of system calls by their syscall number. We can extract that information from the &lt;a href=&quot;http://sourceforge.net/projects/strace/&quot;&gt;sources of strace.&lt;/a&gt; The file &lt;i&gt;&quot;strace-4.6/linux/x86_64/syscallent.h&lt;/i&gt;&quot; contains the information that we need, we can parse it and get the list of system calls arranged by syscall number (see the instructions in the sources).&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/885122.js?file=trace.c&quot;&gt;
&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/8654499825232773729/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2011/03/ptrace-linux-system-call.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/8654499825232773729'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/8654499825232773729'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2011/03/ptrace-linux-system-call.html' title='ptrace -- Linux system call'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4355260969616063952.post-2845134623345565833</id><published>2011-03-16T16:44:00.000+04:00</published><updated>2011-03-16T16:44:29.664+04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="hcidump"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="syscall"/><title type='text'>Strace -- tool for system call tracing</title><content type='html'>For tracing system calls of a program, there is a &quot;strace&quot; command in Linux. This program comes with the most of Linux distributions. If it is not present in your system, you can download it from &lt;a href=&quot;http://sourceforge.net/projects/strace/&quot;&gt;http://sourceforge.net/projects/strace/&lt;/a&gt;, build and install.&lt;br /&gt;
Lets try run the &lt;a href=&quot;http://autosysprogs.blogspot.com/search/label/hcidump&quot;&gt;hcidump&lt;/a&gt; and see which system calls it use:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;i&gt;sudo strace -o output hcidump -i hci0&lt;/i&gt; &lt;br /&gt;
Do some bluetooth related things(search a device) and see the output file&lt;br /&gt;
&lt;script src=&quot;https://gist.github.com/872362.js?file=output.c&quot;&gt;
&lt;/script&gt;&lt;br /&gt;
As we can see, hcidump uses socket related system calls(&lt;i&gt;socket, bind, recvmsg&lt;/i&gt; and etc...) for getting bluetooth data, &lt;i&gt;ioctl &lt;/i&gt;system call(for controlling bluetooth device), &lt;i&gt;write&lt;/i&gt; system call (guess why :-) ), &lt;i&gt;poll&lt;/i&gt; system call (which used for waiting for a socket IO events).&lt;br /&gt;
There is &quot;-e trace=&quot; option, which trace only specified set of system calls, for example&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sudo strace -o output -e trace=socket,write,poll hcidump -i hci0&lt;/i&gt;&lt;br /&gt;
will trace only system calls &lt;i&gt;socket&lt;/i&gt;, &lt;i&gt;write&lt;/i&gt; and &lt;i&gt;poll&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
And at last there is a good syntax highlighter in the &quot;vim&quot; for strace&#39;s output&lt;br /&gt;
(In the case if vim doesn&#39;t automatically enable it -- &lt;i&gt;:setf strace&lt;/i&gt;).</content><link rel='replies' type='application/atom+xml' href='http://autosysprogs.blogspot.com/feeds/2845134623345565833/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://autosysprogs.blogspot.com/2011/03/strace-tool-for-system-call-tracing.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/2845134623345565833'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4355260969616063952/posts/default/2845134623345565833'/><link rel='alternate' type='text/html' href='http://autosysprogs.blogspot.com/2011/03/strace-tool-for-system-call-tracing.html' title='Strace -- tool for system call tracing'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16155259091050187977</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry></feed>