On Tue 13 Jul 03:40 CDT 2021, Pascal Bourguignon wrote:

> Hi Bjorn,
> 
> Please find the proposed patch attached.
> 
> Le 13/07/2021 à 10:27, Maxim Kuvyrkov a écrit :
> > Hi Bjorn,
> > 
> > You are the most active committer for qdl — so forwarding this question to 
> > you.
> > 
> > Regards,
> > 
> > --
> > Maxim Kuvyrkov
> > https://www.linaro.org
> > 
> > > On 13 Jul 2021, at 11:16, Pascal Bourguignon <p...@sbde.fr> wrote:
> > > 
> > > Hello,
> > > 
> > > I've got a little patch for qdl, adding error messages.
> > > https://git.linaro.org/landing-teams/working/qualcomm/qdl.git/
> > > What would be the right place to send it to?
> 

Unfortunately I never found a good way to state it, but this is a mirror
of github.com/andersson/qdl, so you may send pull requests against this
project.

There's some discussions about moving git.linaro.org to Gitlab, so it's
likely that this confusion will resolve itself soon. Sorry about that.

> 
> -- 
> __Pascal Bourguignon__
> http://www.sbde.fr/

> From a2364afa4f6b38bd9836bfba3f24a80399b77613 Mon Sep 17 00:00:00 2001
> From: Pascal Bourguignon <pascal.bourguig...@qorvo.com>
> Date: Tue, 13 Jul 2021 10:06:39 +0200
> Subject: [PATCH] Added error messages.
> 
> ---
>  qdl.c    | 15 +++++++++------
>  sahara.c |  4 +++-
>  2 files changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/qdl.c b/qdl.c
> index 256ca96..efc41a0 100644
> --- a/qdl.c
> +++ b/qdl.c
> @@ -477,16 +477,19 @@ int main(int argc, char **argv)
>       } while (++optind < argc);
>  
>       ret = usb_open(&qdl);
> -     if (ret)
> -             return 1;
> +     if (ret){
> +             errx(1, "usb_open error %d", ret);

In what scenario did you end up here, without usb_open() already
invoking err() and printing a more descriptive error message?

Perhaps we need improve the error handling in the called code, to be
more helpful?

> +     }
>  
>       ret = sahara_run(&qdl, prog_mbn);
> -     if (ret < 0)
> -             return 1;
> +     if (ret < 0){
> +             errx(1, "sahara_run error %d", ret);

Ditto.

> +     }
>  
>       ret = firehose_run(&qdl, incdir, storage);
> -     if (ret < 0)
> -             return 1;
> +     if (ret < 0){
> +             errx(1, "firehose_run error %d", ret);

Ditto.

> +     }
>  
>       return 0;
>  }
> diff --git a/sahara.c b/sahara.c
> index 27082a2..34284dc 100644
> --- a/sahara.c
> +++ b/sahara.c
> @@ -204,8 +204,10 @@ int sahara_run(struct qdl_device *qdl, char *prog_mbn)
>  
>       while (!done) {
>               n = qdl_read(qdl, buf, sizeof(buf), 1000);
> -             if (n < 0)
> +             if (n < 0){
> +                     fprintf(stderr,"Cannot read qdl device\n");

I presume that e.g. a timeout here would cause the program to just
silently exit today, so this seems like a very reasonable thing.

But I think warn() instead of fprintf() would be more useful, in that it
gives you a clue about the error that occurred:

                        warn("USB read failed");

Thanks,
Bjorn

>                       break;
> +             }
>  
>               pkt = (struct sahara_pkt*)buf;
>               if (n != pkt->length) {
> -- 
> 2.20.1
> 

_______________________________________________
linaro-toolchain mailing list
linaro-toolchain@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/linaro-toolchain

Reply via email to