From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by befuddled.reisers.ca (Postfix, from userid 65534) id 708871F0618; Tue, 28 Mar 2017 10:35:12 -0400 (EDT) Received: from mail-it0-x230.google.com (mail-it0-x230.google.com [IPv6:2607:f8b0:4001:c0b::230]) by befuddled.reisers.ca (Postfix) with ESMTPS id B6B6E1F0609 for ; Tue, 28 Mar 2017 10:35:10 -0400 (EDT) Received: by mail-it0-x230.google.com with SMTP id y18so27429202itc.1 for ; Tue, 28 Mar 2017 07:35:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=d6hZ/mWyYaq2ofCgsg5+TucAYpOyFjqvXS4sHFja4oU=; b=YLsms4fFqdonxFMewWWiJDxELxbLJBWyveiGAu93wImP940FjQDpjtwCdQhMAeEnwp 9cpiGZ73lC/ng/pqiZy9apYScIlmi+YgPJtplHAjsdvV1RHJejDQDIUrjjA111bZR2J9 U+61i0KI3FwP04Q4NcG4GqBMHIcV4ZHmwGevI5ycHp8RrLiifi/utWDUIG01L6Pmd9qx B06exXd0uckGEKtNAzqPujKE/PbPO3tVb4KOdQsVrpgYqJgER7EkAScandvOrG+gijqm qMIKXHXCuHnJg5+RnlfWSqlpJyf27Oiz6R0EfiOnnYyHMLbTduwh3E0CMrmSXGU7WcUP FKNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=d6hZ/mWyYaq2ofCgsg5+TucAYpOyFjqvXS4sHFja4oU=; b=j5GhHkysC2WJ3993SkI9poJmO7caQACpkFT3L8JhaRiWGiGFwXNoMvHRwjUUm7Vtu7 a1uS8DjgCUqGUlDiGcUY4HhZYPTNdlUlC1wAyJ7bhf4WEuxVdKK2DM1gldSBPsY6Wc6Z 6njHwcWe07VvfYM804efPUy9u796lVViOQu/Vc2nQMlrubPb9ydBbKdtv8FJN1g6enHC w/iDgJRjHC5S0wiLk4AS/5fn7YDGZ2Ok2rXvHQMevvpS2crDbBgkp7ikaXu7SR23SAMq UQx3tNIHhkIzAVFzV0c8KMSoQJbU78sS4NAInY3l09kAvPjDOOpDnK2SeBtdMuvhUq/3 cL0g== X-Gm-Message-State: AFeK/H03BS+8xP+JQJidUT0gAUO4OK3KC2LPDw+k4fgfHolmAdITVVtA57ZjCR4EnYeT3zknRhb6A4mrzPaaVA== X-Received: by 10.107.35.129 with SMTP id j123mr26544466ioj.195.1490711709220; Tue, 28 Mar 2017 07:35:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.158.81 with HTTP; Tue, 28 Mar 2017 07:35:08 -0700 (PDT) In-Reply-To: <20170226024832.ly3mogxxrktjehzf@var.youpi.perso.aquilenet.fr> References: <20170225192842.GA4519@sanghar> <20170225193031.GA4525@sanghar> <20170226015005.25u3ea7ag5ub5ulc@var.youpi.perso.aquilenet.fr> <20170226024832.ly3mogxxrktjehzf@var.youpi.perso.aquilenet.fr> From: Okash Khawaja Date: Tue, 28 Mar 2017 15:35:08 +0100 Message-ID: Subject: Re: [patch 6/6] staging: speakup: Migrate acntsa, bns, dectlk and txprt to ttyio To: Samuel Thibault Cc: "Speakup is a screen review system for Linux." Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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: Tue, 28 Mar 2017 14:35:12 -0000 Hi, On Sun, Feb 26, 2017 at 2:48 AM, Samuel Thibault wrote: > Samuel Thibault, on dim. 26 f=C3=A9vr. 2017 02:50:05 +0100, wrote: >> Please note in your todo for the input part, that ttyio will have to >> call read_buff_add for each received character, when that method is >> not NULL (that's actually the only driver using it, so we will really >> need a tester for this exact driver). > > More precisely, it's the spk_ttyio_ldisc_ops->receive_buf2 method which > should call read_buff_add for each received character. > > > The step further will be implementing spk_ttyio_in and > spk_ttyio_in_nowait. I believe the easiest way is the following: > > - define an spk_ldisc_data structure containing just one character (buf), > and a semaphore. > > - on ldisc_open, allocate a pointer to such structure, set > tty->disc_data to point to it, and initialized the semaphore to 0 > tokens. > > - in the receive_buf2 method, > - if read_buff_add is defined, just call it for each character and be > done > - otherwise, store the first received character in > ((struct spk_ldisc_data *)tty->disc_data)->buf > , call up() on the semaphore, and return 1 (to tell that you ate the > character). I don't fully understand how the return value of receive_buf2 is used in flow control. According to Documentation/serial/tty.txt it is the number of bytes processed by it, whereas comments on top of tty_ldisc_receive_buf function's definition - which returns value returned by receive_buf2 - say it is the number of bytes not processed. Also, is the call to tty_schedule_flip in spk_serial_in because we returned 1 receive_buf2 so we have to manually tell it to flip buffer? Thanks, Okash