Skip to content

Commit a0ae00b

Browse files
committed
simulator: add --version argument
One purpose is to be able to track the current simulator version in git history, so when we release it, we know which version it should be. bitbox02 prefix as we will have simulators for future BitBox versions too. The firmware version is there so we know which firmware is simulated. The "simulator<VERSION>" part is to identify the simulator and its version. "linux-amd64" because we currently only support building using the Dockerfile, with the output being linux-amd64.
1 parent d714855 commit a0ae00b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

test/simulator/simulator.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,15 @@
2727
#include <sd.h>
2828
#include <stdio.h>
2929
#include <unistd.h>
30+
#include <version.h>
3031

3132
#include <getopt.h>
3233
#include <netdb.h>
3334
#include <netinet/in.h>
3435
#include <sys/socket.h>
3536

37+
static const char* _simulator_version = "1.0.0";
38+
3639
#define BUFFER_SIZE 1024
3740

3841
int data_len;
@@ -69,14 +72,21 @@ int main(int argc, char* argv[])
6972
// Default port number
7073
int portno = 15423;
7174

72-
struct option long_options[] = {{"port", required_argument, 0, 'p'}, {0, 0, 0, 0}};
75+
struct option long_options[] = {
76+
{"port", required_argument, 0, 'p'}, {"version", no_argument, 0, 'v'}, {0, 0, 0, 0}};
7377

7478
int opt;
7579
while ((opt = getopt_long(argc, argv, "", long_options, NULL)) != -1) {
7680
switch (opt) {
7781
case 'p':
7882
portno = atoi(optarg);
7983
break;
84+
case 'v':
85+
printf(
86+
"bitbox02-multi-%s-simulator-%s-linux-amd64\n",
87+
DIGITAL_BITBOX_VERSION_SHORT,
88+
_simulator_version);
89+
return 0;
8090
default:
8191
fprintf(stderr, "Usage: %s --port <port number>\n", argv[0]);
8292
return 1;

0 commit comments

Comments
 (0)