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.