From 9e85b54799e25c857bce5861a8cc5046b2f5c6c9 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 4 Aug 2009 14:11:49 +0200 Subject: prepare mISDN driver for multiple lines/instances In order to use multiple mISDN cards, we need to: 1) move driver initialization out of line initialization 2) make sure we allow partial (virtual) E1 cards with < 30 B-channels --- openbsc/src/input/misdn.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'openbsc/src') diff --git a/openbsc/src/input/misdn.c b/openbsc/src/input/misdn.c index a04c2abd7..2ec74b8ea 100644 --- a/openbsc/src/input/misdn.c +++ b/openbsc/src/input/misdn.c @@ -477,14 +477,7 @@ int mi_setup(int cardnr, struct e1inp_line *line, int release_l2) int sk, ret, cnt; struct mISDN_devinfo devinfo; - /* register the driver with the core */ - /* FIXME: do this in the plugin initializer function */ - ret = e1inp_driver_register(&misdn_driver); - if (ret) - return ret; - /* create the actual line instance */ - /* FIXME: do this independent of driver registration */ e1h = talloc(tall_bsc_ctx, struct mi_e1_handle); memset(e1h, 0, sizeof(*e1h)); @@ -531,14 +524,15 @@ int mi_setup(int cardnr, struct e1inp_line *line, int release_l2) return -EINVAL; } - if (devinfo.nrbchan != 30) { - fprintf(stderr, "error: E1 card has no 30 B-channels\n"); - return -EINVAL; - } - ret = mi_e1_setup(line, release_l2); if (ret) return ret; return e1inp_line_register(line); } + +static __attribute__((constructor)) void on_dso_load_sms(void) +{ + /* register the driver with the core */ + e1inp_driver_register(&misdn_driver); +} -- cgit v1.2.3