]> git.zerfleddert.de Git - ms2-fixes/blame - README
make active_high_flag writeable, it's not desctructive anymore
[ms2-fixes] / README
CommitLineData
a3cf88ac
MG
1The double-pressing plaguing the Motorola Milestone 2 is a software-bug, as
2Motorola forgot to enable the generic android gpio debounce code in their
3keyboard-driver.
4
5When looking at the Motorola Milestone 2 kernel, which is available at
6https://opensource.motorola.com/sf/projects/milestone (Milestone-2 2.2.16,
7kernel.tar.gz), the following code can be found in the file
8arch/arm/mach-omap2/board-sholes-keypad.c:
9[CODE]
10static struct gpio_event_matrix_info sholes_keypad_matrix_info = {
11 .info.func = gpio_event_matrix_func,
12 .keymap = sholes_p3_keymap,
13 .output_gpios = sholes_col_gpios,
14 .input_gpios = sholes_row_gpios,
15 .noutputs = ARRAY_SIZE(sholes_col_gpios),
16 .ninputs = ARRAY_SIZE(sholes_row_gpios),
17 .settle_time.tv.nsec = 40 * NSEC_PER_USEC,
18 .poll_time.tv.nsec = 20 * NSEC_PER_MSEC,
19 .flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_REMOVE_PHANTOM_KEYS |
20 GPIOKPF_PRINT_UNMAPPED_KEYS /*| GPIOKPF_PRINT_MAPPED_KEYS*/
21};
22[/CODE]
23
24But the header defining this struct (include/linux/gpio_event.h) adds another
25very interesting member:
26[CODE]
27struct gpio_event_matrix_info {
28 ...
29 ktime_t debounce_delay;
30 ...
31};
32[/CODE]
33
34This debounce_delay is 0 as it is never initialized, and so the debouncing code
35in drivers/input/misc/gpio_matrix.c does nothing. The easy fix for this problem
36would be to recompile the kernel and set this member to the value used in other
37android handsets (5ms). But "thanks" to the locked bootloader this is
38impossible.
39
40So the only solution to this is an ugly hack, which searches for the structure
41in memory and sets debounce_delay to an useful value. I have written a
42kernel-module which does just that. It's code can be found at:
43http://git.zerfleddert.de/cgi-bin/gitweb.cgi/ms2-fixes
44(And this is its README file)
45
46As I assume not everybody wants to go through the pain of setting up a
47toolchain which can be used to compile modules for the motorola kernel, I have
48also uploaded a precompiled version of the module at
49http://rmdir.de/~michael/ms2-fixes/debounce.ko
50
51This version should work at least on MS2 2.2.16 and MS2 2.4.24 (which I am
52using), as I have built it against the 2.2.16 kernel sources (which are the
53only ones I can find)
54
55To use this module, you need a rooted phone. Copy the module to /tmp and run
56"insmod /tmp/debounce.ko".
57After that, you should see the following output in "dmesg":
58[CODE]
59<6>[ 1226.493377] Searching for gpio-event...
60<6>[ 1226.493804] Found it!
61<6>[ 1226.494079] And there is a sholes-keypad connected...
62<6>[ 1226.494842] settle_time: 40000
63<6>[ 1226.495117] poll_time: 20000000
64<6>[ 1226.495391] debounce_delay: 0
65<6>[ 1226.495635] Activating debounce!
66<6>[ 1226.496917] debounce_delay: 5000000
67[/CODE]
68
69Please test this module and see if it fixes your keyboard problems. (I have
70only slight double-presses, which are not really reproducible (but I had none
71since activating the debouncing)). I would be happy to hear that it works for
72other people, too.
73
74Thanks Motorola for making our lives so easy with a locked bootloader!
75
76Michael Gernoth <michael@gernoth.net>
Impressum, Datenschutz