The Oh F**k Incidence – 2


“Hi!”, she said when she finally came to the cafe.

“Oh… hi!”, a rush of memories washes over me. “Oh… fuck.”, stop thinking. Just let her… be.

“Damn, she looks like a dream”, I think to myself. “You cool.”, I say to her. Stop all bodily functions… “don’t fuck up… don’t fuck up…”.

“So how are you?”, she asks.

C’mon… think something… speak, you idiot. “I’m good…”. Ok… that was a reply, should I ask her something? It won’t seem rude, would it? “How are you?”, I ask.

“I’m good too dear!”, she flashes a smile. I jump a heartbeat and the rest of the world, blurs. In that moment, she was the one true reality.

Some 4 years ago, a feeling was sowed in me. I have been through much and I have seen some things and went through transformations umpteen times but that feeling never faded. How many times has that feeling, that one inkling of hope of seeing her again, helped me breathe. How many countless times have I hated that feeling wishing that it dies. How many countless times I have cherished it wishing it back. All squashed and mashed and served in a single serving. All the feelings of helplessness of her absence colliding with the happiness of her presence. Pleasure and pain entwined in one.

What did I say then? “Your bindi is off-center.”

That spotless, radiant face, that was burned in my brain’s firmware, was live.

Astonishing as it may seem but yet very true, it was amazing to meet after a long time in such a manner. We lived through our lives, taking steps and making decisions that led to that cafe in a city so far away that neither of us ever hoped we will meet.

Her eyes were inquisitive. A certain mischief or so I could see. A contagious smile hung on her lips. There was a controlled excitement in her… like some savory champagne ready to be uncorked. A warmth surrounded her, like a lover’s hug. A certain accent in her voice that seemed exotic as she talked of things that were on the deeper side of understanding.

A moment so happened that I took her hand. A spark went down my spine… like the centers of energy in the body, opening. A brief period of completeness… of certain peace.

As I sit here bleeding these words, I think of what I could have done differently to have a version of the future where that brief period of completeness was not so brief. Letting the could-have-beens and the would-have-beens go, I sit here with the feeling… a feeling that is going to be hated, cherished, bleed and healed. A feeling that is now the very essence of my being.




Since being boisterous is a direct consequence of hollow knowledge, I’ll write about some cool tech I recently had a chance to look into. To keep things simple and clutter free, I have links to pre-requisite information and for reference and further reading. While working on nothing in the current project, I looked into how a dual clutch transmission works and how data is transmitted in between various subsystems in an automobile.

I’m a bottom feeder. I work nonce and talk much. I need appreciation and want to portray myself as a know-it-all. I enforce my perspective of things on others and get irked when they balk. I’m a sycophantic suck up and I’ll be that because my intelligence limits me to work on meaningful things. I use low cunning and honeyed language to escape work. I’m narcissistic and I cannot bear someone else outshining  me.

Having a keen interest in transmission systems or colloquially, gearbox, it was intriguing to understand how a dual clutch transmission (DCT) sends an upshift recommendation to the instrument cluster. From wikipedia: “A transmission is a machine in a power transmission system, which provides controlled application of the power.”. In a car (or vehicle), the internal combustion engine is the power unit and it provides, through the transmission system, power to the drive wheels. The transmission unit, for example, is designed to deliver more torque in lower gears and higher power in higher gears (gear ratios). From manual transmissions that have dominated road cars till now to the new DCTs, transmission systems have become more complex and more efficient.

You can read about various transmissions in the wiki link above, we will be concentrating on DCTs. As the name suggests, the transmission consists of two clutches cleverly mounted over each other. Quintessentially, it is two manual transmissions fused into one. The advantage lies in the fact that each sub unit has alternating set of gear trains and each sub unit has its own clutch (“Dual” clutch).  Refer to the diagram below. This setup, along with the required electronics, gives the driver an option of fully automatic mode where the gearbox ECU handles everything and also a manual mode where the driver is required to shift gears.


I’m an over excited socially overactive low life. I talk about random disconnected things. I like to be the centre of attention and hence usually let my self esteem flood the drains. I’m entertaining, doubt that not! I have no knowledge of all things and all knowledge of no things. I have a limited perspective of things but I think that I have seen and done much. I’m a motor mouth and I care to give no thoughts behind my words.

I’m a pseudo philosophical wannabe. I talk about varied things hanging on the fringes of reality. I do so because I want people to think of me as a stoner without knowing that I’m being thought of as an idiot. But I pay it no heed because I have my own set of pseudo philosophical views conforming to the general dogma surrounding stoners and I have no imagination. I have a bad boy outlook and I think that makes me cool.

