From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lukasz Majewski Date: Tue, 17 Sep 2019 12:28:52 +0200 Subject: [U-Boot] [PATCH 05/14] dfu: allow read with 0 data for EOF indication In-Reply-To: <20190913141930.15784-6-patrick.delaunay@st.com> References: <20190913141930.15784-2-patrick.delaunay@st.com> <20190913141930.15784-6-patrick.delaunay@st.com> Message-ID: <20190917122852.10d8c0f0@jawa> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Patrick, > This patch allows into the DFU backend to indicate that there is no > remaining data (for EOF for example). That allows users to read a > buffer greater than the device size; the dfu stack stops the read > request when the backend return a length=0 without error. > > Signed-off-by: Patrick Delaunay > --- > > drivers/dfu/dfu.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c > index 8bd5216017..50919fcae9 100644 > --- a/drivers/dfu/dfu.c > +++ b/drivers/dfu/dfu.c > @@ -396,6 +396,8 @@ static int dfu_read_buffer_fill(struct dfu_entity > *dfu, void *buf, int size) debug("%s: Read error!\n", __func__); > return ret; > } > + if (dfu->b_left == 0) > + break; I guess that this is the use case for sending commands? Could you provide a more descriptive use case for this change (the description in the above commit message is not enough for me to get it). > dfu->offset += dfu->b_left; > dfu->r_left -= dfu->b_left; > Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: