Skip to content

Commit 4b7ac3e

Browse files
committed
Fix hex2dfu.c build issue with Ubuntu 20.04 LTS
1 parent 43ce1d4 commit 4b7ac3e

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/build-scripts/hex2dfu.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <stdlib.h>
88
#include <string.h>
99
#include <unistd.h>
10+
#include <getopt.h>
1011

1112
#define ED25519_SUPPORT 0
1213

@@ -75,13 +76,15 @@ int main (int argc, char **argv) {
7576
targen_number = strtol(optarg, NULL, 16);
7677
break;
7778
case 'r': // Target Revision format "xx.yy"
78-
uint16_t revision_number_MSB, revision_number_LSB;
79-
if (sscanf(optarg, "%hx.%hx", &revision_number_MSB, &revision_number_LSB) != 2) {
80-
fprintf(stderr, "Invalid revision format: %s\n", optarg);
81-
exit(EXIT_FAILURE); // or return an error code
82-
}
79+
{
80+
uint16_t revision_number_MSB, revision_number_LSB;
81+
if (sscanf(optarg, "%hx.%hx", &revision_number_MSB, &revision_number_LSB) != 2) {
82+
fprintf(stderr, "Invalid revision format: %s\n", optarg);
83+
exit(EXIT_FAILURE); // or return an error code
84+
}
8385
ver = (int)(revision_number_MSB << 8 | revision_number_LSB);;
8486
break;
87+
}
8588
case 'd': //device version
8689
ver = strtol (optarg, NULL, 16);
8790
break;

src/build-scripts/hex2dfu.exe

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)