Saturday, November 26, 2016

Mentoring Eudyptula Challenge - 3 & 4

It is a long delay of writing this part of Eudyptula challenge of 3 and 4.

But I would like to continue this series till the end (upto 20th of challenge).

Today, I'll project two challenge together, as they ain't long or big and not really a part of programming or really working with kernel space. As it is task of 3 & 4, the task number 1 & 2, specially 2 is a pre-requisite. So, my assumption is, you have already finished the task 1 & 2 and now pursuing this task number 3 & 4.
As you've done the task 2, i.e., you've just build the custom kernel, you've sent your work, and received this line -  Congratulations on passing this task!

Tuesday, November 1, 2016

Gold as Money with some scientific chatter


It was a medium quality evening, and as usual we were killing kings and lords* {all queens ain't Eli-II }(common task of every rendezvous).

Well, one of them - in zufall (accidentally!!!) got some good amount of money,
and worried (as we equally poor always do) whether will these money stay or even grow with its same buying capacity as now.
Usually due to read some of "conspiracy" theory and bit of a fan of anti-establishment, however also likes of bit of these and that - I'm for gold by far, and argue that nothing can replace gold against its buying power.

But one of us not agreeing and he put the stuff in scientific manner, as gold can be collected from everywhere, even it is possible to convert some other metal to gold through fusion technology. He put the example of ITER, where they are doing something like this. His example was, you can take a nearer metal of gold from periodic table and convert it with enough heat, pressure and some other stuff that you need to change the atomic form of that matter to gold.

Tuesday, August 23, 2016

Adding customer code/module in Kernel source tree


For an embedded system, there's actually little or almost no reason to use loadable Kernel modules. On the other hand, it may turn insecure, if the system is a protected one, using encrypted data & key while live. Then a custom loadable module can dump the memory to grab the secret data/key from runtime environment.

Other than all these, probably, you wish to see something while booting your own custom Kernel. For example, you want - that well known hello_world program should print something on console while kernel is booting.

A simple google search for "hello_world kernel space program" will point you a lot of examples to preparation, write, linking, compiling, loading, checking and unloading that hello_world program as a module for Kernel.

Monday, June 27, 2016

An interesting scanf() skipping behavior



It is very interesting and quite important to notice scanf() behavior in C programming,

While you are writing a code for example,

 int x; char y;  
 scanf ("%d", &x);  
 scanf ("%c", &y);  

    -- the second scanf() will not hit while you run the program. But if you reverse,

 scanf ("%c", &y);  
 scanf ("%d", &x);  

                -- it will work. But WHY ???
               
Because scanf() function reads new line character from Return key, so while something Integer has been read into a variable and then pressed Return, a New Line created due to Return key is staying in buffer and the next scanf(), which is ready to take a character variable took that New Line as character value and as it filled with a character, it automatically skip.

But on other case, as the second scanf is as integer, it does not effect with above cause.

Because, scanf() function removes whitespace automatically before trying to parse, except - again EXCEPT,

 %c, %n, %[] these three cases.  

Tuesday, April 26, 2016

A MQTT application with QR code and OpenCV


Once a cake sent to us, bought back to package-center and next 2 days, as we were not able to pick it.
However at the same day we were rounding near by package-center for few times.

While get back home, it was late and 2 days later we'd a cake with feet-smell.

It often happen with us, delivery package from DHL/Post or others arrive, while nobody is at home. So at the evening, while back home, found the note from postman - either collect it from neighbour or report to postoffice / collection center.

However, it would be nice to know, as well saves time and effort, that a package was at my door. So, I can pick it while coming back home, if time allows.

For such scenario let me to grab the idea of building an automated system, so absent of recipient, postman will scan a QR code, with the camera attached with doorbell and bring the packet back to package collection center.

So how does it will work ?

Tuesday, March 22, 2016

Mentoring Eudyptula Challenge - 2

Eudyptula Challenge is started in end of 2014 and getting very popular among linux enthusiast. A lot of people registered, or by mean of join-in with Little Penguin, but about half of them didn't submit the first task.

Some important notes and comments you can find about eduptula in this link https://events.linuxfoundation.org/sites/events/files/slides/ec.pdf.

This time, I'm going to discuss about Task-02. This one is a very little task about building customer kernel.

Your task will start from downloading the kernel source, you can download it as .zip, but best and most recommended option is using git. Figure out how you can get link for latest version of kernel. One of the example could be -

git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

Mentoring Eudyptula Challenge - 1


This post and coming is intended to help of getting things easier on Kernel challenges, The Eudyptula Challenge.

But it will not give you the total solution, [however, you can find those by googling] but will try to help you how you can understand the problems and get the things easier.

Well now - the Eudyptula challenge is a list of tasks to learn linux kernel, its structure and development processes. Mainly its a bot, supplying and evaluating your tasks.

The first requirement to participate the challenge is to learn emailing as plain-text. Those who are well known of using sendmail from command line do know it by heart. But for modern young guys - you better use thunderbird, and set its settings as unchecked Compose message as HTML format.

On other hand, if you are using gmail on web by selecting Plain Text Mode while composing your email would give you same benefit.

Friday, February 19, 2016

Infrared Transmitter Sensor Driver for Raspbery pi


37 sensor kit box is shipped with a Infrared Transmitter sensor. Alike Line Tracking Sensor, this one also a single pin sensor, turned on infrared while got ON / High on Signal port.

Hardware Description :
The IRT sensor circuit is very simple, just consist of a Infrared LED. The sensor got 3 physical PIN, and only Signal marked as S. Well, the middle on is for Volt [5v], and last one is for GND.
S is connected to GPIO – 2.


Thursday, February 18, 2016

Line Tracking Sensor Driver for Raspberry Pi


KY-033 is a line tracking sensor. This project is to develop a dynamically loadable device driver for sensor KY-033 to enabled in RaspberryPi -1.
KY-033 is a single pin line tracking sensor. 

Raspberry Pi -1, a very popular SBC running with Debian linux (code name Wheezy for raspberry pi) with default kernel version 3.18. 


As it required to develop a kernel module, same version of running kernel header should be installed and configured for the system.


Description of Hardware:

The traget sensor KY-033 is a Line Tracking Sensor consist of one Infrared light and one LED. It also consist of a Si photosensor. The basic principle of Line Tracking Sensor is to detect if any white light component reflect from opposite surface.

Wednesday, February 17, 2016

Precision Time Measurement to read Remote Sensor


A scenario is like this --

You got a task to figure precise round trip time of a remote device or perhaps, need to measure how much time it required to receive the sensor data at requested side.

To measure accurate round trip time from client to sensor, two different technique is mainly popular. 

First, used timespec struct (sec & nano-sec) with CLOCK_MONOTONIC marco of kernel to measure time between sending client request and receive of result from server. 

Second, fill timespec struct (sec and nano-sec) variable with network driver packet timestamp macro SIOCGSTAMPNS for sending socket and receiving socket and calculate the difference.


Example Output =>

 SHELL>$ ./pngclnt_v2 192.168.178.100  
 0.000000s : 0.019165 sec  
 Output 1  
 0.000000s : 0.020459sec  
 Output 0  
 0.000000s : 0.019314sec  
 Output 1  

The idea is client -- server scenario, which means a server will run on sensor side and wait for client will request. Once receive the request, server script will perform the task and respond back to client.