[PATCH 3/7] xyz-modem: Put xyzModem_stream_close debug diagnostic message into ZM_DEBUG()

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


On Wednesday 04 August 2021 11:30:25 Heinrich Schuchardt wrote:
> On 03.08.21 16:28, Pali Rohár wrote:
> > This is how all other debug / diagnostic messages are handled.
> 
> This commit message is misleading. What you do is hide an output.
> 
> > 
> > Signed-off-by: Pali Rohár <pali at kernel.org>
> > ---
> >   common/xyzModem.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/common/xyzModem.c b/common/xyzModem.c
> > index 631c44e11adf..c200c9ff9177 100644
> > --- a/common/xyzModem.c
> > +++ b/common/xyzModem.c
> > @@ -608,10 +608,10 @@ xyzModem_stream_read (char *buf, int size, int *err)
> >   void
> >   xyzModem_stream_close (int *err)
> >   {
> > -  diag_printf
> > +  ZM_DEBUG (zm_dprintf
> >       ("xyzModem - %s mode, %d(SOH)/%d(STX)/%d(CAN) packets, %d retries\n",
> >        xyz.crc_mode ? "CRC" : "Cksum", xyz.total_SOH, xyz.total_STX,
> > -     xyz.total_CAN, xyz.total_retries);
> > +     xyz.total_CAN, xyz.total_retries));
> >     ZM_DEBUG (zm_flush ());
> 
> zm_dprintf prints into the debug buffer which seems not to be overflow
> protected.
> 
> diag_printf prints to the console.
> 
> Why do you want to hide this message?

I'm not hiding it. I'm just moving debug output to be send via same way
as others.

> Isn't the CRC what the user will want to check?

It does not print any CRC, so nothing to check. It print information
which type of CRC was used during transfer.

> And if many retries occur doesn't this alert the user that the transfer
> may be corrupted?

Hm... corruption itself is handled by protocol. So if it happens then
transfer is aborted and via other patches is indicated to user.

Anyway, if this function xyzModem_stream_close() prior calling
xyzModem_stream_terminate() then nothing is visible to user because it
is send to the x/y-modem sending application, which drop it as garbage
according to the protocol.

Such information can be send after restoring terminal from file transfer
state back to the user input/output state.

> 
> Best regards
> 
> Heinrich
> 
> >   }
> > 
> > 


More information about the U-Boot mailing list