summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Sharma <harsh.sharma@multitech.com>2020-01-24 13:22:57 -0600
committerHarsh Sharma <harsh.sharma@multitech.com>2020-01-24 13:22:57 -0600
commit116d2f6402a83c824b0226c42fb08a22c75038b2 (patch)
treef7681c8d83e6c8f1737db4422837b4f3eda832dc
parenta0a94c3336574482d16fa910e94d7f07bba60123 (diff)
downloadlora_gateway_mtac_full-116d2f6402a83c824b0226c42fb08a22c75038b2.tar.gz
lora_gateway_mtac_full-116d2f6402a83c824b0226c42fb08a22c75038b2.tar.bz2
lora_gateway_mtac_full-116d2f6402a83c824b0226c42fb08a22c75038b2.zip
Bug fix for util tx continuous's attn setting and added spi path option for util tx test
-rw-r--r--util_tx_continuous/src/util_tx_continuous.c4
-rw-r--r--util_tx_test/src/util_tx_test.c22
2 files changed, 19 insertions, 7 deletions
diff --git a/util_tx_continuous/src/util_tx_continuous.c b/util_tx_continuous/src/util_tx_continuous.c
index b8b59e9..591054a 100644
--- a/util_tx_continuous/src/util_tx_continuous.c
+++ b/util_tx_continuous/src/util_tx_continuous.c
@@ -150,7 +150,7 @@ int main(int argc, char **argv)
printf(" --br <float> FSK bitrate in kbps, [0.5:250]\n");
printf(" --fdev <uint> FSK frequency deviation in kHz, [1:250]\n");
printf(" --bt <uint> FSK gaussian filter BT trim, [0:3]\n");
- printf(" --attn <float> Attenuator value in dB, required LGA module or MTAC full card\n");
+ printf(" --attn <uint> Attenuator value in dB, required LGA module or MTAC full card\n");
printf(" --path <string> Path of SPIDEV e.g. /dev/spidev0.0\n");
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
return EXIT_SUCCESS;
@@ -270,7 +270,7 @@ int main(int argc, char **argv)
}
else if (strcmp(long_options[option_index].name,"attn") == 0) {
i = sscanf(optarg, "%u", &arg_u);
- if ((i != 1) || (arg_f > 127) ) {
+ if ((i != 1) || (arg_u > 127) ) {
printf("ERROR: argument parsing of --attn argument. Use -h to print help\n");
return EXIT_FAILURE;
}
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: