diff options
author | Holger Freyther <zecke@selfish.org> | 2009-04-22 22:08:07 +0000 |
---|---|---|
committer | Holger Freyther <zecke@selfish.org> | 2009-04-22 22:08:07 +0000 |
commit | b5c00f5587d7e01393e9ca7024a80cea2b2f6e7f (patch) | |
tree | e1159d19e37fd2ef7c76617f4e5bc9f49790494e /src/input/misdn.c | |
parent | dda22c18b5daaab7fa26f1eeff7dcc849a99c0cc (diff) |
[misdn] Add option to automatically release layer2 on exit
Patch by Andreas Eversberg to automatically release
layer2 on exit of the application. Made the naming of
the variables consistent (only release_l2 and not both
release_l2 and l2_release).
Diffstat (limited to 'src/input/misdn.c')
-rw-r--r-- | src/input/misdn.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/input/misdn.c b/src/input/misdn.c index 245df50d8..a5860a0ca 100644 --- a/src/input/misdn.c +++ b/src/input/misdn.c @@ -350,7 +350,7 @@ struct e1inp_driver misdn_driver = { .want_write = ts_want_write, }; -static int mi_e1_setup(struct e1inp_line *line) +static int mi_e1_setup(struct e1inp_line *line, int release_l2) { struct mi_e1_handle *e1h = line->driver_data; int ts, ret; @@ -416,6 +416,15 @@ static int mi_e1_setup(struct e1inp_line *line) return -EIO; } + if (e1i_ts->type == E1INP_TS_TYPE_SIGN && release_l2) { + int clean = 1; + ret = ioctl(bfd->fd, IMCLEAR_L2, &clean); + if (ret < 0) { + fprintf(stderr, "could not send IOCTL IMCLEAN_L2 %s\n", strerror(errno)); + return -EIO; + } + } + /* FIXME: only activate B-Channels once we start to * use them to conserve CPU power */ if (e1i_ts->type == E1INP_TS_TYPE_TRAU) @@ -432,7 +441,7 @@ static int mi_e1_setup(struct e1inp_line *line) return 0; } -int mi_setup(int cardnr, struct e1inp_line *line) +int mi_setup(int cardnr, struct e1inp_line *line, int release_l2) { struct mi_e1_handle *e1h; int sk, ret, cnt; @@ -486,7 +495,7 @@ int mi_setup(int cardnr, struct e1inp_line *line) fprintf(stdout, " name: %s\n", devinfo.name); #endif - ret = mi_e1_setup(line); + ret = mi_e1_setup(line, release_l2); if (ret) return ret; |