Touchscreen and RotateView

Quick update. I tested Pointer Location after rotating view from portrait to landscape using my RotateView.apk. It works fine. Dots appears wherever I touch on the screen. Android system takes care of not only the view style itself but also touchscreen coordinates.

It's a good news for platform developers. Just make sure that touchscreen driver generates correct absolute positions in default view, then Android system takes care of rotation.

Still there is one issue. Calibration. How and who calibrate touchscreen?
posted by 安藤恐竜 at 08:41 | Comment(0) | TrackBack(0) | 日記


Touchscreen Driver - a small improvement

Today, I found myself a bit of spare time and played with corgi_ts.c to make touchscreen better. First, I put a printk line in corgi_ts.c to see what kind of value is passed to Android. The coordinate was in landscape view, origined from top-left. The default style of Android is landscape view. It wouldn't work.

So, I wrote a small patch to swap the coordinate like this;
diff -ur linux-2.6.23/drivers/input/touchscreen/corgi_ts.c linux-2.6.23-new/drivers/input/touchscreen/corgi_ts.c
--- linux-2.6.23/drivers/input/touchscreen/corgi_ts.c 2008-03-18 18:39:56.779191359 +0900
+++ linux-2.6.23-new/drivers/input/touchscreen/corgi_ts.c 2008-03-18 19:44:02.823705338 +0900
@@ -183,11 +183,14 @@
if (!corgi_ts->tc.pressure && corgi_ts->pendown == 0)

- input_report_abs(dev, ABS_X, corgi_ts->tc.x);
- input_report_abs(dev, ABS_Y, corgi_ts->tc.y);
- input_report_abs(dev, ABS_PRESSURE, corgi_ts->tc.pressure);
- input_report_key(dev, BTN_TOUCH, corgi_ts->pendown);
- input_sync(dev);
+ if ((X_AXIS_MIN < corgi_ts->tc.y && corgi_ts->tc.y < X_AXIS_MAX) &
+ (Y_AXIS_MIN < corgi_ts->tc.x && corgi_ts->tc.x < Y_AXIS_MAX)) {
+ input_report_abs(dev, ABS_X, Y_AXIS_MAX - corgi_ts->tc.y);
+ input_report_abs(dev, ABS_Y, corgi_ts->tc.x);
+ input_report_abs(dev, ABS_PRESSURE, corgi_ts->tc.pressure);
+ input_report_key(dev, BTN_TOUCH, corgi_ts->pendown);
+ input_sync(dev);
+ }

static void ts_interrupt_main(struct corgi_ts *corgi_ts, int isTimer)
@@ -267,6 +270,18 @@
#define corgits_resume NULL

+static int corgits_open(struct input_dev *input)
+ printk("corgi_ts: open\n");
+ return 0;
+static void corgits_close(struct input_dev *input)
+ printk("corgi_ts: close\n");
+ return;
static int __init corgits_probe(struct platform_device *pdev)
struct corgi_ts *corgi_ts;
@@ -302,10 +317,13 @@
input_dev->id.version = 0x0100;
input_dev->dev.parent = &pdev->dev;

+ input_dev->open = corgits_open;
+ input_dev->close = corgits_close;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
- input_set_abs_params(input_dev, ABS_X, X_AXIS_MIN, X_AXIS_MAX, 0, 0);
- input_set_abs_params(input_dev, ABS_Y, Y_AXIS_MIN, Y_AXIS_MAX, 0, 0);
+ input_set_abs_params(input_dev, ABS_X, Y_AXIS_MIN, Y_AXIS_MAX, 0, 0);
+ input_set_abs_params(input_dev, ABS_Y, X_AXIS_MIN, X_AXIS_MAX, 0, 0);
input_set_abs_params(input_dev, ABS_PRESSURE, PRESSURE_MIN, PRESSURE_MAX, 0, 0);

pxa_gpio_mode(IRQ_TO_GPIO(corgi_ts->irq_gpio) | GPIO_IN);
It looks OK. Pointer Location applet in Dev Tools works fine. It draws lines between dots where I tapped with a stylas pen. And pressure value is passed correctly. Red bar on the top of following image shows pressure value passed from touchscreen driver.

But. Still touchscreen works only in the first applet. If I switch to Google Map after playing with Pointer Location, touchscreen input is gone. After reboot, I tried Google Map first, touchscreen works.

Anyway, one step at a time.

posted by 安藤恐竜 at 19:23 | Comment(32) | TrackBack(0) | 日記


By the way, what red cylon is?

I often refer the startup screen of Android as "red cylon." Though I'd like to call it Knight Rider, I use "cylon" because of my respect to the gurus like;
o Dump Android emulator root filesystem (yaffs2 filesystem) - Android Developers | Google Groups
From: John Bloom
Date: Wed, 14 Nov 2007 03:42:14 -0000
-- snip --
Update: Even as I type this I'm watching the "cylon" (red moving dot) startup screen on my Zaurus.
You will be amazed if you remember that the first Android SDK was released on Nov 12. It took only a few days for them to reach to startup screen.

But I didn't know what cylon means actually. I googled and found it's a character in Sci-Fi TV program, Battlestar Galactica.
o Cylon (Battlestar Galactica) - Wikipedia

Yep. It is Cylon.

posted by 安藤恐竜 at 18:25 | Comment(2) | TrackBack(0) | 日記


RotateView for Android SDK m5-rc14/rc15

