aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-01-12 13:36:56 +0100
committerHarald Welte <laforge@osmocom.org>2020-01-12 14:24:24 +0100
commitaccd677414bba9adab4ac2e7979695ebea2dc586 (patch)
tree7038b4211dada6c40a75a60402a7f2cf124a9d9c
parent28898d1fa7ce81b33b94b918ccc84b828fe9427c (diff)
e1d: Don't connect to e1d at program start time
Let's not print an error at program/library start time if osmo-e1d cannot be reached. This error is confusing to everyone who may have a libosmo-abis with e1d support compiled in, but who is not (currently) using any lines via this driver, but others drivers. Change-Id: If0d033f8a2ab4f0e72549a811ffccc66b91fb0a8
-rw-r--r--src/input/e1d.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/input/e1d.c b/src/input/e1d.c
index 2b67141..c32e330 100644
--- a/src/input/e1d.c
+++ b/src/input/e1d.c
@@ -186,6 +186,14 @@ e1d_line_update(struct e1inp_line *line)
if (line->driver != &e1d_driver)
return -EINVAL;
+ if (!g_e1d) {
+ /* Connect to daemon */
+ g_e1d = osmo_e1dp_client_create(NULL, "/tmp/osmo-e1d.ctl");
+ if (!g_e1d) {
+ LOGPIL(line, DLINP, LOGL_ERROR, "Unable to connect to osmo-e1d daemon\n");
+ return -EPIPE;
+ }
+ }
LOGPIL(line, DLINP, LOGL_NOTICE, "Line update %d %d=E1D(%d:%d) %d\n", line->num, line->port_nr,
e1d_intf, e1d_line, line->num_ts);
@@ -259,13 +267,6 @@ struct e1inp_driver e1d_driver = {
int
e1inp_e1d_init(void)
{
- /* Connect to daemon */
- g_e1d = osmo_e1dp_client_create(NULL, "/tmp/osmo-e1d.ctl");
- if (!g_e1d) {
- LOGP(DLINP, LOGL_ERROR, "Unable to connect to osmo-e1d daemon\n");
- return -EPIPE;
- }
-
/* register the driver with the core */
return e1inp_driver_register(&e1d_driver);
}