]> git.zerfleddert.de Git - ms2-fixes/blob - README
save and restore more
[ms2-fixes] / README
1 The double-pressing plaguing the Motorola Milestone 2 is a software-bug, as
2 Motorola forgot to enable the generic android gpio debounce code in their
3 keyboard-driver.
4
5 When looking at the Motorola Milestone 2 kernel, which is available at
6 https://opensource.motorola.com/sf/projects/milestone (Milestone-2 2.2.16,
7 kernel.tar.gz), the following code can be found in the file
8 arch/arm/mach-omap2/board-sholes-keypad.c:
9 [CODE]
10 static 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
24 But the header defining this struct (include/linux/gpio_event.h) adds another
25 very interesting member:
26 [CODE]
27 struct gpio_event_matrix_info {
28 ...
29 ktime_t debounce_delay;
30 ...
31 };
32 [/CODE]
33
34 This debounce_delay is 0 as it is never initialized, and so the debouncing code
35 in drivers/input/misc/gpio_matrix.c does nothing. The easy fix for this problem
36 would be to recompile the kernel and set this member to the value used in other
37 android handsets (5ms). But "thanks" to the locked bootloader this is
38 impossible.
39
40 So the only solution to this is an ugly hack, which searches for the structure
41 in memory and sets debounce_delay to an useful value. I have written a
42 kernel-module which does just that. It's code can be found at:
43 http://git.zerfleddert.de/cgi-bin/gitweb.cgi/ms2-fixes
44 (And this is its README file)
45
46 As I assume not everybody wants to go through the pain of setting up a
47 toolchain which can be used to compile modules for the motorola kernel, I have
48 also uploaded a precompiled version of the module at
49 http://rmdir.de/~michael/ms2-fixes/debounce.ko
50
51 This version should work at least on MS2 2.2.16 and MS2 2.4.24 (which I am
52 using), as I have built it against the 2.2.16 kernel sources (which are the
53 only ones I can find)
54
55 To use this module, you need a rooted phone. Copy the module to /tmp and run
56 "insmod /tmp/debounce.ko".
57 After 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
69 Please test this module and see if it fixes your keyboard problems. (I have
70 only slight double-presses, which are not really reproducible (but I had none
71 since activating the debouncing)). I would be happy to hear that it works for
72 other people, too.
73
74 Thanks Motorola for making our lives so easy with a locked bootloader!
75
76 Michael Gernoth <michael@gernoth.net>
Impressum, Datenschutz