diff --git a/host/hackrf-tools/src/hackrf_spiflash.c b/host/hackrf-tools/src/hackrf_spiflash.c index 00113bdf..d58c41ee 100644 --- a/host/hackrf-tools/src/hackrf_spiflash.c +++ b/host/hackrf-tools/src/hackrf_spiflash.c @@ -89,6 +89,7 @@ static void usage() printf("\t-l, --length : number of bytes to read (default: 0)\n"); printf("\t-r : Read data into file.\n"); printf("\t-w : Write data from file.\n"); + printf("\t-d : Serial number of device, if multiple devices\n"); } int main(int argc, char** argv) @@ -99,6 +100,7 @@ int main(int argc, char** argv) uint32_t tmp_length; uint16_t xfer_len = 0; const char* path = NULL; + const char* serial_number = NULL; hackrf_device* device = NULL; int result = HACKRF_SUCCESS; int option_index = 0; @@ -108,7 +110,7 @@ int main(int argc, char** argv) bool read = false; bool write = false; - while ((opt = getopt_long(argc, argv, "a:l:r:w:", long_options, + while ((opt = getopt_long(argc, argv, "a:l:r:w:d:", long_options, &option_index)) != EOF) { switch (opt) { case 'a': @@ -128,6 +130,10 @@ int main(int argc, char** argv) write = true; path = optarg; break; + + case 'd': + serial_number = optarg; + break; default: fprintf(stderr, "opt error: %d\n", opt); @@ -213,7 +219,7 @@ int main(int argc, char** argv) return EXIT_FAILURE; } - result = hackrf_open(NULL, &device); + result = hackrf_open(serial_number, &device); if (result != HACKRF_SUCCESS) { fprintf(stderr, "hackrf_open() failed: %s (%d)\n", hackrf_error_name(result), result);