speakup-r lockup analysis so far

Okash Khawaja okash.khawaja at gmail.com
Mon Aug 28 05:23:31 EDT 2017


Hi John,

So the last patch I sent, only changes behaviour when

a) the check 'if (get_sentence_buf(vc, 0) == -1)' in read_all_doc is
true, and
b) code is running under context of keyboard_notifier_call() function

>From my understanding the above two conditions occur only when speakup-r
is typed at beginning of an empty line.

However if this change causes cursor to end up in wrong position when
control key is hit, then it must be that the above conditions also occur
due to reasons other than typing speakup-r at an empty line.

This patch is the same as before, except that it prints to kernel log
whenever these two conditions are satisfied. Running it on the same
document and with serial synth will show that it does happen. Then,
based on the logs I can investigate why it happens.

Many thanks!
Okash

---
 drivers/staging/speakup/main.c |   20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1376,6 +1376,8 @@ static void reset_highlight_buffers(stru
 
 static int read_all_key;
 
+static volatile int in_keyboard_notifier = 0;
+
 static void start_read_all_timer(struct vc_data *vc, int command);
 
 enum {
@@ -1408,7 +1410,15 @@ static void read_all_doc(struct vc_data
 	cursor_track = read_all_mode;
 	spk_reset_index_count(0);
 	if (get_sentence_buf(vc, 0) == -1) {
-		kbd_fakekey2(vc, RA_DOWN_ARROW);
+		del_timer(&cursor_timer);
+		if (!in_keyboard_notifier)
+			speakup_fake_down_arrow();
+		else {
+			pr_warn(">>> read_all_doc: in_interrupt()=%ld\n",
+				       in_interrupt());
+			dump_stack();
+		}
+		start_read_all_timer(vc, RA_DOWN_ARROW);
 	} else {
 		say_sentence_num(0, 0);
 		synth_insert_next_index(0);
@@ -2212,8 +2222,10 @@ static int keyboard_notifier_call(struct
 	int ret = NOTIFY_OK;
 	static int keycode;	/* to hold the current keycode */
 
+	in_keyboard_notifier = 1;
+
 	if (vc->vc_mode == KD_GRAPHICS)
-		return ret;
+		goto out;
 
 	/*
 	 * First, determine whether we are handling a fake keypress on
@@ -2225,7 +2237,7 @@ static int keyboard_notifier_call(struct
 	 */
 
 	if (speakup_fake_key_pressed())
-		return ret;
+		goto out;
 
 	switch (code) {
 	case KBD_KEYCODE:
@@ -2266,6 +2278,8 @@ static int keyboard_notifier_call(struct
 			break;
 		}
 	}
+out:
+	in_keyboard_notifier = 0;
 	return ret;
 }
 


More information about the Speakup mailing list