In my studies, I looked into how, in manual mode, the driver is notified of an upshift at the best possible moment. Looking a bit deeper into DCT, each clutch hosts a transmission shaft. The transmission shafts are concentric and each transmission shaft is connected to a separate gear train system. The gear train is arranged in a constant mesh with “odd” gears (1, 3, 5 ,7) on the inner shaft and “Even” gears (2, 4, 6 and reverse) on the outer shaft. The gear train transmits power from the engine, via the engaged gear, to the differential that drives the drive wheels.

The gears are engaged by shifting the gear selector. The selected gear is free to spin on the drive shaft. The gear selector is fixed with the drive shaft and hence will turn the drive shaft. When the selector is locked with the gear, it will spin at the same speed and hence driving the drive shaft. The gearbox ECU is intelligent enough to pre-select the next required gear. The setup is such that the next required gear will always lie on the other transmission shaft (DCT is a sequential transmission). Hence it only requires disengaging the current clutch and engaging the other. In the automatic mode, this whole operation is controlled by the gearbox ECU and manual mode, the actual changing of gears is left to the driver.

transmission-dual-clutch (1)

Arrows indicate power transmission.

In automotive electronics, communication between various subsystems is done predominantly using the CAN protocol. Each ECU processes a CAN packet whenever it receives or transmits data. What message a CAN packet will carry and the priority of each message is decided by the designer. Since it is a bus protocol and there are n-number of ECUs interacting with the bus simultaneously, CAN protocol has to decide which data packet will be transmitted on the bus. The protocol ensures that the data with the highest priority wins the bus.

I’m prone to flattery and will tell anyone, who is ready to listen, about things that I do. I like to convolute things and make an impression by giving grandiose solutions to petty problems. I over work, over think and over react. I like sycophantic suck ups because they feed my ego and  I surround myself with such. I make random useless dry jokes and laugh about it, out loud and expect others to do so.

The gearbox ECU assimilates the current driving conditions and predicts the best possible moment to upshift a gear. This message is transmitted from the gearbox ECU to the instrument cluster and the driver is notified visually or audibly about the same. In some applications, flooring the pedal (hard acceleration) sets the “kickdown” mode. The gearbox ECU downshifts to lower gears giving more acceleration and then upshifts again accordingly. DCT allows for lightening fast gear shifts and also hassle free driving while cruising in the automatic mode.

I’m a generic socially acceptable meatbag. I go to social gatherings and I talk shit to people. I talk to shit people too about shit agendas and other shit people. I enjoy having behind-the-back conversations and forming opinions. I form opinions based on other opinions and I’m steadfast on those opinions because I think they are my own opinions. I cannot imagine working more than I’m given to do. I’m old wave but I try to be new school. I’m working hard and getting by until the day I die.

PS: This article is not a tutorial or a study aid. This post is for infotainment purposes and the author takes no responsibility for the dearth of technical information.




It means an expression/article of praise. Its’ been a while since I have updated my blog. I’m happy actually. Not that rainbows and butterfly kind of happy but life-is-going-good happy. I have a social circle and they talk to me too, which is nice. As per social conventions, you should say good things about people who have a positive impact on you. I have 4+1 elements in this set of human entities and in this panegyric I’ll try and describe these 4+1 elements.

At work, I have nothing much to do so I was working on Qt/QML. Qt is to C++ what Android is to Java. Like Android, Qt is not pure C++ and rather extends C++ and makes it more awesome (as if C++ needed to be any more awesome). QML is a declarative language that is used to design UIs and together with Qt, one can create powerful desktop applications independent of platform. A friend asked me for a comprehensive tutorial and I’ll try to elucidate a sample music player application I made in Qt/QML. It’s nothing much really but it does implement concepts of models, views, delegates and exposing variables from C++ code to QML. You can download the code here and must have the latest updated version of Qt Creator.

So I have 4+1 elements in this set of human entities. 4 of us are in a group and we talk on this messaging application where they laugh and respond or simply respond. The other element is whom this article is meant for. The Guy and I discuss not about piffling things such as human dealings (a.k.a bitching) and talk about better things such as world happenings and imaginative ideas that may not happen in real life. This one is rathe for new ideas, adventures and experiences and values friendship. This one thinks that I’m erudite so I assume that there is something wrong with this one. And as a matter of fact, there is. This one has his own world and is lost most of the time in that world. It would be condescending to say that The Guy should adjust the volume of his voice but its’ ok. At least he speaks not shit like most other humans do.

