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

No comments:

Post a Comment