Multitouch
From nookDevs
Nook touchscreen panel actually supports several gestures (at least Zoom and Flick) and two fingers tracking. Sad to say, but all that features are disabled in stock kernel. Same kind of touchscreen (capacitive panel made by Synaptics) is used in HTC Sense and its driver is in mainline Android kernel for a long time. I succeeded with back-porting this driver from 2.6.34 kernel and merging it with B&N driver in Nook 1.2 sources. Active area above LCD display is also covered with touchscreen panel and had a lot of unused space that is now used for additional keys.
Actually in Linux there is almost no way to replace a driver that is built in the kernel, but after some research and with some tricky part it become possible for this particular case. So here is kernel module for 1.5 firmware with multi-touch support.
Contents |
Features
- basic functionality (touch recognition, swipe gestures, Home button);
- two finger swipes are correctly passed to Android (however we don't have multitouch-compatible apps at the moment);
- taps in leftmost and rightmost parts of an active area (above LCD screen) performs KEY_DPAD_LEFT and KEY_DPAD_RIGHT events (can be changed in config);
- two-finger gesture (Zoom) in active area performs KEY_BACK event (can be changed in config);
- swipe gesture is now much shorter and more responsive, also you can swipe in an active area;
- long press in active area calls KEY_MENU event (can be changed in config);
- three-finger touch is also processed as additional button. By default in .kl it set to KEY_SPACE and could be changed in config;
- correct deep sleep code sent to touchscreen on device suspend. That is important and a fixes bug in 2.6.30+ drivers that could cause power leaks;
Sample video
Video featuring multitouch test app among with new virtual buttons in bookshelf and CoolReader:
Bugs
No known bugs at this moment (Dec, 07, 2010).
Installation
1) Put synaptics_i2c_rmi.ko to /system/lib/modules:
adb shell mount -o rw,remount -t ext2 /dev/block/mmcblk0p5 /system adb push synaptics_i2c_rmi.ko /system/lib/modules/
2) Put modified synaptics-rmi-touchscreen.kl to /system/usr/keylayout:
adb push synaptics-rmi-touchscreen.kl /system/usr/keylayout/
3a) Pull file /init.rc from the device:
adb pull /init.rc
3b) Modify init.rc and add insmod after 'on boot' string:
on boot insmod /system/lib/modules/synaptics_i2c_rmi.ko # basic network init
3c) Push init.rc back to device:
adb shell mount -o rw,remount -t ext2 /dev/block/mmcblk0p5 / adb push init.rc /
4) Reboot your device
If driver was installed successfully after reboot you'll be able to use new features. To check if it working correctly you could try scrolling in home screen with single finger and then put another finger on the panel. Default driver ignores such pressure and custom one should respond with a motion.
To roll back to default driver just remove or comment insmod string in /init.rc file.
Downloads
Archive with synaptics_i2c_rmi.ko and synaptics-rmi-touchscreen.kl files:
http://runserver.net/temp/synaptics_mt.7z
Future work
It is also possible to detect zoom direction so we can send two keys instead of one while zooming (i.e. Volume Up/Volume Down). I'm also planning to release an API and short documentation how to support gestures and two-finger motion in Nook apps. Unfortunately, Android 1.5 lacks multi-touch support so some nasty tricks are needed to detect second finger state and position.