e1_input: add 'port_nr' field and support DAHDI T1 cards
the "e1_line <0-255> port <0-255>" vty command allows the user to
set which physical port/card number should be represented by the
given virtual e1_line.
Furthermore, we now actually query the DAHDI hardware to determine the
number of ports of a given span (e.g. only 24 in case of T1) instead of
blindly assuming there are 31 timeslots on each port.
This specifically will fix T1 timeslot (/dev/dahdi/%u) calculation in
setups with multiple DAHDI spans/ports and a T1 span != span 1.
diff --git a/src/input/misdn.c b/src/input/misdn.c
index 716c1e7..fce6150 100644
--- a/src/input/misdn.c
+++ b/src/input/misdn.c
@@ -495,7 +495,7 @@
memset(&addr, 0, sizeof(addr));
addr.family = AF_ISDN;
- addr.dev = line->num;
+ addr.dev = line->port_nr;
switch (e1i_ts->type) {
case E1INP_TS_TYPE_SIGN:
if (mline->use_userspace_lapd) {
@@ -579,11 +579,11 @@
//DEBUGP(DLMI,"%d device%s found\n", cnt, (cnt==1)?"":"s");
printf("%d device%s found\n", cnt, (cnt==1)?"":"s");
#if 1
- devinfo.id = line->num;
+ devinfo.id = line->port_nr;
ret = ioctl(sk, IMGETDEVINFO, &devinfo);
if (ret < 0) {
fprintf(stdout, "error getting info for device %d: %s\n",
- line->num, strerror(errno));
+ line->port_nr, strerror(errno));
return -ENODEV;
}
fprintf(stdout, " id: %d\n", devinfo.id);