Sweet P is sweet. This one is happy go lucky and has an infectious smile. This one is artistic and sees a world full of colours and possibilities. This one also yearns for new experiences and has a lot to see and do. This one too thinks that I’m erudite so there must be something wrong with her too. And there is. This one is too happy. I wish that this one gets to see the fucked up side of life soon. One becomes a true sage when they experience downward spiral as zealously as upward spiral.

Open Qt Creator and start a new Qt Quick application. Like most languages today, it scaffolds a basic skeleton for your application. A “main.cpp” file and a “main.qml” file. The CPP file is the controller and QML is the application UI. I added a “player.h” file that defines a class for the music player and a “player.cpp” that defines the controller logic for the music player. If you run the application, it will show a menubar with buttons on the bottom and a “load area” on top. The “load area” is where the UI of the music player will be loaded on click. QML looks like CSS on steroids and if you have an understanding of CSS its’ easy to grasp QML quickly.

QML is used to define “elements” of a UI. Every element has an ID and we refer to an element by its ID. Qt Creator is called so because you can create a UI by dragging and dropping (and editing properties) an element in the Creator window. If you see my “main.qml” file, there is a Loader element. This is the “load area” and we can load an external QML directly into this load are with the Loader element. To make an element clickable, we define, within that element, a mouse area. Mouse area defines an “onClicked” signal which is used to define the function of the element if it is clicked.

