e1d: Use line->port_nr to specify e1d interface/line
This way we can support more than one E1 line via osmo-e1d. As
neither mISDN nor DAHDI distinguish between mutliple cards of single
ports vs. multi-port cards, we havee to map both interface + line number
into a single uint8_t.
Change-Id: I3b6975624a0155a68d2c67bfdbc1fb751fb50b13
diff --git a/src/input/e1d.c b/src/input/e1d.c
index c15c081..e111d14 100644
--- a/src/input/e1d.c
+++ b/src/input/e1d.c
@@ -179,11 +179,17 @@
int ts;
int ret;
+ /* we use higher 4 bits for interface, lower 4 bits for line,
+ * resulting in max. 16 interfaces with 16 lines each */
+ uint8_t e1d_intf = (line->port_nr >> 4) & 0xF;
+ uint8_t e1d_line = line->port_nr & 0xF;
+
if (line->driver != &e1d_driver)
return -EINVAL;
- LOGP(DLINP, LOGL_ERROR, "Line update %d %d %d\n", line->num, line->port_nr, line->num_ts);
+ LOGP(DLINP, LOGL_NOTICE, "Line update %d %d=E1D(%d:%d) %d\n", line->num, line->port_nr,
+ e1d_intf, e1d_line, line->num_ts);
for (ts=1; ts<line->num_ts; ts++)
{
@@ -212,8 +218,10 @@
}
continue;
case E1INP_TS_TYPE_SIGN:
- if (bfd->fd <= 0)
- bfd->fd = osmo_e1dp_client_ts_open(g_e1d, 0, 0, ts, E1DP_TSMODE_HDLCFCS);
+ if (bfd->fd <= 0) {
+ bfd->fd = osmo_e1dp_client_ts_open(g_e1d, e1d_intf, e1d_line, ts,
+ E1DP_TSMODE_HDLCFCS);
+ }
if (bfd->fd < 0) {
LOGP(DLINP, LOGL_ERROR,
"Could not open timeslot %d\n", ts);