[PATCH 4/7] xyz-modem: Close stream after processing/sending terminate sequence

Pali Rohár pali at kernel.org
Fri Aug 6 18:27:02 CEST 2021


On Wednesday 04 August 2021 10:59:23 Heinrich Schuchardt wrote:
> On 03.08.21 16:28, Pali Rohár wrote:
> > Obviously it is not possible to send terminate sequence over stream after
> > closing stream.
> 
> xyzModem_stream_close() does not close anything; it flushes the stream.
> xyzModem_stream_terminate() sets xyz.at_eof = true and gives feedback to the
> user.
> 
> So I think this change is incorrect.

I do not think it is incorrect. Anything like user output/debug messages
which are flushed prior giving feedback to user (via CANs to restore
terminal back to normal state) would not be visible on user terminal,
but would be received by x/y-modem application (which interprets it as
garbage as does not conform to x/y-modem protocol).

> What we lack is documentation of the xyzModem functions in
> include/xyzModem.h.

I fully agree. Documentation on this topic is missing, code is in
not-so-good state and and it would be great to cleanup and document
it... But I really do not have a time for writing documentation for this
stuff :-(

> Cf.
> https://www.kernel.org/doc/html/latest/doc-guide/kernel-doc.html#function-documentation
> 
> Best regards
> 
> Heinrich
> 
> > 
> > Signed-off-by: Pali Rohár <pali at kernel.org>
> > ---
> >   cmd/load.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/cmd/load.c b/cmd/load.c
> > index b7894d7db02a..fb8c191fb64f 100644
> > --- a/cmd/load.c
> > +++ b/cmd/load.c
> > @@ -1006,8 +1006,8 @@ static ulong load_serial_ymodem(ulong offset, int mode)
> >   		printf("%s\n", xyzModem_error(err));
> >   	}
> > -	xyzModem_stream_close(&err);
> >   	xyzModem_stream_terminate(false, &getcxmodem);
> > +	xyzModem_stream_close(&err);
> >   	flush_cache(offset, ALIGN(size, ARCH_DMA_MINALIGN));
> > 


More information about the U-Boot mailing list