blob: d6ba63c64b2e3fd236ab6182afccddbeca24dda5 [file] [log] [blame]
Harald Welte1fa60c82009-02-09 18:13:26 +00001/* OpenBSC Abis input driver for mISDNuser */
2
3/* (C) 2008-2009 by Harald Welte <laforge@gnumonks.org>
4 * (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
5 *
6 * All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 */
23
24#include <stdio.h>
25#include <unistd.h>
26#include <stdlib.h>
27#include <errno.h>
28#include <string.h>
29#include <time.h>
30#include <sys/fcntl.h>
31#include <sys/types.h>
32#include <sys/socket.h>
33#include <sys/ioctl.h>
34#include <arpa/inet.h>
35#include <mISDNif.h>
36
37//#define AF_COMPATIBILITY_FUNC
38//#include <compat_af_isdn.h>
39#define AF_ISDN 34
40#define PF_ISDN AF_ISDN
41
42#include <openbsc/select.h>
43#include <openbsc/msgb.h>
44#include <openbsc/debug.h>
45#include <openbsc/gsm_data.h>
46#include <openbsc/abis_nm.h>
47#include <openbsc/abis_rsl.h>
48#include <openbsc/subchan_demux.h>
49#include <openbsc/e1_input.h>
50
51/* data structure for one E1 interface with A-bis */
52struct mi_e1_handle {
53 /* The mISDN card number of the card we use */
54 int cardnr;
55};
56
57#define TS1_ALLOC_SIZE 300
58
59struct prim_name {
60 unsigned int prim;
61 const char *name;
62};
63
64const struct prim_name prim_names[] = {
Holger Freythercbc7b062009-02-09 23:10:48 +000065 { PH_CONTROL_IND, "PH_CONTROL_IND" },
66 { PH_DATA_IND, "PH_DATA_IND" },
67 { PH_DATA_CNF, "PH_DATA_CNF" },
Holger Freyther5d7e5572009-02-10 18:40:45 +000068 { PH_ACTIVATE_IND, "PH_ACTIVATE_IND" },
Harald Welte1fa60c82009-02-09 18:13:26 +000069 { DL_ESTABLISH_IND, "DL_ESTABLISH_IND" },
70 { DL_ESTABLISH_CNF, "DL_ESTABLISH_CNF" },
71 { DL_RELEASE_IND, "DL_RELEASE_IND" },
72 { DL_RELEASE_CNF, "DL_RELEASE_CNF" },
73 { DL_DATA_IND, "DL_DATA_IND" },
74 { DL_UNITDATA_IND, "DL_UNITDATA_IND" },
75 { DL_INFORMATION_IND, "DL_INFORMATION_IND" },
76 { MPH_ACTIVATE_IND, "MPH_ACTIVATE_IND" },
77 { MPH_DEACTIVATE_IND, "MPH_DEACTIVATE_IND" },
78};
79
80const char *get_prim_name(unsigned int prim)
81{
82 int i;
83
84 for (i = 0; i < ARRAY_SIZE(prim_names); i++) {
85 if (prim_names[i].prim == prim)
86 return prim_names[i].name;
87 }
88
89 return "UNKNOWN";
90}
91
92static int handle_ts1_read(struct bsc_fd *bfd)
93{
94 struct e1inp_line *line = bfd->data;
95 unsigned int ts_nr = bfd->priv_nr;
96 struct e1inp_ts *e1i_ts = &line->ts[ts_nr-1];
97 struct e1inp_sign_link *link;
98 struct msgb *msg = msgb_alloc(TS1_ALLOC_SIZE);
99 struct sockaddr_mISDN l2addr;
100 struct mISDNhead *hh;
101 socklen_t alen;
102 int ret;
103
104 if (!msg)
105 return -ENOMEM;
106
107 hh = (struct mISDNhead *) msg->data;
108
109 alen = sizeof(l2addr);
110 ret = recvfrom(bfd->fd, msg->data, 300, 0,
111 (struct sockaddr *) &l2addr, &alen);
112 if (ret < 0) {
113 fprintf(stderr, "recvfrom error %s\n", strerror(errno));
114 return ret;
115 }
116
Holger Freytheracb688b2009-05-01 04:59:55 +0000117 if (alen != sizeof(l2addr)) {
118 fprintf(stderr, "%s error len\n", __func__);
Harald Welte1fa60c82009-02-09 18:13:26 +0000119 return -EINVAL;
Holger Freytheracb688b2009-05-01 04:59:55 +0000120 }
Harald Welte1fa60c82009-02-09 18:13:26 +0000121
122 msgb_put(msg, ret);
123
124 DEBUGP(DMI, "alen =%d, dev(%d) channel(%d) sapi(%d) tei(%d)\n",
125 alen, l2addr.dev, l2addr.channel, l2addr.sapi, l2addr.tei);
126
Holger Freyther57dd7bf2009-02-10 01:04:22 +0000127 DEBUGP(DMI, "<= len = %d, prim(0x%x) id(0x%x): %s\n",
128 ret, hh->prim, hh->id, get_prim_name(hh->prim));
Harald Welte1fa60c82009-02-09 18:13:26 +0000129
130 switch (hh->prim) {
131 case DL_INFORMATION_IND:
132 /* mISDN tells us which channel number is allocated for this
133 * tuple of (SAPI, TEI). */
Holger Freytheracb688b2009-05-01 04:59:55 +0000134 DEBUGP(DMI, "DL_INFORMATION_IND: use channel(%d) sapi(%d) tei(%d) for now\n",
Harald Welte1fa60c82009-02-09 18:13:26 +0000135 l2addr.channel, l2addr.sapi, l2addr.tei);
136 link = e1inp_lookup_sign_link(e1i_ts, l2addr.tei, l2addr.sapi);
137 if (!link) {
138 DEBUGPC(DMI, "mISDN message for unknown sign_link\n");
139 free(msg);
140 return -EINVAL;
141 }
142 /* save the channel number in the driver private struct */
143 link->driver.misdn.channel = l2addr.channel;
144 break;
Harald Welte7d144762009-05-23 05:40:49 +0000145 case DL_ESTABLISH_IND:
146 DEBUGP(DMI, "DL_ESTABLISH_IND: channel(%d) sapi(%d) tei(%d)\n",
147 l2addr.channel, l2addr.sapi, l2addr.tei);
Harald Welte1fa60c82009-02-09 18:13:26 +0000148 ret = e1inp_event(e1i_ts, EVT_E1_TEI_UP, l2addr.tei, l2addr.sapi);
149 break;
Harald Welte7d144762009-05-23 05:40:49 +0000150 case DL_RELEASE_IND:
151 DEBUGP(DMI, "DL_RELEASE_IND: channel(%d) sapi(%d) tei(%d)\n",
152 l2addr.channel, l2addr.sapi, l2addr.tei);
Harald Welte1fa60c82009-02-09 18:13:26 +0000153 ret = e1inp_event(e1i_ts, EVT_E1_TEI_DN, l2addr.tei, l2addr.sapi);
154 break;
155 case DL_DATA_IND:
Harald Welte1fa60c82009-02-09 18:13:26 +0000156 msg->l2h = msg->data + MISDN_HEADER_LEN;
Harald Welte3cc4bf52009-02-28 13:08:01 +0000157 DEBUGP(DMI, "RX: %s\n", hexdump(msgb_l2(msg), ret - MISDN_HEADER_LEN));
Harald Welte1fa60c82009-02-09 18:13:26 +0000158 ret = e1inp_rx_ts(e1i_ts, msg, l2addr.tei, l2addr.sapi);
159 break;
Harald Welte7d144762009-05-23 05:40:49 +0000160 case PH_ACTIVATE_IND:
161 DEBUGP(DMI, "PH_ACTIVATE_IND: channel(%d) sapi(%d) tei(%d)\n",
162 l2addr.channel, l2addr.sapi, l2addr.tei);
163 break;
164 case PH_DEACTIVATE_IND:
165 DEBUGP(DMI, "PH_DEACTIVATE_IND: channel(%d) sapi(%d) tei(%d)\n",
166 l2addr.channel, l2addr.sapi, l2addr.tei);
167 break;
Harald Welte1fa60c82009-02-09 18:13:26 +0000168 default:
169 break;
170 }
171 return ret;
172}
173
174static int handle_ts1_write(struct bsc_fd *bfd)
175{
176 struct e1inp_line *line = bfd->data;
177 unsigned int ts_nr = bfd->priv_nr;
178 struct e1inp_ts *e1i_ts = &line->ts[ts_nr-1];
179 struct e1inp_sign_link *sign_link;
180 struct sockaddr_mISDN sa;
181 struct msgb *msg;
182 struct mISDNhead *hh;
183 u_int8_t *l2_data;
184 int ret;
185
186 /* get the next msg for this timeslot */
187 msg = e1inp_tx_ts(e1i_ts, &sign_link);
188 if (!msg) {
189 bfd->when &= ~BSC_FD_WRITE;
190 return 0;
191 }
192
193 l2_data = msg->data;
194
195 /* prepend the mISDNhead */
196 hh = (struct mISDNhead *) msgb_push(msg, sizeof(*hh));
197 hh->prim = DL_DATA_REQ;
198
Holger Freytheracb688b2009-05-01 04:59:55 +0000199 DEBUGP(DMI, "TX TEI(%d) SAPI(%d): %s\n", sign_link->tei,
200 sign_link->sapi, hexdump(l2_data, msg->len - MISDN_HEADER_LEN));
Harald Welte1fa60c82009-02-09 18:13:26 +0000201
202 /* construct the sockaddr */
203 sa.family = AF_ISDN;
204 sa.sapi = sign_link->sapi;
205 sa.dev = sign_link->tei;
206 sa.channel = sign_link->driver.misdn.channel;
207
208 ret = sendto(bfd->fd, msg->data, msg->len, 0,
209 (struct sockaddr *)&sa, sizeof(sa));
Holger Freytheracb688b2009-05-01 04:59:55 +0000210 if (ret < 0)
211 fprintf(stderr, "%s sendto failed %d\n", __func__, ret);
Harald Welte1fa60c82009-02-09 18:13:26 +0000212 msgb_free(msg);
213
214 /* FIXME: this has to go */
215 usleep(100000);
216
217 return ret;
218}
219
Harald Weltef9227c72009-02-18 03:39:00 +0000220#define BCHAN_TX_GRAN 160
Harald Welte8ffcfed2009-02-10 18:18:50 +0000221/* write to a B channel TS */
222static int handle_tsX_write(struct bsc_fd *bfd)
223{
224 struct e1inp_line *line = bfd->data;
225 unsigned int ts_nr = bfd->priv_nr;
226 struct e1inp_ts *e1i_ts = &line->ts[ts_nr-1];
227 struct mISDNhead *hh;
228 u_int8_t tx_buf[BCHAN_TX_GRAN + sizeof(*hh)];
229 struct subch_mux *mx = &e1i_ts->trau.mux;
230 int ret;
Harald Welte1fa60c82009-02-09 18:13:26 +0000231
Harald Welte8ffcfed2009-02-10 18:18:50 +0000232 hh = (struct mISDNhead *) tx_buf;
233 hh->prim = PH_DATA_REQ;
234
235 subchan_mux_out(mx, tx_buf+sizeof(*hh), BCHAN_TX_GRAN);
236
Harald Welte3cc4bf52009-02-28 13:08:01 +0000237 DEBUGP(DMIB, "BCHAN TX: %s\n",
238 hexdump(tx_buf+sizeof(*hh), BCHAN_TX_GRAN));
Harald Welte8ffcfed2009-02-10 18:18:50 +0000239
240 ret = send(bfd->fd, tx_buf, sizeof(*hh) + BCHAN_TX_GRAN, 0);
241 if (ret < sizeof(*hh) + BCHAN_TX_GRAN)
242 DEBUGP(DMIB, "send returns %d instead of %u\n", ret,
243 sizeof(*hh) + BCHAN_TX_GRAN);
244
245 return ret;
246}
247
248#define TSX_ALLOC_SIZE 4096
Harald Welte1fa60c82009-02-09 18:13:26 +0000249/* FIXME: read from a B channel TS */
250static int handle_tsX_read(struct bsc_fd *bfd)
251{
252 struct e1inp_line *line = bfd->data;
253 unsigned int ts_nr = bfd->priv_nr;
254 struct e1inp_ts *e1i_ts = &line->ts[ts_nr-1];
255 struct msgb *msg = msgb_alloc(TSX_ALLOC_SIZE);
256 struct mISDNhead *hh;
257 int ret;
258
259 if (!msg)
260 return -ENOMEM;
261
262 hh = (struct mISDNhead *) msg->data;
263
264 ret = recv(bfd->fd, msg->data, TSX_ALLOC_SIZE, 0);
265 if (ret < 0) {
266 fprintf(stderr, "recvfrom error %s\n", strerror(errno));
267 return ret;
268 }
269
270 msgb_put(msg, ret);
271
Holger Freytheracb688b2009-05-01 04:59:55 +0000272 if (hh->prim != PH_CONTROL_IND)
273 DEBUGP(DMIB, "<= BCHAN len = %d, prim(0x%x) id(0x%x): %s\n",
274 ret, hh->prim, hh->id, get_prim_name(hh->prim));
Harald Welte1fa60c82009-02-09 18:13:26 +0000275
276 switch (hh->prim) {
277 case PH_DATA_IND:
278 msg->l2h = msg->data + MISDN_HEADER_LEN;
Harald Welte3cc4bf52009-02-28 13:08:01 +0000279 DEBUGP(DMIB, "BCHAN RX: %s\n",
280 hexdump(msgb_l2(msg), ret - MISDN_HEADER_LEN));
Harald Welte1fa60c82009-02-09 18:13:26 +0000281 ret = e1inp_rx_ts(e1i_ts, msg, 0, 0);
282 break;
Holger Freyther5d7e5572009-02-10 18:40:45 +0000283 case PH_ACTIVATE_IND:
Harald Welte8ffcfed2009-02-10 18:18:50 +0000284 case PH_DATA_CNF:
285 /* physical layer indicates that data has been sent,
286 * we thus can send some more data */
287 ret = handle_tsX_write(bfd);
Harald Welte1fa60c82009-02-09 18:13:26 +0000288 default:
289 break;
290 }
291 /* FIXME: why do we free signalling msgs in the caller, and trau not? */
292 msgb_free(msg);
293
294 return ret;
295}
296
Harald Welte1fa60c82009-02-09 18:13:26 +0000297/* callback from select.c in case one of the fd's can be read/written */
298static int misdn_fd_cb(struct bsc_fd *bfd, unsigned int what)
299{
300 struct e1inp_line *line = bfd->data;
301 unsigned int ts_nr = bfd->priv_nr;
302 unsigned int idx = ts_nr-1;
303 struct e1inp_ts *e1i_ts = &line->ts[idx];
304 int rc = 0;
305
306 switch (e1i_ts->type) {
307 case E1INP_TS_TYPE_SIGN:
308 if (what & BSC_FD_READ)
309 rc = handle_ts1_read(bfd);
310 if (what & BSC_FD_WRITE)
311 rc = handle_ts1_write(bfd);
312 break;
313 case E1INP_TS_TYPE_TRAU:
314 if (what & BSC_FD_READ)
315 rc = handle_tsX_read(bfd);
Harald Welte8ffcfed2009-02-10 18:18:50 +0000316 /* We never include the mISDN B-Channel FD into the
317 * writeset, since it doesn't support poll() based
318 * write flow control */
Harald Welte1fa60c82009-02-09 18:13:26 +0000319 break;
320 default:
321 fprintf(stderr, "unknown E1 TS type %u\n", e1i_ts->type);
322 break;
323 }
324
325 return rc;
326}
327
328static int activate_bchan(struct e1inp_line *line, int ts, int act)
329{
330 struct mISDNhead hh;
331 int ret;
332 unsigned int idx = ts-1;
333 struct e1inp_ts *e1i_ts = &line->ts[idx];
334 struct bsc_fd *bfd = &e1i_ts->driver.misdn.fd;
335
336 fprintf(stdout, "activate bchan\n");
337 if (act)
338 hh.prim = PH_ACTIVATE_REQ;
339 else
340 hh.prim = PH_DEACTIVATE_REQ;
341
342 hh.id = MISDN_ID_ANY;
343 ret = sendto(bfd->fd, &hh, sizeof(hh), 0, NULL, 0);
344 if (ret < 0) {
345 fprintf(stdout, "could not send ACTIVATE_RQ %s\n",
346 strerror(errno));
347 }
348
349 return ret;
350}
351
352static int ts_want_write(struct e1inp_ts *e1i_ts)
353{
Harald Welte8ffcfed2009-02-10 18:18:50 +0000354 /* We never include the mISDN B-Channel FD into the
355 * writeset, since it doesn't support poll() based
356 * write flow control */
357 if (e1i_ts->type == E1INP_TS_TYPE_TRAU)
358 return 0;
359
Harald Welte1fa60c82009-02-09 18:13:26 +0000360 e1i_ts->driver.misdn.fd.when |= BSC_FD_WRITE;
361
362 return 0;
363}
364
365struct e1inp_driver misdn_driver = {
366 .name = "mISDNuser",
367 .want_write = ts_want_write,
368};
369
Holger Freytherb5c00f52009-04-22 22:08:07 +0000370static int mi_e1_setup(struct e1inp_line *line, int release_l2)
Harald Welte1fa60c82009-02-09 18:13:26 +0000371{
372 struct mi_e1_handle *e1h = line->driver_data;
373 int ts, ret;
374
375 /* TS0 is CRC4, don't need any fd for it */
376 for (ts = 1; ts < NUM_E1_TS; ts++) {
377 unsigned int idx = ts-1;
378 struct e1inp_ts *e1i_ts = &line->ts[idx];
379 struct bsc_fd *bfd = &e1i_ts->driver.misdn.fd;
380 struct sockaddr_mISDN addr;
381
382 bfd->data = line;
383 bfd->priv_nr = ts;
384 bfd->cb = misdn_fd_cb;
385
386 switch (e1i_ts->type) {
387 case E1INP_TS_TYPE_NONE:
388 continue;
389 break;
390 case E1INP_TS_TYPE_SIGN:
391 bfd->fd = socket(PF_ISDN, SOCK_DGRAM, ISDN_P_LAPD_NT);
392 bfd->when = BSC_FD_READ;
393 break;
394 case E1INP_TS_TYPE_TRAU:
395 bfd->fd = socket(PF_ISDN, SOCK_DGRAM, ISDN_P_B_RAW);
Harald Welte8ffcfed2009-02-10 18:18:50 +0000396 /* We never include the mISDN B-Channel FD into the
397 * writeset, since it doesn't support poll() based
398 * write flow control */
399 bfd->when = BSC_FD_READ;
Harald Welte1fa60c82009-02-09 18:13:26 +0000400 break;
401 }
402
403 if (bfd->fd < 0) {
Holger Freytheracb688b2009-05-01 04:59:55 +0000404 fprintf(stderr, "%s could not open socket %s\n",
405 __func__, strerror(errno));
Harald Welte1fa60c82009-02-09 18:13:26 +0000406 return bfd->fd;
407 }
408
409 memset(&addr, 0, sizeof(addr));
410 addr.family = AF_ISDN;
411 addr.dev = e1h->cardnr;
412 switch (e1i_ts->type) {
413 case E1INP_TS_TYPE_SIGN:
414 addr.channel = 0;
415 /* SAPI not supported yet in kernel */
416 //addr.sapi = e1inp_ts->sign.sapi;
417 addr.sapi = 0;
418 addr.tei = GROUP_TEI;
419 break;
420 case E1INP_TS_TYPE_TRAU:
421 addr.channel = ts;
422 break;
423 default:
424 DEBUGP(DMI, "unsupported E1 TS type: %u\n",
425 e1i_ts->type);
426 break;
427 }
428
429 ret = bind(bfd->fd, (struct sockaddr *) &addr, sizeof(addr));
430 if (ret < 0) {
431 fprintf(stderr, "could not bind l2 socket %s\n",
432 strerror(errno));
433 return -EIO;
434 }
435
Holger Freytherb5c00f52009-04-22 22:08:07 +0000436 if (e1i_ts->type == E1INP_TS_TYPE_SIGN && release_l2) {
437 int clean = 1;
438 ret = ioctl(bfd->fd, IMCLEAR_L2, &clean);
439 if (ret < 0) {
440 fprintf(stderr, "could not send IOCTL IMCLEAN_L2 %s\n", strerror(errno));
441 return -EIO;
442 }
443 }
444
Harald Welte1fa60c82009-02-09 18:13:26 +0000445 /* FIXME: only activate B-Channels once we start to
446 * use them to conserve CPU power */
447 if (e1i_ts->type == E1INP_TS_TYPE_TRAU)
448 activate_bchan(line, ts, 1);
449
450 ret = bsc_register_fd(bfd);
451 if (ret < 0) {
452 fprintf(stderr, "could not register FD: %s\n",
453 strerror(ret));
454 return ret;
455 }
456 }
457
458 return 0;
459}
460
Holger Freytherb5c00f52009-04-22 22:08:07 +0000461int mi_setup(int cardnr, struct e1inp_line *line, int release_l2)
Harald Welte1fa60c82009-02-09 18:13:26 +0000462{
463 struct mi_e1_handle *e1h;
464 int sk, ret, cnt;
465 struct mISDN_devinfo devinfo;
466
467 /* register the driver with the core */
468 /* FIXME: do this in the plugin initializer function */
469 ret = e1inp_driver_register(&misdn_driver);
470 if (ret)
471 return ret;
472
473 /* create the actual line instance */
474 /* FIXME: do this independent of driver registration */
475 e1h = malloc(sizeof(*e1h));
476 memset(e1h, 0, sizeof(*e1h));
477
478 e1h->cardnr = cardnr;
479
480 line->driver = &misdn_driver;
481 line->driver_data = e1h;
482
483 /* open the ISDN card device */
484 sk = socket(PF_ISDN, SOCK_RAW, ISDN_P_BASE);
485 if (sk < 0) {
Holger Freytheracb688b2009-05-01 04:59:55 +0000486 fprintf(stderr, "%s could not open socket %s\n",
487 __func__, strerror(errno));
Harald Welte1fa60c82009-02-09 18:13:26 +0000488 return sk;
489 }
490
491 ret = ioctl(sk, IMGETCOUNT, &cnt);
492 if (ret) {
Holger Freytheracb688b2009-05-01 04:59:55 +0000493 fprintf(stderr, "%s error getting interf count: %s\n",
494 __func__, strerror(errno));
Harald Welte1fa60c82009-02-09 18:13:26 +0000495 close(sk);
496 return -ENODEV;
497 }
498 //DEBUGP(DMI,"%d device%s found\n", cnt, (cnt==1)?"":"s");
499 printf("%d device%s found\n", cnt, (cnt==1)?"":"s");
500#if 1
501 devinfo.id = e1h->cardnr;
502 ret = ioctl(sk, IMGETDEVINFO, &devinfo);
503 if (ret < 0) {
504 fprintf(stdout, "error getting info for device %d: %s\n",
505 e1h->cardnr, strerror(errno));
506 return -ENODEV;
507 }
508 fprintf(stdout, " id: %d\n", devinfo.id);
509 fprintf(stdout, " Dprotocols: %08x\n", devinfo.Dprotocols);
510 fprintf(stdout, " Bprotocols: %08x\n", devinfo.Bprotocols);
511 fprintf(stdout, " protocol: %d\n", devinfo.protocol);
512 fprintf(stdout, " nrbchan: %d\n", devinfo.nrbchan);
513 fprintf(stdout, " name: %s\n", devinfo.name);
514#endif
515
Holger Freytheracb688b2009-05-01 04:59:55 +0000516 if (!(devinfo.Dprotocols & (1 << ISDN_P_NT_E1))) {
517 fprintf(stderr, "error: card is not of type E1 (NT-mode)\n");
518 return -EINVAL;
519 }
520
521 if (devinfo.nrbchan != 30) {
522 fprintf(stderr, "error: E1 card has no 30 B-channels\n");
523 return -EINVAL;
524 }
525
Holger Freytherb5c00f52009-04-22 22:08:07 +0000526 ret = mi_e1_setup(line, release_l2);
Harald Welte1fa60c82009-02-09 18:13:26 +0000527 if (ret)
528 return ret;
529
530 return e1inp_line_register(line);
531}