Loader {
 id: contentLoader
 x: 1
 y: 0
 width: 1023
 height: 324
MouseArea {
 id: mouseArea2
 anchors.fill: parent
 onClicked: {
     contentLoader.source = "mediaPlayer.qml"

The important and confusing part, like margins in CSS, are anchors. You must read about anchors yourself but it basically means how an element is positioned relative to its’ parent.

Coming to “mediaPlayer.qml”, it looks much the same as “main.qml”. The focus areas are “FolderListModel”, ListView and MediaPlayer. In QML and in general, data is cast into a model. Model is how your data is defined. In this case, we are going to access a folder pointed to by the “musicUrl” variable (we will come back to this). A Model is used by a View to format the data you’re accessing. In this case, we are formatting it in a List and hence the ListView. A View uses a delegate. A Delegate defines how each element in a data set is rendered. In our case, each song in our music folder is enclosed in a clickable rectangle. If you click on it, it will start playing that song. We are using QtMultimedia library to play songs and it defines a MediaPlayer element. You can check out the available parameters of MediaPlayer and QtMultimedia library in the links. Here, we update the “source” parameter of the MediaPlayer element when we click on a song shown in the list. The available parameters of MediaPlayer are used further down the code for example: mediaPlayer.metaData.title and

 FolderListModel {
   id: folderListModel
   folder: musicUrl // TODO: write C++ Controller. Done
   nameFilters: [qsTr("*.mp3")]
   showDirs: false
 ListView {
   id: playList
   x: 9
   y: 8
   width: 261
   height: 308
   spacing: 5
   flickDeceleration: 1000
   model: folderListModel
   delegate: Rectangle {
     x: 23
     y: 21
     width: 234
     height: 56
     gradient: Gradient {
         GradientStop {
         position: 0
         color: "#ffffff"
     GradientStop {
         position: 0.881
         color: "#ae5151"
 Text {
   id: song
   text: model.fileName
   anchors.fill: parent
   verticalAlignment: Text.AlignVCenter
   horizontalAlignment: Text.AlignHCenter
   font.pixelSize: 12
   wrapMode: Text.WordWrap
   MouseArea {
     anchors.fill: parent
     onClicked: {
         mediaPlayer.source = model.fileURL

The third element of the set of human entities is Soni. This one is our darling. We all revere this one and look up to this one. This one is quite mature and emotionally and mentally stable. This one seldom thinks that I’m erudite so there is not much wrong with her. This one is a bit haughty and I feel lucky that I’m in talking terms with this one. Lucky because she is sorted enough to filter out obtuse humans out of her life. This one has experienced much and knows how to hold her composure and stature in direst of situations. This one is the coolest human entity I have come across till now. Right now, this one is globetrotting.

Yanka is not in the messaging group but the technical aspect of this article is meant for this one. This one is one hap chick. This one has a flamboyant style statement. This one is amiable and if you ask this one for some time, she will give you time. This one will sit and listen to you and talk to you. Although this one speaks almost 100 words within a minute but you can slow it down and process it mentally if you aren’t distracted by that sparkling smile. This one thinks that I’m intelligent but I give her that… not her fault, this one doesn’t know me much. Which is good for this one’s mental well being.

Lady D. This one is awesome. This one thinks I’m a fucking idiot and hence there is nothing wrong with this one. This one is different. Out of the pack. I can relate with this one and I like to think that this one and I have same mental frequencies. This one is funny, intelligent… pretty. A whole package just to take your breath away. This one is a bit narcissistic but that’s alright. It suits this one’s persona. You can sit with this one and observe her without getting involved and you won’t be bored. This one has an active (if not over active) mind and cannot sit still. I find many a similarity between this one and myself. I’m mentally (over) active and cannot sit still either. This one is striving to be mentally and emotionally stable like Soni and will eventually get there. This one has naught capacity for bullshit. This one forms clear opinions and characterises deliberately and clinically which I find utterly cool. This one thinks that she is all been there and done that but the only experience that she has is of that one city which was her first home away from home. Given all her imperfections though, this one is perfect in every way. If I ever decide to take a chance with some human, this one would be the one.

Coming to the “player.h” file, here we define a class that will eventually help us get the songs out of our directory and into the list model. In Qt, every class must extend the QObject class. I won’t go into the nitty gritty pieces of this class and directly jump to the implementation of the function definitions. QStandardPaths define all the standard paths in the OS for example, all the paths in the $PATH variable in a terminal are defined in this header file. In “player.cpp”, we extract the standard path to our music folder in the constructor of class “player”.

player::player(QObject *parent) : QObject(parent)
     musicPaths = QStandardPaths::standardLocations(QStandardPaths::MusicLocation);
     musicUrl = QUrl::fromLocalFile(musicPaths.isEmpty() ? QDir::homePath() : musicPaths.first());

The musicUrl variable is set in the controller as shown above. We must expose this variable somehow to QML so that it is accessible in QML. To do this, we add this variable to the root context of the main application engine.

engine.rootContext()->setContextProperty(QStringLiteral("musicUrl"), p.getMusicUrl());

This piece of wonder basically allows us to execute a function defined in our controller whenever the said variable is referred to in the QML. This is pretty fucking cool.

Well, this panegyric comes to an end. These 4+1 elements of this set of human entities are awesome. All opinions presented here are a solely the authors perspective. It is not the author’s intention to degrade anybody but if you feel degraded, feel free to take out time and jump off of a cliff.

Yours truly,

Life: Echoes of Mirage


Stuck somewhere,
somewhere in the tide of time.

A time with which remains the ambition sometimes,
sometimes, most times,
times that slip, slip like sand, times that fly, fly like fog.
A fog that you chase, a chase that never ends,
ends that are desired every time.

End with a winning, ends of achievement,
achievement that costs, a cost that’s undefined.
Undefined questions and answers undefined,
answers sought for throughout life.

A life that is pacey, a brutal life,
a life that is cruel, a beautiful life.
A beauty it is, this journey of life,
life of a journey, journeys of life.

A journey that seeks some hand,
a hand that suits your kind of band.
A band with whom you tie some bonds,
bonds which tie you to the band.

Chaos, dilemma and confusion,
interment are some truths of life.
A life full of illusions,
illusions of a hidden truth.

Truth about acceptance,
realization, existence…
the truth of life.

LIFE… with some lies of life,
take whatever you can take from life
life’s turn of taking can make any night, the last night

written by: A friend.

A day in monotony


Hi again :). Its been a while since I wrote anything (yet again) but I was busy trying to be busy. Keeping yourself occupied when you really are anti-social and isolated (and loving it) is hard work. You have to force your mind to NOT to focus on the things that you lack or have a longing for. For instance, you earn enough to satiate all your whims but you are reticent because its not worth spending the money on it. No, not because you are a miser, but because you don’t have anyone to share the joy with. Sigh… am I not such an emotional fuck?!

Why am I isolated or why I prefer to be isolated is very simple indeed. I like it. I like the fact that my thoughts and my actions are not molded according to a group of individuals. I like the fact that I’m the master of what I say or do. I like the fact that if I screw up something, I have only myself to blame and if I achieve something, I have only myself to praise. I have only myself to hate and I have only myself to love. No complications because there are no variables in my life. And no, I’m not self-obsessed.

And although I like it, the monotony does get over the head. It does become boring being with yourself every freakin’ microsecond that passes by. Since I have no variables around me, it gets miserably monotonous. Get up in the morning, go to work, come back, go for a jog, eat and sleep. Nothing more, nothing less. On weekends, the only thing that changes is that I do not go to work. I go out and get lost in the urban jungle. It is the best part… and if you do fortuitously see me talking to myself with earphones on never giving a fuck about people around me, don’t worry, I’m getting expert advice about life. :D.

Its just, I’m irritated… I like my own company more than anyone else’s but there is nothing to do right now. Things are slow at work and there is no new development on the personal end either. The girl I wrote about is far away and frankly fading away. She was something good but I guess I must let her go now. Not because I want to, but because she is gorgeous and will get better options. At work, the R&D has come to a standstill, I fucked up the hardware. Fuck. At least that was something to look forward to daily!

Hmm… I just wanted to rant about something. I woke up today fed up (already and that too after having a good weekend) with the monotony. I’m working on updating the Linux Kernel Module Programming Guide to reflect changes in the kernel version 3.x. But its getting drier by the minute because I really don’t have anyone to discuss things with. I have the Internet Relay Chat but a real human is better than chatting with a person sitting at some other corner of the world.

The last few months were extremely happening. I got a new job, I made a friend (the girl I wrote the blog for), I switched to a new city and I had shit loads of research to do… happiness in short. Right now, I have a job (its no longer new), I lost her, research has reached a roadblock and I really don’t feel like exploring much because… well, I don’t get time. At least I have my poison to go through the night. I lost my music collection and with it died all the humanity. I have my guitar but due to lack of skills/knowledge that too is getting boring. Haaa… I know things will look up soon. I have much patience.

Sionara my good folks (lol… “good”.)


The A20.


Hola mi amigos! Life’s been going smoothly since my last article. After a long time, I did a brilliant hack that I’d love to share. Whats so brilliant about it? Well, I got an Allwinner A20 based Android tablet and I dual booted Ubuntu 12.04 LXDE on it. Very hacky, very time consuming but you’ll get to learn about the system quite a bit.

Well, lets start with a rooted Android tablet running on an Allwinner A20 processor. This processor is based on ARMv7 core. Assuming that your tablet is rooted (check XDA for rooting methods or just Google it. I personally used vRoot to root my LG E450), lets pull out a file from the device. On a Linux box (mine is Mint Nadia) type:

# adb devices
// prints a list of attached devices. Hopefully, you have one device attached.
# adb shell

mkdir /mnt/tmp
mount -t vfat /dev/block/nanda /mnt/tmp

# adb pull /mnt/tmp/script.bin

Now, for the starters, what is this “script.bin“? It is the device configuration file. Allwinner does this because this is a smart way of tweaking the Linux kernel without having to recompile the kernel. This is very cool. You can tweak video resolutions, general purpose IO pins etc. I’ll R&D some more into this and let it out here.

The Allwinner A20 is based on the ARMv7, so to compile, rather cross compile, the code on some other (x86) architecture, you’ll need the GCC ARM compiler and some other tools. This will install the GCC compiler and some other tools (that you may already have).

# apt-get install gcc-4.7-arm-linux-gnueabihf ncurses-dev uboot-mkimage build-es

Allwinner has their own bootloader that they use in their SoCs. It sets up a basic a structure to load and boot a Linux kernel. ON A SD CARD! So now, we clone the git of U-Boot and manually build the source. Pretty. Fucking. Cool.

# git clone -b sunxi

got it? Now, cross compile! 😀

# make a20-olinuxino_micro ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

The interesting thing is a20-olinuxino_micro. Open the cloned directory and surf to boards.cfg. Open it. There you will see how many ARM processors U-Boot supports. This parameter to the `make’ command says that the compiler should compile the code according to the A20 architecture.There are many other boards (RPi being eyed upon) that you can hack. If you have an ancient laptop like mine, you can go and have like 15 cups of coffee and roam around for a while and stretch so much that you tear yourself apart. Because compilation will take time.

Allwinner has their own version of embedded Linux called SunXI. We have to compile it to generate a bootable image (uImage) that will boot the actual kernel. The booting process is as follows: (please correct me if I’m wrong)

  • U-Boot loads the `uImage’ from the SD card to RAM
  • uImage deflates the actual kernel and sets up parameters to boot the kernel.
  • The kernel is loaded from an ext3 partition on the SD card and since it is (will be) compiled for ARMv7, it just works.

Clone Allwinner’s SunXI. Fire this command:

# git clone

Now, again we cross compile. Before that, we have to tell the kernel that we are going to compile it specifically for the A20 architecture. If you have compiled kernels before you’ll know that arch//configs has configuration required for many architectures. Open arch/arm/configs. There you will see many device configuration files. They define basic kernel setups to compile kernel for a particular processor. For the A20 processor, we have to use sun7i_defconfig. It will set up the kernel according to A20 processor. Again, I’ll play with it in coming weeks and let you know what it actually is. Fire this command. I assume that your PWD is the cloned directory (linux-sunxi).

# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sun7i_defconfig

We have to now compile the kernel image. The GCC compiler is very efficient. You can specify number of processors to be used while compiling the source. Again assuming that your PWD is linux-sunxi, fire this:

# make -j2 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage modules

The `-j2 ‘ option tells the compiler that I have two cores in my host processor and it should use both the cores. If you have 4 cores, you can say -j4… fucking awesome. The above command compiles the kernel and generates kernel image and all the essential modules that the kernel requires. Again, go have some coffee and take a walk with your girl… this will take time. Much time.

That being done, we have to now install the compiled kernel modules. Fire off:

# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j2 INSTALL_MOD_PATH=out modules_install

This will install the compiled modules in a directory called “out”. If you open this directory, you’ll see that the compiled modules and firmware are generated. We will copy these files to a stock Ubuntu kernel (hang on!).

Buy/get/borrow/steal a 4-8GB SD card. We will partition the card and install the kernel in it. To partition the card, insert it into your laptop’s (I have a laptop so…) SD/MMC reader and do: (on my Mint Nadia, the SD card is shown as /dev/mmcblk0, type fdisk -l to see what your SD card is called in /dev)

# fdisk /dev/mmcblk0
Command (m for help): n
Partition type:
p (primary...)
e (extended...)
Select (default p): p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-7744511, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-7744511, default 7744511): +16M

This partition will later be formatted as a vfat partition and will save the script.bin and the uImage. Similarly, create another partition that will store Ubuntu Linux. You may optionally create a swap space… I didn’t so I skip this step.

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
Partition number (1-4, default 2):
Using default value 2
First sector (34816-7744511, default 34816):
Using default value 34816
Last sector, +sectors or +size{K,M,G} (34816-7744511, default 7744511):
Using default value 7744511

Cool… write the changes to your card using the `w’ command in fdisk prompt. We now format the partitions. First partition will be vfat and second will be ext3.

Note that after partition, my sd card looks like this:

Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
4 heads, 16 sectors/track, 242560 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            2048       34815       16384   83  Linux
/dev/mmcblk0p2           34816    15523839     7744512   83  Linux

To format the partition then, I fire the command:

# mkfs.vfat /dev/mmcblk0p1 // format partition 1 to vfat
# mkfs.ext3 /dev/mmcblk0p2 // format partition 2 to ext3

Awesome, now lets dd. We dd because to write the bootloader (U-Boot) we have to copy data block by block. We are not copying a file, we are actually, in a way, writing the firmware on the SD card.

# dd if=u-boot-sunxi/u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 bs=1024 seek=8

When you compile U-Boot, you get “u-boot-sunxi-with-spl.bin”. No I know not what it really does (to be honest, I don’t know what SPL is). Note that I’m NOT writing it to a partition (its in bold).

Now download Ubuntu LXDE from here. Mount partition 1 and copy script.bin and uImage.

# mount /dev/mmcblk0p1 /media/code-ninja/uboot
// I assume that you're in your Root Home directory and script.bin is in PWD
# cp {linux-sunxi/arch/arm/boot/uImage,script.bin} /media/code-ninja/uboot

Now mount the second partition and untar the downloaded Ubuntu 12.10 in this partition. You now have a ready to boot Ubuntu on the SD card. Remember that you installed modules in a directory called “out”? Copy everything from that directory to Ubuntu’s “/lib” like:

# cp -r linux-sunxi/out/ /media/code-ninja/Root/lib // I call my Ubuntu ext3 partition "Root"

Now the hackiest part. We have to configure the installed OS before we can start using it. This version of Ubuntu is devoid of any UI or other good things. We will chroot into it and install. But the catch is, it is compiled for ARM architecture… how will you run it on a x86 machine?! The solution is: qemu-arm-static.

This is a static version of the QEMU virtual machine and is used to run a command line OS without having to start the full-fledged emulator. From your host machine, do this:

# cp /usr/bin/qemu-arm-static /media/code-ninja/Root/usr/bin

Now, lets set up a basic chroot environment and login to our Ubuntu. Lets hack:

# mount -t proc /proc /media/code-ninja/Root/proc
# mount -t sysfs /sys /media/code-ninja/Root/sys
# mount -o bind /dev /media/code-ninja/Root/dev
# mount -o bind /dev/pts /media/code-ninja/Root/dev/pts
# chroot /media/code-ninja/Root
root@GeniuSisMe:~/# // I'm in!

Now just install whatever you want (language packs, browser… make your pick). You can install LXDE by saying:

# apt-get install lxde-core // I haven't done this, so no GUI for me... yet.

After you’re satisfied with your build, plug in the SD card into your tablet and boot to enjoy Ubuntu!

Following are the screen shots: Thats an Allwinner Pad.

Linux booting on Android A20 tablet.

Linux booting on Android A20 tablet.

The signature Penguins of Linux! Pretty cool, eh?!

Tell me how your dual boot goes! Till then… Sionara!

May the force be with you.


A (very) Moody Lamp.


So I was like very much in love with the weather today. I really like winters, especially winter nights. I have one too many memories to associate winter nights with. What I really like about winters is the change in mood. I become mellow like low hanging fog. I really like the silence of winter nights, I just sit there in my veranda taking small puffs of my poison alone with my own thoughts *Bandeh*. The moodiness of it all is very awesome. So I thought I should compliment this very lonely and moody night with something.

Well technically, it is a very easy, 1 hour coding session. A bit of PWM magic and some basic Android. The heart of it is the awesome Arduino Uno rev3 and RedBear Labs’ Bluetooth Low Energy module. The concept is a home automation device. You put on bluetooth on your phone and enter your room, the mood lamp welcomes you with a personal message and then you can set red, blue, green colors and make your own colors according to your mood… all through bluetooth. The device also acts as a “beacon”… umm I’ll explain this later.

Right now, the weather is very awesome here. There is slight wind blowing and the Psithurism (I learned this word today, it means rustling of wind through trees) is very relaxing. A slight chill on the spine and mellow thoughts oscillating (this is awesome) with every beat. After having a long day, such a relaxation is very welcoming. I just wish if I could have a welcoming partner who could melt in with me and be my mood. What else could be better than colors in such a case. The eternal light of infinite colors that burns inside every memory you have.

Memories are colorful but the colors are mellow, you miss them. “That was some shit I did… *slight sad smile*”. You look at them through different shades. Some memories are blue and sad or you are green with jealousy or maybe yellow with some confused times. It is life. You had someone in your past who understood your every emotion. Who was there when you needed someone the most but now they are just colorful memories. The time gone by… the time you think about on such silent nights. The time when lights were brighter. The “grass”… was greener.

So basically, the design of the mood lamp is very simple.

That blue one is my Arduino Uno. The red one is the BLE Mini from the Labs. The white one is the bread board and that small black one is my Philips Go Gear Raaga (cool shit that is… the headphones that came with it are very awesome, brilliant bass *this sounds very cool*). I studied the implementation of the Android app that you have to download from RedBear Labs’ site (linked above). It is very simple. They have made a service and your app uses that service to communicate with the BLE Mini chip. I tweaked the app little bit and added two seek bars. I’ll show the code:


PWMSeekBar = (SeekBar) findViewById(;
        PWMSeekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

            public void onStopTrackingTouch(SeekBar seekBar) {


            public void onStartTrackingTouch(SeekBar seekBar) {


            public void onProgressChanged(SeekBar seekBar, int progress,
                    boolean fromUser) {
                byte[] buf = new byte[] { (byte) 0x02, (byte) 0x00, (byte) 0x00 };

                buf[1] = (byte) PWMSeekBar.getProgress();


The app (the concept is so cool that I guess I’ll generalize for all my future apps), uses unique commands to control different aspects of the Arduino via bluetooth. The above piece of code defines a byte array called buf. I’ll explain that with the Arduino code later. After setting the byte array, it simply transmits the command. characteristicTx is initialized as one of the services provided by the BLE Mini firmware (I’ll touch on that towards the end).

The Arduino code is very clean too.

#include "Boards.h"
#include <ble_mini.h>

const int pin = 4; // lets stay with pin 4.
const int pinMissed = 8;
byte buf[] = {'N','I','N','J','A'};
int incoming;
const int R = 9;
const int G = 10;
const int B = 11;

void setup() {
  BLEMini_begin(57600); // start the BLE device
  // Serial.begin(57600);
  pinMode(pin, OUTPUT);
  pinMode(pinMissed, OUTPUT);

void loop() {
  while(BLEMini_available()) {
    byte cmd = BLEMini_read(); // read command.
    byte toggleState = BLEMini_read();// read 0 or 1.
    byte extraData = BLEMini_read();
    switch(cmd) {
      case 0x01:
        switch(toggleState) {
          case 0x00:
            digitalWrite(pin, LOW);
          case 0x01:
            digitalWrite(pin, HIGH);
            BLEMini_write_bytes(buf, 5);
      case 0xA2:
        switch(toggleState) {
          case 0xA1:
            digitalWrite(pinMissed, HIGH);
          case 0xA0:
            digitalWrite(pinMissed, LOW);
      case 0x02:
        switch(extraData) {
          case 0x00:
            analogWrite(R, toggleState);
          case 0x01:
            analogWrite(G, toggleState);
          case 0x02:
            analogWrite(B, toggleState);

Here we see the concept of unique commands. The commands in the app (after I hacked it) follow a pattern. The first byte is the access byte. It signifies which feature of our mood lamp we need. I have made 3 features. A beacon, which can detect your presence and start communicating with your phone. A incoming/missed call alerter. And a bluetooth controlled mood lamp.

The second byte is the state we want to put that feature in at a given moment. The moment the app connects to the BLE Mini, it sends its presence in the form of:

buf [] = {0x01, 0x01, 0x01};

What this means, according the Arduino above, I should put on the LED on pin 4. It then sends a custom message to the phone. The app shows it as a notification in the status bar. But we cannot send a message every time we light up pin 4. The third byte in the command is meant to control that. Only when it connects, it sets the third byte as 0x01. The “extra data” is meant to control these tiny features of the Arduino.

What I really like about a winter night is the time I get alone with myself. Once in a while, I really like to revisit those long forgotten and deeply buried memories. The slow rumble of the trucks passing by on the highway bring back those cold and harsh nights that I spent in utmost misery *I’m the highway*. And slowly grooving with my poison and the music it all seems a colossal kaleidoscope of colors. Some so harsh and striking that they blind me, some so mellow and sorrowful that I’m filled with emotions. Some so crazy that make me think of all the stupid stuff I did. Some are black, some are silent… and most of them are like the winter night. Deep, dark and mysterious. Those are mine. The moments I had. The colors I have seen. Those are mine.

I remember that girl who was kind enough to hold my hand and ask me who I was. I remember those mellow colors of the evening that her smile would brighten. I remember that red color of her irritation, the cool teal color of her touch. The maroon of her unsaid words. The bright yellow of the sun on her face. The gray of her sad smile. *no… only she and nothing else matters*.

I feel the blue of her absence. I feel the green of my envy if she ignores me. I feel the playful orange of her laughter when I hear voice on my phone. I feel the purple of my longing, craving for being with her. I feel the violet of my helplessness of loving her.

I’ll put up my rendition of the Labs’ Android app on Git soon. As another example, I’ll explain how I managed to add the missed call/incoming call alert feature.

telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);     
        telephonyManager.listen(new PhoneStateListener() {

            public void onCallStateChanged(int state, String incomingNumber)
                     //  React to incoming call.
                     // number=incomingNumber;
                      // If phone ringing
                     if(state == TelephonyManager.CALL_STATE_RINGING)
                         byte buf[] = new byte[] { (byte) 0xA2, (byte) 0xA1, (byte) 0x00 };
                       // If incoming call received
                     if(state == TelephonyManager.CALL_STATE_OFFHOOK)
                         byte buf[] = new byte[] { (byte) 0xA2, (byte) 0xA0, (byte) 0x00 };

                     if(state == TelephonyManager.CALL_STATE_IDLE)
                         // do something here
        }, PhoneStateListener.LISTEN_CALL_STATE);

I used the Telephony Manager class. I listen to the current call state and set the appropriate commands. If there is an incoming call, the command byte is set to 0xA2 which maps to controlling of pin 8 on the Arduino. If the user answers the call, the light is unset notifying that the user has attended the call. Else, if the user did not attend the call or dismissed the call, it is a missed call and the LED will keep on glowing.

The slight chill of the winter night makes you think about yourself. You are one with yourself *Journeyman*. You think about the sea green memories of your mistake. You think about the bright brownish streaks of the things to come. You feel the pink of the love your soul-mate.

The cold low lying fog cries light gray tears of that faded love for someone once very close to your heart. The black sky makes you think of all those times when you were alone and desperate. And the white spiral of the smoke from my burning poison reminds me of that one forgotten day where, once, I had nothing and no one. Each memory I have has a different color with it. Some good and worth seeing once again and some are so grotesque that I’d never bother to see them again.

Those are my experiences the different shades of life that I have seen and what is better than a moodily lit room where I lie alone with my thoughts on a cold winter night.

The following are the pics of my functioning mood lamp. I’ll put up a video too tomorrow along with the Android app.

20131220_021624 20131220_021604 20131220_021530 20131220_021332 20131220_021156 20131220_021104

Well that was quite cool and well executed. It was a fun project. Something I could play with using my phone. Next step would be to implement something better. I’ll work on interfacing an OLED display panel that will display a welcome message and all your notifications and let you play with LEDs to set your mood and many other good stuff. A whole room controlled by bluetooth in your phone.

May the force be with thee and all the memories you have.


UPDATE: you can find the app here. Make sure you have Android 4.3 or higher as Bluetooth Low Energy is only supported by Android 4.3 or higher.