summaryrefslogtreecommitdiff
path: root/util_tx_test/src/util_tx_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'util_tx_test/src/util_tx_test.c')
-rw-r--r--util_tx_test/src/util_tx_test.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/util_tx_test/src/util_tx_test.c b/util_tx_test/src/util_tx_test.c
index 74c163f..0ac8244 100644
--- a/util_tx_test/src/util_tx_test.c
+++ b/util_tx_test/src/util_tx_test.c
@@ -37,6 +37,7 @@ Maintainer: Sylvain Miermont
#include "loragw_hal.h"
#include "loragw_reg.h"
#include "loragw_aux.h"
+#include "loragw_spi.h"
/* -------------------------------------------------------------------------- */
/* --- PRIVATE MACROS ------------------------------------------------------- */
@@ -147,11 +148,12 @@ void usage(void) {
printf(" -i send packet using inverted modulation polarity\n");
printf(" -t <uint> pause between packets (ms)\n");
printf(" -x <int> nb of times the sequence is repeated (-1 loop until stopped)\n");
- printf(" --lbt-freq <float> lbt first channel frequency in MHz\n");
- printf(" --lbt-nbch <uint> lbt number of channels [1..8]\n");
- printf(" --lbt-sctm <uint> lbt scan time in usec to be applied to all channels [128, 5000]\n");
- printf(" --lbt-rssi <int> lbt rssi target in dBm [-128..0]\n");
- printf(" --lbt-rssi-offset <int> rssi offset in dB to be applied to SX127x RSSI [-128..127]\n");
+ printf(" --lbt-freq <float> lbt first channel frequency in MHz\n");
+ printf(" --lbt-nbch <uint> lbt number of channels [1..8]\n");
+ printf(" --lbt-sctm <uint> lbt scan time in usec to be applied to all channels [128, 5000]\n");
+ printf(" --lbt-rssi <int> lbt rssi target in dBm [-128..0]\n");
+ printf(" --lbt-rssi-offset <int> rssi offset in dB to be applied to SX127x RSSI [-128..127]\n");
+ printf(" --path <string> path of SPIDEV e.g. /dev/spidev0.0\n");
}
/* -------------------------------------------------------------------------- */
@@ -213,6 +215,7 @@ int main(int argc, char **argv)
{"lbt-rssi", required_argument, 0, 0},
{"lbt-nbch", required_argument, 0, 0},
{"lbt-rssi-offset", required_argument, 0, 0},
+ {"path", required_argument, 0, 0},
{0, 0, 0, 0}
};
@@ -469,6 +472,15 @@ int main(int argc, char **argv)
usage();
return EXIT_FAILURE;
}
+ } else if (strcmp(long_options[option_index].name,"path") == 0) { /* <string> Path to spi device */
+ i = sscanf(optarg, "%s", arg_s);
+ if ((i != 1) || (strncmp(arg_s, "/dev/", 5 ) != 0)) {
+ printf("ERROR: argument parsing of --path argument. Use -h to print help\n");
+ return EXIT_FAILURE;
+ }
+ else {
+ lgw_spi_set_path(arg_s);
+ }
}
break;
default: