From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by befuddled.reisers.ca (Postfix, from userid 65534) id DA03F1EFD96; Wed, 5 Jul 2017 07:39:39 -0400 (EDT) Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) by befuddled.reisers.ca (Postfix) with ESMTPS id A78511EFD8F for ; Wed, 5 Jul 2017 07:39:37 -0400 (EDT) Received: by mail-wr0-x244.google.com with SMTP id 77so49721151wrb.3 for ; Wed, 05 Jul 2017 04:39:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=/nhb2z9luxpBrzuUSfjc8rpuNIqoTVx2z2LT43DBwd4=; b=s9BWNBDaWipLwNg/k8f1AG+Kij+sIThjw/x0k6PR+RjCmhenCudM/3AiGC3M5P4ED5 SNK0CA4iHdMSyqcSOxcCx99QHbufhvRqaSUJ5pj5t4BrUBJf7dYQL50U3WRBYglfl3iC tXvHpKLqdPcLsGaEAwC4g0GivJuWYeOvEJbtFYkUGZL+Gk+7MF2zUe2XGLBqQWEk9R1M Ivq7mavoWI4eyvQu4IvHZdURIYXpuUSCiFxGOpQ5kWgQ/H6YJKwC1ZJirkl6aLYfadnv cSvqQCRaGAPSJV3MterRJrkhoCaaSqAFUZJYi/11LTnhP9DxSInvBo6q5oOxZ99ODjsm pDIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=/nhb2z9luxpBrzuUSfjc8rpuNIqoTVx2z2LT43DBwd4=; b=BjKCRyV4WgnMYQSbHfYTrH1nseuHL5VZDCmwTnveCBJr0741gNPJ+KW7VoW5C85GVb +O2J/WkWn6ru4JVMBlEkYsdm9WjX3Jo3ETXSuR4A1KNDQcp7cp+MgTOfQKxIOEaSMJep m6n7+2mxxUrM9KZbqbUPvH2a04uY41yY0krJH2QUEoZrmroLBOSq7NmfLL4f6lOvSkjw ZecNXMqbFH9YxMoNRKvWSSxfbLeKlBDdJW5qMRAThmnvJ+jTeaIoRTsS2FfAQWWE/USV 5SuTG9Vfq8HbYYYAaZrWVO14vEY61M9ela310I48OY1umaysDnx3G9612xrUTiMyS75c WLqQ== X-Gm-Message-State: AKS2vOycZ2nnkthEMcUce5I8eI+au6V4LxydscX0Oj6kEqXDCUb2p0I/ 4H9gSmLuxsHIqg== X-Received: by 10.223.151.44 with SMTP id r41mr37983739wrb.6.1499254772139; Wed, 05 Jul 2017 04:39:32 -0700 (PDT) Received: from sanghar ([2a00:23c4:7320:5900:224:d6ff:fe76:7136]) by smtp.gmail.com with ESMTPSA id c55sm22457229wrc.7.2017.07.05.04.39.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Jul 2017 04:39:30 -0700 (PDT) Date: Wed, 5 Jul 2017 12:39:28 +0100 From: Okash Khawaja To: John Covici Cc: speakup@linux-speakup.org, Samuel Thibault Subject: Re: speakup-r empty line lockup Message-ID: <20170705113928.GA790@sanghar> References: <20170624090645.GA8813@sanghar> <20170703111453.GA2857@sanghar> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.2 (2017-04-18) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 X-BeenThere: speakup@linux-speakup.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Speakup is a screen review system for Linux." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jul 2017 11:39:40 -0000 Thanks, I'm looking into it. On Wed, Jul 05, 2017 at 06:54:13AM -0400, John Covici wrote: > Mope, its on regular serial, somehow your fix broke it. > > On Mon, 03 Jul 2017 07:14:53 -0400, > Okash Khawaja wrote: > > > > Hi, > > > > This looks like the problem you raised previously, the one which was > > resolved by calling flush_buffers. Is this happening on ttyUSB? > > usb-serial driver doesn't implement flush_buffers method which means > > that speakup-r will have this issue until there is flush_buffers in > > usb-serial. > > > > Thanks, > > Okash > > > > On Mon, Jul 03, 2017 at 05:52:19AM -0400, John Covici wrote: > > > I just tested the empty line lockup is gone, but now speakup-r does > > > not work, actually in the file I had, after reading a number of lines > > > when I hit control, the cursor was actually at the end of the file. > > > > > > Thanks for working on this one. > > > > > > On Sat, 24 Jun 2017 05:06:45 -0400, > > > Okash Khawaja wrote: > > > > > > > > Hi, > > > > > > > > The lockup when running speakup-r at start of an empty line occurs > > > > because simulated key press is generated (using speakup_fake_down_arrow) > > > > from context of keyboard_notifier_call callback which is called in > > > > interrupt context. The simulated keypress leads to > > > > keybaord_notifier_call to be trigerred again from the same context > > > > leading to the lockup. The exact cause could be priority inversion where > > > > simulated keypress cannot be processed because there is a real keyboard > > > > interrupt already being processed (the one from which simulated keypress > > > > was triggered), hence causing a deadlock. Please share your thoughts on > > > > this. Here is the call chain. > > > > > > > > (speakup-r) --> keyboard_notifier_call --> speakup_key --> do_spkup --> > > > > read_all_doc --> get_sentence_buf [which returns -1 because of empty > > > > line] --> kbd_fakekey2(RA_DOWN_ARROW) --> speakup_fake_down_arrow > > > > > > > > The following patch resolves this by not simulating the keypress inside > > > > keyboard notifier callback but instead delegating it to cursor_timer. In > > > > the above chain, when get_sentence_buf returns -1, this patch starts > > > > timer and passes RA_DOWN_ARROW as argument. When timer handler runs and > > > > sees RA_DOWN_ARROW, it will then call kbd_fakekey2(RA_DOWN_ARROW) which > > > > will correctly simulate the keypress inside timer context. I've tested > > > > this succesfully. > > > > > > > > It's the first time I've worked on this side of the code so please > > > > review carefully :) > > > > > > > > Finally, I have updated the test repo on github so you can test from > > > > there. > > > > > > > > Thanks, > > > > Okash > > > > > > > > --- > > > > drivers/staging/speakup/main.c | 3 ++- > > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > > > --- a/drivers/staging/speakup/main.c > > > > +++ b/drivers/staging/speakup/main.c > > > > @@ -1408,7 +1408,8 @@ 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); > > > > + start_read_all_timer(vc, RA_DOWN_ARROW); > > > > } else { > > > > say_sentence_num(0, 0); > > > > synth_insert_next_index(0); > > > > > > -- > > > Your life is like a penny. You're going to lose it. The question is: > > > How do > > > you spend it? > > > > > > John Covici > > > covici@ccs.covici.com > > -- > Your life is like a penny. You're going to lose it. The question is: > How do > you spend it? > > John Covici > covici@ccs.covici.com