[PATCH] Stable: make touchscreen work on GTA01

Mike (mwester) mwester at dls.net
Sun Jul 6 16:02:00 CEST 2008


Andy Green wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Somebody in the thread at some point said:
> | The touchscreen code that does the running averaging to smooth things
> | out causes some troubles on the GTA01.  Unanimously [1], GTA01 owners
> | wish the attached patch to be applied to the stable kernel, so that
> | using the touchscreen on the device no longer scribbles all over
> | somebody else's memory.
> 
> Wah, what actually happened?  I applied the patch pending understanding
> what the unpatched thing does on GTA01.

Well, the existing code uses ".excursion_filter_len_bits" in the
calculation of the size of the array to vmalloc.  The code that uses the
array, however, uses ".oversampling_shift" to compute the bounds at
runtime -- I suspect this is the root cause.  For the GTA02, both
".excursion_filter_len_bits" and ".oversampling_shift" are initialized
to 5, so the array is vmalloc'd with 32 entries, and the bounds at
runtime are 32.  So it works.  On the GTA01,
".excursion_filter_len_bits" was not set at all, so it worked out to
vmallocing 2^0 (or 1) array element -- but ".oversampling_shift" is an
existing value, and is 5 -- hence at runtime the GTA01 vmalloc'd 1 entry
and scribbled all over 32.

The symptom was remarkably benign - the "ps" and "opkg" commands were
the obvious failures; nothing obvious broke except that anything that
read /proc/meminfo segfaulted.

I expect that the correct fix would be the change the code to use
".excursion_filter_len_bits" at run time, but that code is all gone on
the andy branch already, so I took the easy way out.

> | I'm guessing the touch-screen has the same problem, and that the same
> | values apply... please correct me if my assumptions are flawed!
> 
> You mean GTA02 touchscreen has the same problem?  It works fine here at
> least.

Er, I phrased that particularly poorly.  I meant to inquire if the
touchscreen on the GTA01 suffers from the same problem that this patch
fixes on the GTA02 -- if not, then another fix would be in order.

Mike (mwester)




More information about the openmoko-kernel mailing list