Monday, August 29, 2011

Moving to wordpress

I revamped my homepage  by moving it to a hosting provider and migrating to joomla. Fortunetly or unfortunately, Joomla has very good plugins for wordpress and not for blogspot. These plugins allow me to post at my wordpress blog while updates will be made available instantaneously at my home page. I have pulled all the content from flyingtux.blogspot.com to yetanothertux.wordpress.com. Do continue to visit me at

http://yetanothertux.wordpress.com
http://sarin.net.in

Friday, June 24, 2011

QT keyboard events

I am here to make a quick post. I searched for this at many places but could not get the exact solutions. Every message I could read sounded cryptic.

Scenario:
I want to generate fake keyboard events and send to QWebView class.

Solution:
Extend this class to have slots for signals. Connect it to a signal that can pass an ascii character.

Issue:
Keyboard does not have 'a' and 'A'. It only has an 'A'. That means, I cannot directly send any lower case characters using the event (Which is not correct)

Solution:
The solution is simple. The constructor of QKeyEvent can take QString as one of its argument. The signature is as follows:

QKeyEvent ( Type type, int key, Qt::KeyboardModifiers modifiers, const QString & text = QString(), bool autorep = false, ushort count = 1 )





Even if we don't pass the QString, it will work. However, by passing the QString, we can control exactly what will be displayed.
This is how I create my QKeyEvent:


void MyWebView::rcvKeys(int k)
{

char str[2];
str[0]=k;
str[1]='\0';

QKeyEvent *k=new QKeyEvent(QEvent::KeyPress,k,Qt::NoModifier,QtString(str),false,0)

//-----------Pass it to postevent etc
}
}

Sunday, April 24, 2011

Google fined USD 5 million for using patented code in Linux kernel


http://www.bbc.co.uk/news/technology-13168296

Very interesting news. I am still not really sure if this is part of mainline. However, considering the fact that the holder was able to analyse the code and ascertain that it was there in the Google's server's kernel indicates it was surely there on the public domain whether it was a custom piece of code written by Google engineers or not. This is surely something very interesting thing to happen and it would be very interesting to see if Google takes it beyond district court and what exactly happens to this case at the end

/. link: http://linux.slashdot.org/story/11/04/21/2140249/Google-Loses-Bedrock-Suit-All-Linux-May-Infringe

Wednesday, April 13, 2011

Build error on Android rowboat

I was building the code for TI omap3evm and I found that on FC14, I was getting the error from the make file of kernel. It told "Mixed implicit and normal rules". On a bit of googling, I found http://www.mail-archive.com/bug-make@gnu.org/msg06220.html

The file "hardware/ti/sgx/GFX_Linux_KM/eurasiacon/build/linux/omap3630_android/kbuild/../../kbuild/Makefile.kbuild" need to be modified as follows:

Change "all %:" to
all:
    (Build command)
%::
    (Build command)

Sunday, March 6, 2011

Fips opessl

http://olex.openlogic.com/packages/opensslfips

I was cross compiling this. The strangest thing about this is that it cannot be cross compiled. Because, they generate programs, run them, get signature from the programs and use that signature to compile them again!

I did that by little bit effort. What I am now looking at is the possibility of having it compiled inside qemu. Anyway, this is what I did
1. Configure for linux-ppc with compiler, prefix and ranlib specified during this step
2. Find and replace ar using powerpc ar in all makefiles
3. Make and when it breaks during sha1 calculation, replace the binary that does sha1 caculation with an x86 equivalent and complete this step
4. Make again and when it tries to execute openssl/tests, replace the necessary statements in fipsld with read function and supply the signatures for each program after taking them to target and running them there once
Well, another issue that I noticed with this package is that it does not behave well with parallel builds. I will post here again if I can compile this in Qemu. I am planning to use FC12 ARM/PPC for this.

Saturday, February 19, 2011

Middle men

http://www.pcworld.com/article/219776/rim_nokia_docomo_dodge_googles_dumb_pipe_menace.html

OK, losers consortium has taken shape. But, what are they driving at? The whole discussion is centered around how to enable the service provider to be the middle man and extort money from poor end user. With what face is Nokia and RIM going to face end customers now? A smart phone today costs 20-30k (INR). After taking such huge amounts from end customer, they want to create means for the letting the service provider loot the customer! Shame on them.

