DAHDI: Deliver ALARM/NOALARM as input signal to RBS2000 driver

... and re-start LAPD SABM as required
This commit is contained in:
Harald Welte 2011-02-13 14:26:54 +01:00
parent b3d70fd0bd
commit 174a51a761
3 changed files with 25 additions and 5 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}
}