[dfu-util] TI Stellaris prefix support for dfu-suffix
Tormod Volden
lists.tormod at gmail.com
Mon Sep 17 08:47:54 CEST 2012
On Mon, Sep 17, 2012 at 7:27 AM, Tommi Keisala wrote:
> Good catch.
> Maybe it would be good idea to force user give proper address rather than
> defaulting to 0.
> I can't recall the reasoning for reading lmdfu_flash_address twice and now
> it seems quite silly.
> Maybe I should rewrite this part to not accept "default" and still checking
> if strtoul sets *end?
>
> Something like this:
> diff --git a/src/suffix.c b/src/suffix.c
> index 4ebfee7..f66300e 100644
> --- a/src/suffix.c
> +++ b/src/suffix.c
> @@ -192,14 +192,11 @@ int main(int argc, char **argv)
> break;
> case 's':
>
> lmdfu_mode = LMDFU_ADD;
> - lmdfu_flash_address = strtoul(optarg, NULL, 0);
> - if (strcmp(optarg, "default")) {
> - lmdfu_flash_address = strtoul(optarg, &end,
> 0);
> - if (!lmdfu_flash_address || (*end)) {
> - fprintf(stderr, "Error: Invalid
> lmdfu "
> - "address: %s\n", optarg);
> - exit(2);
> - }
>
> + lmdfu_flash_address = strtoul(optarg, &end, 0);
> + if (*end) {
> + fprintf(stderr, "Error: Invalid lmdfu "
> + "address: %s\n", optarg);
> + exit(2);
> }
> break;
> case 'T':
Yes, that looks good.
Tormod
>
>
> -Tommi
>
More information about the devel
mailing list