May be your service provider is subsidizing your phone. However, that reminds me about the phones (LG-LSI110) that Reliance used to sell for 3K! I am pretty much sure that it didn't have electronics and plastics worth even Rs. 1000. However, the phone came with the note that its cost is 10K and it is owned by Reliance. This was about 7 years back. I doubt there will be any change today. Anyway, would you prefer to get a smart phone at a subsidized cost when you pretty well know that this amount will be recovered from you through monopolistic practices of the service provider?

Well, I recently used a Galaxy tab to download and test an application (ZXing). The ability to customize your smart phone by pushing an apk to it after enabling USB debugging was probably the only reason needed for paying 30K for that device. Well, Nokia, go back and make some good Android phones and I will buy them (Yes, I would prefer to buy android from Nokia over any other vendor) when they become available.

Sunday, January 30, 2011

Mozilla Dash

I am on FF 4 beta 10 and I installed this addon. It was highly hyped at many sites. However, it was a bit of disappointment.
Why?

  • It is not intuitive enough
    • Even after being a heavy internet user, I had to struggle to get back my tabs
  • It does not show the url
    • This might be a good thing that you can search and find links. But, how do I make sure that the search result is correct and I am on the expected link? This is a problem especially when I am on sites that do financial transactions. 
  • The UI was not up to the mark. I could see that the fonts of menu items were cut at bottom half
Well, so, whats good about it? Its still experimental. We can hope that it will get improved :)

Monday, January 24, 2011

.PHONY

For a long time, I used to look at .PHONY targets in makefiles and wonder how useful those targets were. Today, I found the usefulness while playing with prelink (more on prelink later).

I created the following files and folders while doing this:

[root@sarin prelink]#ls -l
total 20
drwxr-xr-x 2 root root 4096 2011-01-24 11:14 bin
drwxr-xr-x 2 root root 4096 2011-01-24 11:14 lib
-rw-r--r-- 1 root root   57 2011-01-24 10:41 libutil.c
-rw-r--r-- 1 root root  273 2011-01-24 11:14 Makefile
-rw-r--r-- 1 root root  343 2011-01-24 10:56 prelink.c
[root@sarin prelink]#cat Makefile
all: bin

lib: libutil.c
        gcc -shared -Wl,-soname,libutil.so -o lib/libutil.so libutil.c

bin: lib prelink.c
         gcc -L/root/c/prelink/lib prelink.c -Wl,-rpath,lib -lpthread -lutil -o bin/prog

clean:
        rm -f lib/libutil.so bin/prog

Now, I did a make clean and did a make. Nothing happened. I got the message that "make: Nothing to be done for `all'.". If you notice, in the make file, target all had a dependency on 'bin'. Target 'bin' was dependent on target 'lib'. So, I was expecting that lib will be built first and then bin. But, It did not even try to build bin (I verified this by putting an echo in bin). After a long struggle, I found the reason.

As you can see, 'bin' and 'lib' were the names of two folders inside the current directory. So, make assumed that targets 'bin' and 'lib' where those folders. As these sub-folders were already present in the current folder,  it assumed that there is nothing to be done for target all.

This is the issue that .PHONY target fixes. It clearly tells make to avoid looking at files and folders for these names. I added the following line to the top of the makefile.

.PHONY: all bin lib
Thats it,  I was able to compile the program using my makefile!

Friday, January 21, 2011

Kernel oops

I had to look into a kernel oops recently. This was produced on a ARM machine. It was relatively easy to understand this message. These messages have become much more simple to analyse these days. I am making this quick post to remember one register: LR

LR: This register holds the address to which PC will be set to once you hit return. This simply means, this is the caller of the function where the trouble occurred.

The point where failure happened can be seen by looking at PC. Also, SP points at the current stack location. When I scrolled down, I could see some good back tracing information too.

Thursday, January 13, 2011

plymouth

I have been looking for the source of rhgb and I was not able to find this source. Today, I somehow wanted to find this out and spent some time with yum. Eventually I found that this comes with plymouth (for Fedora-12). I am yet to find out how these two are related. I could see this:

1. There is a /usr/share/plymouth folder
2. The themes are present in this folder
3. There is a default.plymouth file which tells which is the default theme
4. plymouth uses png files to create animation
5. There is a text theme that can be (seems to be) altered easily by changing the ply-text-display.c (Needs to verify this)

Well, more on this after I play with this a bit more. :)

Update-1: Plymouth starts from initrd itself. So, modifying the stuff on the root file system will not help much. It has to go to initrd. I was able to change default.plymouth link in initrd and change from charge theme to text theme without much issue.
Update-2: While working with initrd, I found that fedora is now using darcut instead of old initrd. Will write about it later when I get some time to study it.

Update:
I tried modifying and recompiling the plymouth (version 0.8.0) and tried it on Fedora 12. The file that was modified was ply-text-progress-bar.c. The file can be found in src/libplybootsplash folder inside the plymouth package. I changed two functions get_os_string and ply_text_progress_bar_draw. The first function is very custom made function to read /etc/system-release file and get the OS name and version (Fedora 12). So, though modifying /etc/system-release might work in general, it is simpler to modify the function itself. The second function decides the colors of the progress bar and also the background and foreground color of the OS string. I modified the colors there so that the effect can be seen easily.

The code was compiled and I found that the o/p is present in src/libplybootsplash/.libs/libplybootsplash.so.2.0.0. This was copied to /usr/lib of initrd and I recreated initrd using this command
find . | cpio -H newc -o > ../ply-test.img. Later I gziped it and moved it to /boot (gzip -9 ply-test.img && mv ply-test.img.gz /boot/ply-test.img). I also modified grub config to create a new entry with this initrd. Once I rebooted, I could see the changes in the plymouth screen.

I am currently thinking if I should use this or I should use some graphical theme. May be changing a few functions, I can change the logic of drawing this progress bar and draw some other pattern. But, for changing a graphical theme, I may only have to change the images and that might have a better effect too. Anyway, plymouth seems to be in control and I will now move to something else. I want to revisit the qemu as I found that it is taking about 10 times more resources compared to vmware. I will see if using the qemu from android project gives me any advantage or not.

Friday, January 7, 2011

Compiling qemu on windows

I started doing this today by following this page. However, I was always getting this error that config-all-devices.mak not found. I googled and found some patches. However, something told me that this is not a patch issue. So, I decided to look again and then saw this funny message "-uThe system cannot find the file specified."

This was actually getting caused due to incorrect sort being used. I had the windows programs in my path and a 'which sort' clearly told me what was going wrong.

bash-3.2$ which sort
/c/WINDOWS/system32/sort
A change in path declaration fixed this issue

PATH=/home/lassauge/MyDocuments/Qemu/libusb-win32-device-bin-0.1.12.2/bin:$PATH CFLAGS="-O4 -march=i686" \

to

PATH=../libusb-win32-device-bin-0.1.12.2/bin:/usr/bin:$PATH CFLAGS="-O4 -march=i686" \ 

Anyway, I have not completed the build. Currently I am getting some usb library related errors. Will update this post once I completely compile this.

Edit:

Completed this build. Though the above fix removed the error, it did not create the proper config-all-devices.mak. So, I had to manually create this by running the appropriate command

 cat i386-softmmu/config-devices.mak | grep =y | sort -u > config-all-devices.mak

Again, I got the error that isa vga device was not created. So, again, I manually entered the vga-isa.so as a dependency for target "all" in the Makefile.hw.
Also, it did not pickup the usb library include folders correctly. To fix this, I added the following to config-host.mak
CFLAGS=-O2 -g -O4 -march=i686 -I../libusb-win32-device-bin-0.1.12.2/include

Another issue was the fmod libraries needed absolute path. I changed that also in the configure script. However, usb libraries worked fine with relative path from qemu folder. I think, fmod would have got linked from a sub-folder inside qemu where as the usb lib would have got used from the qemu folder itself. Anyway, I am running the qemu compiled my me :)

Thursday, January 6, 2011

CES 2011

Smart phones -- read Androids :) --, tablets are ruling CES 2011.

http://twitter.com/search?q=%23ces

Not that easy to watch it, hundreds of updates are coming per minute.