diff --git a/openbsc/include/openbsc/signal.h b/openbsc/include/openbsc/signal.h index 866fa293d..027358627 100644 --- a/openbsc/include/openbsc/signal.h +++ b/openbsc/include/openbsc/signal.h @@ -145,6 +145,8 @@ enum signal_input { S_INP_TEI_UP, S_INP_TEI_DN, S_INP_LINE_INIT, + S_INP_LINE_ALARM, + S_INP_LINE_NOALARM, }; struct gsm_subscriber; diff --git a/openbsc/src/bts_ericsson_rbs2000.c b/openbsc/src/bts_ericsson_rbs2000.c index 9c6a98f23..5ad47b292 100644 --- a/openbsc/src/bts_ericsson_rbs2000.c +++ b/openbsc/src/bts_ericsson_rbs2000.c @@ -53,7 +53,7 @@ static int shutdown_om(struct gsm_bts *bts) /* Tell LAPD to start start the SAP (send SABM requests) for all signalling * timeslots in this line */ -static void start_sabm_in_line(struct e1inp_line *line) +static void start_sabm_in_line(struct e1inp_line *line, int start) { struct e1inp_sign_link *link; int i; @@ -65,7 +65,10 @@ static void start_sabm_in_line(struct e1inp_line *line) continue; llist_for_each_entry(link, &ts->sign.sign_links, list) { - lapd_sap_start(ts->driver.dahdi.lapd, link->tei, link->sapi); + if (start) + lapd_sap_start(ts->driver.dahdi.lapd, link->tei, link->sapi); + else + lapd_sap_stop(ts->driver.dahdi.lapd, link->tei, link->sapi); } } } @@ -113,7 +116,17 @@ static int inp_sig_cb(unsigned int subsys, unsigned int signal, /* Right now Ericsson RBS are only supported on DAHDI */ if (strcasecmp(isd->line->driver->name, "DAHDI")) break; - start_sabm_in_line(isd->line); + start_sabm_in_line(isd->line, 1); + break; + case S_INP_LINE_ALARM: + if (strcasecmp(isd->line->driver->name, "DAHDI")) + break; + start_sabm_in_line(isd->line, 0); + break; + case S_INP_LINE_NOALARM: + if (strcasecmp(isd->line->driver->name, "DAHDI")) + break; + start_sabm_in_line(isd->line, 1); break; } diff --git a/openbsc/src/input/dahdi.c b/openbsc/src/input/dahdi.c index c142b8ae4..56851eed4 100644 --- a/openbsc/src/input/dahdi.c +++ b/openbsc/src/input/dahdi.c @@ -69,6 +69,7 @@ static const struct value_string dahdi_evt_names[] = { static void handle_dahdi_exception(struct e1inp_ts *ts) { int rc, evt; + struct input_signal_data isd; rc = ioctl(ts->driver.dahdi.fd.fd, DAHDI_GETEVENT, &evt); if (rc < 0) @@ -78,12 +79,16 @@ static void handle_dahdi_exception(struct e1inp_ts *ts) ts->line->num, ts->line->name, ts->num, get_value_string(dahdi_evt_names, evt)); + isd.line = ts->line; + switch (evt) { case DAHDI_EVENT_ALARM: - /* FIXME: we should notify the code that the line is gone */ + /* we should notify the code that the line is gone */ + dispatch_signal(SS_INPUT, S_INP_LINE_ALARM, &isd); break; case DAHDI_EVENT_NOALARM: - /* FIXME: alarm has gone, we should re-start the SABM requests */ + /* alarm has gone, we should re-start the SABM requests */ + dispatch_signal(SS_INPUT, S_INP_LINE_NOALARM, &isd); break; } }