diff --git a/TODO-RELEASE b/TODO-RELEASE index 5f2f654..99d9735 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -9,3 +9,4 @@ #library what description / commit summary line libosmo-abis struct e1inp_driver Field added at the end (ABI break) libosmocodec >1.8.0 osmo_{fr,efr}_sid_classify() new functions +libosmo-abis struct e1inp_driver Field added (line_create callback) at the end (ABI break) diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h index a66f8eb..b40382e 100644 --- a/include/osmocom/abis/e1_input.h +++ b/include/osmocom/abis/e1_input.h @@ -190,6 +190,9 @@ struct e1inp_driver { /* Set Sa bits to transmit in TS0 (MSB to LSB): Sa8 Sa7 Sa5 Sa4 Sa64 Sa63 Sa62 Sa61/Sa6 */ int (*set_sa_bits)(struct e1inp_line *line, uint8_t sa_bits); + + /* Optional callback to perform driver specific initialization when the line is created. */ + int (*line_create)(struct e1inp_line *line); }; struct e1inp_line_ops { diff --git a/src/e1_input.c b/src/e1_input.c index e3ac67e..6fca307 100644 --- a/src/e1_input.c +++ b/src/e1_input.c @@ -639,8 +639,16 @@ e1inp_line_create(uint8_t e1_nr, const char *driver_name) line->use_count.talloc_object = line; line->use_count.use_cb = e1inp_line_use_cb; - e1inp_line_get2(line, "ctor"); + if (driver->line_create) { + if (driver->line_create(line) < 0) { + LOGPIL(line, DLINP, LOGL_ERROR, "Cannot initialize line driver\n"); + talloc_free(line); + return NULL; + } + } + + e1inp_line_get2(line, "ctor"); llist_add_tail(&line->list, &e1inp_line_list); return line;