Friday, October 15, 2010

Linux touchpad subsystem internals

Today I wish to talk about debugging touchpad in ubuntu and debian. Below is a general overview of the linux touchpad subsystem internals. Here I have shown how the x window system interacts with hardware and the various layers involved in the process.


What Happens
Kernel handles the raw data sent to the touchpad and also receives and parses the data from the touchpad. It shields the touchpad and does give access of the raw data to application programs both for the sake of abstraction, security and input device multitasking.

Kernel interfaces with 'next layer' using a 'standard interface' with which only one application can connect. Normally when using a graphical interface the xserver-xorg-input-synaptics will be linked through the xserver. So in GUI xserver will be receiving data from the touchpad. In response the xserver-xorg-input-synaptics will pasre data and re-standardize it according to the format that application programs demand. It employs client server terminology so many client application programs of the xwindow system can receive data simultaneously. xserver-xorg-input-synaptics converts the vertical movement at the right edge and emulates it as vertical scroll and also circular movements as circular scrolling, etc. So your application program will never know that weather they are receiving a scroll from the mouse or from a touchpad. This approach can make the application programs (API) hardware and device independent.

Now two important useful debugging tool for touchpads and all other input devices as well.

evtest - evtest displays information on the input device specified on the command line, including all the events supported by the device. It then monitors the device and displays all the events layer events generated directly from the kernel.

Note X driver grabs the device when active, which means that the kernel only delivers hw events to the driver itself and not any other device opener (i.e.: evtest). You should switch to a VT using Ctrl+Alt+F2 (in ubuntu), then driver ungrabs the device node allowing others to receive events. Now you can access real time events directly from the kernel for kernel related debugging.

xev - Xev creates a window and then asks the X server to send it events when ever  anything  happens to the window (such as it being moved, resized, typed in, clicked in, etc.). Xev send requests to xserver so it acts like a client and the xserver in reply sends back the requested data which is outputs in terminal.

External Links
Use this like to find out how to use these debugging tools and how to debug touchpad issues using these tools.

DebuggingTouchpadDetection - Ubuntu wiki

Saturday, October 9, 2010

Revision Control System

While I was working on my freescale smart car racing project, on the final day of competition the codes were really messed up. I had as many as 40 folders all containing some copy of the code. These folders were named as 1.0, 2.0 as I want through the timeline removing bugs and introducing changes. What happened on the final day was that I was not able to get which copy of the code does not contain bugs while modifying a back date code. So, finally I realised the importance of revision control even for small projects.


The diagram gives a overview of the various categories of the revision control system.



What exactly is a revision control system -  A revision control system is a software management package that will take care of keeping your previous history of the code. When you remove some bugs it will update the source with a so called 'branch' (if no new features are added) or otherwise if some new features are added you will update you source with a 'trunk'. The best thing about all this is that you can revert back your source and obtain a copy of code that you had in history. Besides this it will also take care of necessary documentation of the changes you made to the code so you will never forget what exactly you changed on a back date. This type of revision control is also used in wikis, for which the best possible example is wikipedia, where any user can revert back the changes of any other malicious user and also look at what did he changed exactly.

This type of facility has really broadened the wings of open source software where thousands of programmers all around the globe at different geographical locations contribute merge/sync there changes to the repository and hence come up with a big project.

The best thing about all this is that this all happens in one folder in a very clean environment so you will never mess up finding some source file of you project.

What is a Repository - is a type of storage location on Internet that contain software packages or source files. for example the ubuntu repository contain all packages that can be installed in ubuntu.

This is a overview of what happens during the development process using a revision control system.



I have used google and wikipedia to collect all information that is compiled here to give a overview of the RCS. So if yo want to learn more about revision control system try googling the keywords for a start and rest is yours own stamina to wander the sea of internet.