Gee. I forget to release m5-rc14/rc15 version of my RotateView.apk. Unzip following file and copy RotateView_m5/bin/RotateView_m5.apk to android-root/data/app as usual.
o RotateView_m5.tar.gz

It would be a fun thing to try to copy it while your Zaurus or emulator showing the Android Home menu. Right after copy is done, an icon pops up from nowhere.

A bit of story. The same day m5-rc14 was released, I ported my applet from m3 to m5 to see how the porting would be. Since then I work for booting Zaurus up with m5-rc14 all my spare time and totally forget about RotateView.

Cortez has already released his Android m5-rc14 installable image for C3x00, now I guess I better update RotateView too.
o Omegamoon blog - Latest Android m5-rc14 Installation Image for Zaurus SL-C3x00

posted by 安藤恐竜 at 18:15 | Comment(0) | TrackBack(0) | 日記


A better frame buffer driver for Android Zaurus

I studied Brilliant Service's mxcfb.c patch more carefully.
o Android Zaurus: Android on Armadillo - Patch for frickering

An interesting thing is set_par() returns immediately and set_par_init() is introduced. I contacted Brilliant Service and they kindly told me that FBIOPUT_VSCREENINFO in fbmem.c calls set_par() all the time. Then I looked into pxafb.c and found a bit of hardware access in set_par(). It would be problematic.

And there is another possibility of improvement. With the last patch, frame buffer is flipped between two buffers. Changing calculation of DMA address could make it dot by dot panning.

Anyway, I quickly modified the code and it works for me.
o pxafb-patches.tar.gz

Scrolling in web pages becomes way faster. And some issues in updating display are gone. I had problems in navigating on Home menu. First I thought key event issue but turned out to be display updating issue.

The tar file has two patch files.
o pxafb-doublebuffer.patch: patch against vanilla kernel (
o pxafb-oe-doublebuffer.patch: patch against OpenEmbedded linux-rp-2.6.23

pxafb-oe-doublebuffer.patch gives better idea how the implementation is. pxafb-doublebuffer.patch can be actually applied as a patch to vanilla kernel driver.

posted by 安藤恐竜 at 19:01 | Comment(0) | TrackBack(0) | 日記


Android on Armadillo - Patch for frickering

Last month I reported Brilliant Service ported Android to Armadillo-500.
o Android Zaurus: Android on Armadillo-500

It has a minor issue. Flickering. Video driver of Armadillo-500 (drivers/video/mxc/) has pan_display() function, but Brilliant Service found that implementation is not good enough. Display flickers a lot. Finally they pointed out fb_set_par() initializes IPU all the time and come up with a nice patch.

o mxcfb.c.patch
o An article regarding flickering patch (Japanese)

The original kernel source customized for Armadillo-500 can be found in Support page of Atmark Techno.

The change in Android m5-rc14, double buffering requirement, causes a bit of trouble for guys who are working with real targets. Zaurus was one of them. OMAP5912 OSK was another victim. Dirk Behme kindly let me know he also fixed an issue in omapfb_main.c.
o Android on OMAP - eLinux.org

If anyone has trouble booting Android m5-rc14 or m5-rc15 on real target, these patches might be helpful how to implement double buffering support in frame buffer driver.
posted by 安藤恐竜 at 19:26 | Comment(1) | TrackBack(0) | 日記


Improvement of double buffer

Changing DMA address in application context is too dangerous.
Today, I experimented to say schedule_work() in pan_display() instead of changing address at once.
o pxafb-doublebuffer-schedule.patch

It works for me. And it solves a long cycle frickering issue, which might be caused by timing of DMA address change.

Other than pxafb, I find my old qwerty.kl patch works on m5_rc14, too.
o Android Zaurus: Portrait/Landscape and Keycode

If you have already downloaded my SD bootable image, you can find the patched file in /media/card/rfs/system/usr/keylayout.

posted by 安藤恐竜 at 19:53 | Comment(0) | TrackBack(0) | 日記


m5_rc14 works on my Zaurus C3000

I experimented double buffer and pan in pxafb.c and it works for me. Very first time I saw the new tile menu on my Zaurus.
m5_rc14-home.png     m5_rc14-poweroption.png
Cursor keys work weird and something very funny with key board. I need to check key codes again to see how to fix it.

Anyway, this is my implementation of double buffer. Any suggestions to make it better are always welcome.
o pxafb-doublebuffer.patch

I referred this post in a mailing list to get some ideas how to implement a pan function.
posted by 安藤恐竜 at 16:43 | Comment(11) | TrackBack(0) | 日記


m5_rc14 porting - frame buffer needs double buffering and pan function

In a discussion at OESF, we reached double buffering in frame buffer driver is the key to escape from blank screen issue. Experiments by Mrflying and Cortez helped a lot.
o Porting M5rc14 To Real Hardware

Cortez made m5_rc14 run on his Zaurus finally.
o Android m5-rc14 working on Zaurus SL-C3100!

pxafb.c in vanilla kernel doesn't have double buffering and pan function. So anyone wants to port m5_rc14 to a real target, my suggestion is studying the Goldfish driver to know how implemented. Comparing fops is a place to start.

posted by 安藤恐竜 at 11:55 | Comment(2) | TrackBack(0) | 日記




・マイブログの【設定】 > 【広告設定】 より、「60日間更新が無い場合」 の 「広告を表示しない」にチェックを入れて保存する。