Skip to content

Commit

Permalink
Fix hex2dfu.c build issue with Ubuntu 20.04 LTS
Browse files Browse the repository at this point in the history
  • Loading branch information
bvernoux committed Jun 12, 2024
1 parent 43ce1d4 commit 4b7ac3e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/build-scripts/hex2dfu.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <getopt.h>

#define ED25519_SUPPORT 0

Expand Down Expand Up @@ -75,13 +76,15 @@ int main (int argc, char **argv) {
targen_number = strtol(optarg, NULL, 16);
break;
case 'r': // Target Revision format "xx.yy"
uint16_t revision_number_MSB, revision_number_LSB;
if (sscanf(optarg, "%hx.%hx", &revision_number_MSB, &revision_number_LSB) != 2) {
fprintf(stderr, "Invalid revision format: %s\n", optarg);
exit(EXIT_FAILURE); // or return an error code
}
{
uint16_t revision_number_MSB, revision_number_LSB;
if (sscanf(optarg, "%hx.%hx", &revision_number_MSB, &revision_number_LSB) != 2) {
fprintf(stderr, "Invalid revision format: %s\n", optarg);
exit(EXIT_FAILURE); // or return an error code
}
ver = (int)(revision_number_MSB << 8 | revision_number_LSB);;
break;
}
case 'd': //device version
ver = strtol (optarg, NULL, 16);
break;
Expand Down
Binary file modified src/build-scripts/hex2dfu.exe
Binary file not shown.

0 comments on commit 4b7ac3e

Please sign in to comment.