diff --git a/src/layer1.c b/src/layer1.c index 21bc862..1132374 100644 --- a/src/layer1.c +++ b/src/layer1.c @@ -11,6 +11,8 @@ #include "v5x_l1_fsm.h" #include "v5x_le_management.h" +extern int test_sa7; + extern struct v5x_instance *v5i; static struct gsmtap_inst *g_gti = NULL; @@ -74,10 +76,19 @@ static int inp_sig_cb(unsigned int subsys, unsigned int signal, void __attribute v5x_l1_signal_rcv(v5l, L1_SIGNAL_NO_AIS); break; case S_L_INP_LINE_SA_BITS: - if ((isd->sa_bits & 0x40)) + if ((isd->sa_bits & 0x40)) { v5x_l1_signal_rcv(v5l, L1_SIGNAL_SA7_1); - else + if (test_sa7) { + printf("Currently Sa 7 is set to 1, changing it to 0. (Link ID %d)\n", v5l->id); + v5x_l1_signal_snd(v5l, L1_SIGNAL_SA7_0); + } + } else { v5x_l1_signal_rcv(v5l, L1_SIGNAL_SA7_0); + if (test_sa7) { + printf("Currently Sa 7 is set to 0, changing it to 1. (Link ID %d)\n", v5l->id); + v5x_l1_signal_snd(v5l, L1_SIGNAL_SA7_1); + } + } break; case S_L_INP_LINE_SLIP_RX: printf("RX slip detected on link %d.\n", v5l->id); diff --git a/src/main.c b/src/main.c index b2770ee..b28f57b 100644 --- a/src/main.c +++ b/src/main.c @@ -72,6 +72,7 @@ void *tall_v5le_ctx = NULL; struct v5x_instance *v5i = NULL; static int daemonize = 0; +int test_sa7 = 0; const char *v5le_copyright = "Copyright (C) 2022 by Harald Welte & Andreas Eversberg\r\n" @@ -89,6 +90,7 @@ static void print_help() printf(" -s --disable-color\n"); printf(" -D --daemonize Fork the process into a background daemon\n"); printf(" -V --version Print the version number\n"); + printf(" -7 --rest-sa7 Continously toggle Sa7 when received. (Do loop interface.)\n"); printf("\nVTY reference generation:\n"); printf(" --vty-ref-mode MODE VTY reference generation mode (e.g. 'expert').\n"); @@ -133,10 +135,11 @@ static void handle_options(int argc, char **argv) {"disable-color", 0, 0, 's'}, {"vty-ref-mode", 1, &long_option, 1}, {"vty-ref-xml", 0, &long_option, 2}, + {"test-sa7", 0, 0, '7'}, {0, 0, 0, 0}, }; - c = getopt_long(argc, argv, "hc:sVD", long_options, &option_index); + c = getopt_long(argc, argv, "hc:sVD7", long_options, &option_index); if (c == -1) break; @@ -162,6 +165,9 @@ static void handle_options(int argc, char **argv) case 'D': daemonize = 1; break; + case '7': + test_sa7 = 1; + break; default: /* ignore */ break;