Wednesday, December 15, 2010

Sony VAIO Camera Driver for Ubuntu

After installing Ubuntu and configuring it to look like windows, one thing that was really lacking was the web cam driver, I could not do video call from Gmail. This time with little easy, I found a link which help to install the driver easily.

First check which is your camera, by typing in the command lsusb, which shows something below.
Bus 006 Device 002: ID 045e:00a4 Microsoft Corp. 
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 005: ID 044e:3012 Alps Electric Co., Ltd 
Bus 003 Device 004: ID 044e:3013 Alps Electric Co., Ltd 
Bus 003 Device 003: ID 044e:3010 Alps Electric Co., Ltd Bluetooth Adapter
Bus 003 Device 002: ID 044e:3011 Alps Electric Co., Ltd 
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 05ca:1839 Ricoh Co., Ltd Visual Communication Camera VGP-VCC6 [R5U870]
The camera is from Ricoh Co. Ltd, VGP-VCC6[R5U870] 


The packages provided (both source and binary) include only the loader software and do not contain the microcode, whose copyright and license status is unclear. Instead, a simple shell script is provided that can download and install the microcode directly from the upstream repository.

Installation
========
1. sudo add-apt-repository ppa:r5u87x-loader/ppa
2. sudo apt-get update
3. sudo apt-get install r5u87x
4. sudo /usr/share/r5u87x/r5u87x-download-firmware.sh

(Step 1 only works on Ubuntu 9.10 and newer. On 8.04 you will need to add this PPA to your APT sources manually.)

Supported hardware
================
05ca:1803 Flybook V5
05ca:1810 HP Pavilion Webcam
05ca:1835 Sony Camera VGP-VCC5 (used on Sony Vaio SZ laptops)
05ca:1836 Sony Camera VGP-VCC4 (used on Sony Vaio FE laptops)
05ca:1837 Sony Camera VGP-VCC4 (used on Sony Vaio FZ laptops)
05ca:1839 Sony Camera VGP-VCC6 (used on Sony Vaio CR laptops)
05ca:183a Sony Camera VGP-VCC7 (used on Sony Vaio SZ and TZ11 laptops)
05ca:183b Sony Camera VGP-VCC8 (used on Sony Vaio FZ laptops)
05ca:183e Sony Camera VGP-VCC9 (used on Sony Vaio FZ laptops)

Hope this helps !

Monday, December 13, 2010

Make Ubuntu look like Windows 7 (Windows 7 theme for Ubuntu)

Most of my time on my laptop is going to be on Ubuntu-10.10 from now on. But I am a hard core fan of Microsoft and its Windows OS. The best ever OS you can ever have on your personal laptop at this point of time in my opinion for 100s of reasons, but whatever is the case when you want to get into learning mode, things are in favor of Linux, as its open source and you can download, modify, configure and compile your own kernel. and write your own drivers etc. 

So while I am inside Linux, I don't want to miss the familiar look of Windows 7, So I spent some time to set my Ubuntu look like Windows 7, and there is lot more you can do, but I want to keep it to the minimum and internally it should have the Linux touch to it. So here is the list of things I did, and if I add any more I will update in the Updates section.
  1. Install emerald theme manager, and download Windows 7 theme for it.
    goto synaptic theme manager, and search for emerald and install it and all dependencies. Download the theme for windows 7 from here. Open emerald theme manager and import the downloaded theme. Alt+f2 -> type in command emerald --replace
  2. Move the task bar down, and delete the other bar, which is having minimum buttons, (don't worry, you are not going to loose it forever, its configurable)
  3. Add emerald to start up when Ubuntu starts, same command as above.
  4. Goto Themes, customize, change Icons to Windows 7 set of icons, which are already present by now in the Appearance settings.
  5. Set a bright windows 7 wall paper.
  6. Press Alt + F2 -> type in gconf-editor, goto apps->nautilus->Desktop, and look for the trash_icon_visible and check the box beside, you can also add other icons to desktop like computer etc, I don't like My computer icon on my desktop !
  7. Download the task bar background image from here, and change the task bar settings to put this image as the background image.
  8. Download the Show Desktop background image, and add code for it. The code looks something like this,  You may have to install wmctl package for this.
  9. #!/bin/sh
    if wmctrl -m | grep "mode: ON"; then
    exec wmctrl -k off
    else
    exec wmctrl -k on
    fi
  10. You can change the three menu task bar with single icon start button type task bar, but removing that panel (right click - remove) then add to panel Main Menu. 
  11. You download the Windows 7 icons set from this link, and apply it by drag and dropping on the change themes dialog box.

You are done !, now your desktop should look something like this, its more of windows 7,  with a touch of Linux for the menus. I have referred to these two sites for this make over, and some more from Google! Other things explained on these blogs, I found unnecessary for me at least.


Comments are welcome !

Disable Syntax Error Check in Eclipse

Eclipse underlines when your code does not match the syntax rules, which is done in the CDT parser, for lot of reasons you end up highlighting most of your code as syntax error and its a pain to see the code in between these high lights, I wanted to disable it for god's sake! and could not find an easy menu option to do tat. After Google-ing a bit, I found it can be by un-checking these options shown in the below pictures.


Goto Windows->Preferences->General->Editors->Text Editors->Annotations->C/C++ Occurrences, and uncheck all the boxes on the right side and apply ! Hope this helps !

Sunday, December 12, 2010

Compile Device Driver for Linux in Eclipse

There is an easy way to compile device driver in Linux using eclipse, once its been setup life becomes much easy, as you don't have to switch between the editor and the command shell every time you need to change something,

Here is the screen shot of my project, Look at it carefully, all you need to add to the project are main.c and a makefile. rest are the result of compilation. makefile will only contain one line obj-m := main.o


Most of the things remain same for the simple C project as mentioned in the previous post, after creating the project, you need to change the command to build the project as,

make -C /usr/src/linux-headers-2.6.35-22-generic M=$(PWD) modules

The path given above is my linux kernel header file path, change to yours accordingly. After this, you set the build directory to the directory of your source code for device drivers. And in the behavior tab, remove the all from build command line, other wise it will crib saying could not find rule to build all !! 

Thats it, you are ready to use the Eclipse IDE for device driver development, all the best !


Compiling Linux Kernel in eclipse, and debugging using QEMU

After I have started working with this eclipse IDE, I came across an article in a blog, and found it very interesting. The fact that compiling Linux kernel is fairly easy on the terminal does not need it to be compiled somewhere else, but then the fact that once configured, if you are using eclipse as an IDE for modifying and browsing the source code, it would be beneficial if you can directly build from there.

The procedure is very simple in fact !

Download the latest version of kernel from kernel.org website (ftp) and extract it to where ever you want to. The latest version now is (2.6.36.2), so download the linux-2.6.36.2.tar.gz file from ftp, and copy it to you home directory (in my case prasad)

tar xzvf linux-2.6.36.2.tar.gz

Now build the kernel, after configuring, and make sure it builds fine when built from the command prompt. Now its easy to integrate this environment into eclipse, this is almost same my previous post of building a make file based c project to build in eclipse. But it just looks complicated because its kernel.

Create a new make file based C project ans select the kernel source directory to be your project directory and select other tool chain option for tool chain. Click finish, I hope you have disabled indexing and auto build. 

Now, go to project properties and update the build directory path, and build command as needed, if you are building kernel in the same directory as the source code, you don't have to change anything here, but in case out put directory is different then just update the command as make O=/build/linux-2.6-xxx and build directory to /build/linux-2.6-xxx.

If you were building for a different target other than x86, update the Makefile of linux kernel with the CROSS_COMPILE and ARCH, or you can as well give them in the make command also.

Now click build all, you can see that eclipse IDE runs the commands set and outputs of the compilations are seen on eclipse console. if there is any error, you can just double click and the corresponding source code is highlighted (this is the best part of using an IDE)

Now you are ready to connect to QEMU for debugging the kernel, locate you bzImage/zImage, (kernel binary), run the kernel in QEMU, refer to qemu manual for how to do that (!?)

for your reference, in case of x86 kernel to be run on the QEMU type in this command (I assume qemu is compiled and installed)

qemu -hda /dev/zero -kernel ~/linux-2.6.32.2/arch/i386/boot/bzImage -s -S

-s -S options make the qemu wait on the TCP connection at port 1234 for the gdb debugger to connect. 

Now in the eclipse IDE, go to Run->Debug Configurations, double click on C/C++ application, a new configuration will be created. Browse the project, and in C/C++ application field browse the vmlinux for your kernel, and set the path for it. In the debugger tab, select the gdb-server, and set the stop point to be start_kernel. In the connections tab, set it to TCP and 1234 port number, and you are ready for debugging. 

The whole thing is explained in detail in the blog post here, Thanks for the wonderful information, it was really helpful for me. I myself debugged kernel using this approach in eclipse, if anybody faced problem let me know, I am glad to help you out.

Saturday, December 11, 2010

Compile C/C++ code in eclipse using makefiles

In Linux, usually compilation is done using makefiles, run in command shell. I use to work on Linux kernel, and in such cases, I use to setup a Samba server for editing and source code browsing was done in windows. But then now I am using only one PC, which is a dual boot for windows and Ubuntu Linux, so I cannot have samba server. I was looking for a IDE in Linux, and found eclipse to be very useful.

I wasn't very familiar with the eclipse IDE and I was trying to setup the compilation using makefiles, initially I had some hiccups but could later configure it easily after generating an example C project from it and following similar methods to write the makefiles.

Here is the method to do it, so it might come handy to you in case if you are trying to use eclipse IDE for compiling C/C++ project using make files.

First create a empty C/C++ project, makefile project, and select the --other tool chain--. keep the project settings to default, as shown in the below figure. Click finish.


Once project is created, as a C file, and a 'makefile'. The makefile tells the make program about how the project should be built, I am giving here the sample make file for the simple HelloWorld.c, which you can further extend as per your use.

Wednesday, December 8, 2010

Setting up Dual boot for Windows 7 and Ubuntu 10.10

Recently I have updated to windows 7 and so, I have dumped my ubuntu (8.04), and did not install until I actually needed one for some programming purpose. Now it was time for installation. It was very straight forward last time when I did it, so did not bother to check any how to do it online, and more over installing operating system wasn't a new topic for me, and have done dual booting many time before also. 

But this time the purpose was different, I wanted to make it install on an USB with persistence, I got some link to do that, it was very promising, but when I ran from that, ubuntu was crashing very often, most of the programs were not working as expected, so then I thought of installing it on hard disk after confirming that the iso image I downloaded is good by booting it on a virtual machine.

When started with installation, there was surprise for me, the disk utility was very confusing, it was asking too many questions as to whether the partition should be from beginning or at end etc, and also where the grub boot loader should be installed etc. So I was a bit confused and installed the boot loader on the same partition on which windows boot driver was installed, and it was a mistake, and things did not work, and windows also did not boot, I could only boot ubuntu. But then I was sure that the windows installation is intact, so I put the windows disc and then repaired it, and it worked for me. But because of some updates I started getting error on windows saying that "you are victim of software counterfeit.

I gone through web pages now to find out what needs to be done for making a dual boot with Windows 7 and Ubuntu 10.0, and found that Windows 7 messes up with the grub boot loaded when windows is updated, so we need to make sure that boot loader should be installed on the same drive as boot partition of ubuntu, and then, using EasyBCD program in windows we can configure windows boot loader to boot Linux from the ubuntu installed partition.

I had problem partitioning 4 partitions for linux using their disk tool, so I did that from windows disk management tool, and then during installation selected them, and it worked fine for me. The partitions you need are boot (500mb, primary, ext4, /boot), root (3gb+, logical, ext4, /), swap (1gb), home (remaining, how much ever you wish, ext4, logical). You are done.

EasyBCD is a free software and easy to use also, download, install and configure using the easy to use user interface. Hope it helps. I have not put any screen shots as this much details seems to be enough, and if needed refer to LinuxBSDos for a detailed explanation. If you face any problem let me know. 

Run Chrome OS on your Laptop from USB

Recently I have run android on laptop, and it was meant for mobile. Google is dedicatedly developing a operating system for netbooks/notebooks. It is Chromium OS or Chrome OS. If most of the time you are spending on internet, and most used program on your PC is a browser, and you want to get online as early as possible from the time you pressed the power button then this is something you need to check it out.

You need to have a spare USB stick, with minimum of 4GB space, and a laptop which can boot from USB. People have developed the image of Chrome OS for usb and uploaded in torrent, you can download it from the torrent.


There is small utility tool provided along with the image, it is called Windows Image Writer, its free and open source, used to write data into USB. What it does it it creates partitions in your usb disk, and then writes the data on the USB, so once written you will see that 3GB space is missing from your USB stick, dont get panic, you can restore it, refer to my blog about deleting oem partition, follow similar procedure, and with the help of windows disk management tool available in computer management section of control panel you will be able to recover it.

It worked for me very well, infact the booting was not that fast, it might be little faster than the ubuntu version 8.04 which I was running, but then we can expect it to be faster once the full version is released. The best part is you can login with your gmail id, if connected to network, otherwise use chronos and password to login. You can see that wifi can be setup, it was working for me, browsing is same as on a chrome browser in linux, and nothing more, only browser in the whole operating system. Have fun trying it out !

Tuesday, December 7, 2010

How to install Android (x86) on Laptop

Everyone is talking about android, the mobile OS from the internet giant Google. It is an open operating system for mobile phones, not meant for laptops. But already people have started porting the code to x86 machine and succeeded in booting laptops. 

Keeping in mind that, it is not a full fledged porting, depending on your laptop many things may work, and it may also turn out that it may not boot as well, so the call is yours, but nothing harm in trying out. Because the method I am going to explain you is using an USB thumb drive, so in case if it does not, just format the disk.

You need to go to Andorid x86 project website and download the latest stable release iso image. You need UNetBootin software to download this install this ISO image on your thumb drive, you can download it from here.

You need to select the ISO option and give path to the .iso image you have downloaded, and make sure you select the correct device for USB, otherwise your data on hard disk will be wiped off. The example screen shot is as shown below.


Once the OK, is clicked, download will start, after the downloading to USB is complete, change the boot setting in BIOS to boot from USB and you are ready to boot Android x86, have fun. In my case, I was able to access my wifi router on my android, and it was fun browsing in Andorid. Unlike on virtual machine, the speed is really good on a laptop.


This is the screen shot of what I ran on my laptop, It's the mobile desktop scaled up. Still its a fun !