diff options
author | Joe Perches <joe@perches.com> | 2012-02-19 22:52:38 -0500 |
---|---|---|
committer | Joe Perches <joe@perches.com> | 2012-02-21 12:04:01 -0500 |
commit | 475be4d85a274d0961593db41cf85689db1d583c (patch) | |
tree | b2b8931eb747794730522c3cf1898e46948527b9 /drivers/isdn/isdnloop/isdnloop.c | |
parent | 0b0a635f79f91f3755b6518627ea06dd0dbfd523 (diff) |
isdn: whitespace coding style cleanup
isdn source code uses a not-current coding style.
Update the coding style used on a per-line basis
so that git diff -w shows only elided blank lines
at EOF.
Done with emacs and some scripts and some typing.
Built x86 allyesconfig.
No detected change in objdump -d or size.
Signed-off-by: Joe Perches <joe@perches.com>
Diffstat (limited to 'drivers/isdn/isdnloop/isdnloop.c')
-rw-r--r-- | drivers/isdn/isdnloop/isdnloop.c | 958 |
1 files changed, 479 insertions, 479 deletions
diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c index d497db0a26d0..5405ec644db3 100644 --- a/drivers/isdn/isdnloop/isdnloop.c +++ b/drivers/isdn/isdnloop/isdnloop.c | |||
@@ -35,7 +35,7 @@ static int isdnloop_addcard(char *); | |||
35 | * channel = channel number | 35 | * channel = channel number |
36 | */ | 36 | */ |
37 | static void | 37 | static void |
38 | isdnloop_free_queue(isdnloop_card * card, int channel) | 38 | isdnloop_free_queue(isdnloop_card *card, int channel) |
39 | { | 39 | { |
40 | struct sk_buff_head *queue = &card->bqueue[channel]; | 40 | struct sk_buff_head *queue = &card->bqueue[channel]; |
41 | 41 | ||
@@ -52,7 +52,7 @@ isdnloop_free_queue(isdnloop_card * card, int channel) | |||
52 | * ch = channel number (0-based) | 52 | * ch = channel number (0-based) |
53 | */ | 53 | */ |
54 | static void | 54 | static void |
55 | isdnloop_bchan_send(isdnloop_card * card, int ch) | 55 | isdnloop_bchan_send(isdnloop_card *card, int ch) |
56 | { | 56 | { |
57 | isdnloop_card *rcard = card->rcard[ch]; | 57 | isdnloop_card *rcard = card->rcard[ch]; |
58 | int rch = card->rch[ch], len, ack; | 58 | int rch = card->rch[ch], len, ack; |
@@ -66,7 +66,7 @@ isdnloop_bchan_send(isdnloop_card * card, int ch) | |||
66 | ack = *(skb->head); /* used as scratch area */ | 66 | ack = *(skb->head); /* used as scratch area */ |
67 | cmd.driver = card->myid; | 67 | cmd.driver = card->myid; |
68 | cmd.arg = ch; | 68 | cmd.arg = ch; |
69 | if (rcard){ | 69 | if (rcard) { |
70 | rcard->interface.rcvcallb_skb(rcard->myid, rch, skb); | 70 | rcard->interface.rcvcallb_skb(rcard->myid, rch, skb); |
71 | } else { | 71 | } else { |
72 | printk(KERN_WARNING "isdnloop: no rcard, skb dropped\n"); | 72 | printk(KERN_WARNING "isdnloop: no rcard, skb dropped\n"); |
@@ -119,7 +119,7 @@ isdnloop_pollbchan(unsigned long data) | |||
119 | * cmd = pointer to struct to be filled. | 119 | * cmd = pointer to struct to be filled. |
120 | */ | 120 | */ |
121 | static void | 121 | static void |
122 | isdnloop_parse_setup(char *setup, isdn_ctrl * cmd) | 122 | isdnloop_parse_setup(char *setup, isdn_ctrl *cmd) |
123 | { | 123 | { |
124 | char *t = setup; | 124 | char *t = setup; |
125 | char *s = strchr(t, ','); | 125 | char *s = strchr(t, ','); |
@@ -138,7 +138,7 @@ isdnloop_parse_setup(char *setup, isdn_ctrl * cmd) | |||
138 | cmd->parm.setup.si2 = 0; | 138 | cmd->parm.setup.si2 = 0; |
139 | else | 139 | else |
140 | cmd->parm.setup.si2 = | 140 | cmd->parm.setup.si2 = |
141 | simple_strtoul(t, NULL, 10); | 141 | simple_strtoul(t, NULL, 10); |
142 | strlcpy(cmd->parm.setup.eazmsn, s, sizeof(cmd->parm.setup.eazmsn)); | 142 | strlcpy(cmd->parm.setup.eazmsn, s, sizeof(cmd->parm.setup.eazmsn)); |
143 | cmd->parm.setup.plan = 0; | 143 | cmd->parm.setup.plan = 0; |
144 | cmd->parm.setup.screen = 0; | 144 | cmd->parm.setup.screen = 0; |
@@ -166,7 +166,7 @@ static isdnloop_stat isdnloop_stat_table[] = | |||
166 | {"E_L1: ACT FAIL", ISDN_STAT_BHUP, 8}, /* Layer-1 activation failed */ | 166 | {"E_L1: ACT FAIL", ISDN_STAT_BHUP, 8}, /* Layer-1 activation failed */ |
167 | {"E_L2: DATA LIN", ISDN_STAT_BHUP, 8}, /* Layer-2 data link lost */ | 167 | {"E_L2: DATA LIN", ISDN_STAT_BHUP, 8}, /* Layer-2 data link lost */ |
168 | {"E_L1: ACTIVATION FAILED", | 168 | {"E_L1: ACTIVATION FAILED", |
169 | ISDN_STAT_BHUP, 8}, /* Layer-1 activation failed */ | 169 | ISDN_STAT_BHUP, 8}, /* Layer-1 activation failed */ |
170 | {NULL, 0, -1} | 170 | {NULL, 0, -1} |
171 | }; | 171 | }; |
172 | /* *INDENT-ON* */ | 172 | /* *INDENT-ON* */ |
@@ -183,7 +183,7 @@ static isdnloop_stat isdnloop_stat_table[] = | |||
183 | * card = card where message comes from. | 183 | * card = card where message comes from. |
184 | */ | 184 | */ |
185 | static void | 185 | static void |
186 | isdnloop_parse_status(u_char * status, int channel, isdnloop_card * card) | 186 | isdnloop_parse_status(u_char *status, int channel, isdnloop_card *card) |
187 | { | 187 | { |
188 | isdnloop_stat *s = isdnloop_stat_table; | 188 | isdnloop_stat *s = isdnloop_stat_table; |
189 | int action = -1; | 189 | int action = -1; |
@@ -202,69 +202,69 @@ isdnloop_parse_status(u_char * status, int channel, isdnloop_card * card) | |||
202 | cmd.driver = card->myid; | 202 | cmd.driver = card->myid; |
203 | cmd.arg = channel; | 203 | cmd.arg = channel; |
204 | switch (action) { | 204 | switch (action) { |
205 | case 1: | 205 | case 1: |
206 | /* BCON_x */ | 206 | /* BCON_x */ |
207 | card->flags |= (channel) ? | 207 | card->flags |= (channel) ? |
208 | ISDNLOOP_FLAGS_B2ACTIVE : ISDNLOOP_FLAGS_B1ACTIVE; | 208 | ISDNLOOP_FLAGS_B2ACTIVE : ISDNLOOP_FLAGS_B1ACTIVE; |
209 | break; | 209 | break; |
210 | case 2: | 210 | case 2: |
211 | /* BDIS_x */ | 211 | /* BDIS_x */ |
212 | card->flags &= ~((channel) ? | 212 | card->flags &= ~((channel) ? |
213 | ISDNLOOP_FLAGS_B2ACTIVE : ISDNLOOP_FLAGS_B1ACTIVE); | 213 | ISDNLOOP_FLAGS_B2ACTIVE : ISDNLOOP_FLAGS_B1ACTIVE); |
214 | isdnloop_free_queue(card, channel); | 214 | isdnloop_free_queue(card, channel); |
215 | break; | 215 | break; |
216 | case 3: | 216 | case 3: |
217 | /* DCAL_I and DSCA_I */ | 217 | /* DCAL_I and DSCA_I */ |
218 | isdnloop_parse_setup(status + 6, &cmd); | 218 | isdnloop_parse_setup(status + 6, &cmd); |
219 | break; | 219 | break; |
220 | case 4: | 220 | case 4: |
221 | /* FCALL */ | 221 | /* FCALL */ |
222 | sprintf(cmd.parm.setup.phone, "LEASED%d", card->myid); | 222 | sprintf(cmd.parm.setup.phone, "LEASED%d", card->myid); |
223 | sprintf(cmd.parm.setup.eazmsn, "%d", channel + 1); | 223 | sprintf(cmd.parm.setup.eazmsn, "%d", channel + 1); |
224 | cmd.parm.setup.si1 = 7; | 224 | cmd.parm.setup.si1 = 7; |
225 | cmd.parm.setup.si2 = 0; | 225 | cmd.parm.setup.si2 = 0; |
226 | cmd.parm.setup.plan = 0; | 226 | cmd.parm.setup.plan = 0; |
227 | cmd.parm.setup.screen = 0; | 227 | cmd.parm.setup.screen = 0; |
228 | break; | 228 | break; |
229 | case 5: | 229 | case 5: |
230 | /* CIF */ | 230 | /* CIF */ |
231 | strlcpy(cmd.parm.num, status + 3, sizeof(cmd.parm.num)); | 231 | strlcpy(cmd.parm.num, status + 3, sizeof(cmd.parm.num)); |
232 | break; | 232 | break; |
233 | case 6: | 233 | case 6: |
234 | /* AOC */ | 234 | /* AOC */ |
235 | snprintf(cmd.parm.num, sizeof(cmd.parm.num), "%d", | 235 | snprintf(cmd.parm.num, sizeof(cmd.parm.num), "%d", |
236 | (int) simple_strtoul(status + 7, NULL, 16)); | 236 | (int) simple_strtoul(status + 7, NULL, 16)); |
237 | break; | 237 | break; |
238 | case 7: | 238 | case 7: |
239 | /* CAU */ | 239 | /* CAU */ |
240 | status += 3; | 240 | status += 3; |
241 | if (strlen(status) == 4) | 241 | if (strlen(status) == 4) |
242 | snprintf(cmd.parm.num, sizeof(cmd.parm.num), "%s%c%c", | 242 | snprintf(cmd.parm.num, sizeof(cmd.parm.num), "%s%c%c", |
243 | status + 2, *status, *(status + 1)); | 243 | status + 2, *status, *(status + 1)); |
244 | else | 244 | else |
245 | strlcpy(cmd.parm.num, status + 1, sizeof(cmd.parm.num)); | 245 | strlcpy(cmd.parm.num, status + 1, sizeof(cmd.parm.num)); |
246 | break; | 246 | break; |
247 | case 8: | 247 | case 8: |
248 | /* Misc Errors on L1 and L2 */ | 248 | /* Misc Errors on L1 and L2 */ |
249 | card->flags &= ~ISDNLOOP_FLAGS_B1ACTIVE; | 249 | card->flags &= ~ISDNLOOP_FLAGS_B1ACTIVE; |
250 | isdnloop_free_queue(card, 0); | 250 | isdnloop_free_queue(card, 0); |
251 | cmd.arg = 0; | 251 | cmd.arg = 0; |
252 | cmd.driver = card->myid; | 252 | cmd.driver = card->myid; |
253 | card->interface.statcallb(&cmd); | 253 | card->interface.statcallb(&cmd); |
254 | cmd.command = ISDN_STAT_DHUP; | 254 | cmd.command = ISDN_STAT_DHUP; |
255 | cmd.arg = 0; | 255 | cmd.arg = 0; |
256 | cmd.driver = card->myid; | 256 | cmd.driver = card->myid; |
257 | card->interface.statcallb(&cmd); | 257 | card->interface.statcallb(&cmd); |
258 | cmd.command = ISDN_STAT_BHUP; | 258 | cmd.command = ISDN_STAT_BHUP; |
259 | card->flags &= ~ISDNLOOP_FLAGS_B2ACTIVE; | 259 | card->flags &= ~ISDNLOOP_FLAGS_B2ACTIVE; |
260 | isdnloop_free_queue(card, 1); | 260 | isdnloop_free_queue(card, 1); |
261 | cmd.arg = 1; | 261 | cmd.arg = 1; |
262 | cmd.driver = card->myid; | 262 | cmd.driver = card->myid; |
263 | card->interface.statcallb(&cmd); | 263 | card->interface.statcallb(&cmd); |
264 | cmd.command = ISDN_STAT_DHUP; | 264 | cmd.command = ISDN_STAT_DHUP; |
265 | cmd.arg = 1; | 265 | cmd.arg = 1; |
266 | cmd.driver = card->myid; | 266 | cmd.driver = card->myid; |
267 | break; | 267 | break; |
268 | } | 268 | } |
269 | card->interface.statcallb(&cmd); | 269 | card->interface.statcallb(&cmd); |
270 | } | 270 | } |
@@ -277,7 +277,7 @@ isdnloop_parse_status(u_char * status, int channel, isdnloop_card * card) | |||
277 | * c = char to store. | 277 | * c = char to store. |
278 | */ | 278 | */ |
279 | static void | 279 | static void |
280 | isdnloop_putmsg(isdnloop_card * card, unsigned char c) | 280 | isdnloop_putmsg(isdnloop_card *card, unsigned char c) |
281 | { | 281 | { |
282 | ulong flags; | 282 | ulong flags; |
283 | 283 | ||
@@ -335,7 +335,7 @@ isdnloop_polldchan(unsigned long data) | |||
335 | card->imsg[card->iptr] = 0; | 335 | card->imsg[card->iptr] = 0; |
336 | card->iptr = 0; | 336 | card->iptr = 0; |
337 | if (card->imsg[0] == '0' && card->imsg[1] >= '0' && | 337 | if (card->imsg[0] == '0' && card->imsg[1] >= '0' && |
338 | card->imsg[1] <= '2' && card->imsg[2] == ';') { | 338 | card->imsg[1] <= '2' && card->imsg[2] == ';') { |
339 | ch = (card->imsg[1] - '0') - 1; | 339 | ch = (card->imsg[1] - '0') - 1; |
340 | p = &card->imsg[3]; | 340 | p = &card->imsg[3]; |
341 | isdnloop_parse_status(p, ch, card); | 341 | isdnloop_parse_status(p, ch, card); |
@@ -397,7 +397,7 @@ isdnloop_polldchan(unsigned long data) | |||
397 | * Number of bytes transferred, -E??? on error | 397 | * Number of bytes transferred, -E??? on error |
398 | */ | 398 | */ |
399 | static int | 399 | static int |
400 | isdnloop_sendbuf(int channel, struct sk_buff *skb, isdnloop_card * card) | 400 | isdnloop_sendbuf(int channel, struct sk_buff *skb, isdnloop_card *card) |
401 | { | 401 | { |
402 | int len = skb->len; | 402 | int len = skb->len; |
403 | unsigned long flags; | 403 | unsigned long flags; |
@@ -440,7 +440,7 @@ isdnloop_sendbuf(int channel, struct sk_buff *skb, isdnloop_card * card) | |||
440 | * number of bytes actually transferred. | 440 | * number of bytes actually transferred. |
441 | */ | 441 | */ |
442 | static int | 442 | static int |
443 | isdnloop_readstatus(u_char __user *buf, int len, isdnloop_card * card) | 443 | isdnloop_readstatus(u_char __user *buf, int len, isdnloop_card *card) |
444 | { | 444 | { |
445 | int count; | 445 | int count; |
446 | u_char __user *p; | 446 | u_char __user *p; |
@@ -468,7 +468,7 @@ isdnloop_readstatus(u_char __user *buf, int len, isdnloop_card * card) | |||
468 | * 0 on success, 1 on memory squeeze. | 468 | * 0 on success, 1 on memory squeeze. |
469 | */ | 469 | */ |
470 | static int | 470 | static int |
471 | isdnloop_fake(isdnloop_card * card, char *s, int ch) | 471 | isdnloop_fake(isdnloop_card *card, char *s, int ch) |
472 | { | 472 | { |
473 | struct sk_buff *skb; | 473 | struct sk_buff *skb; |
474 | int len = strlen(s) + ((ch >= 0) ? 3 : 0); | 474 | int len = strlen(s) + ((ch >= 0) ? 3 : 0); |
@@ -517,7 +517,7 @@ static isdnloop_stat isdnloop_cmd_table[] = | |||
517 | * card = pointer to card struct. | 517 | * card = pointer to card struct. |
518 | */ | 518 | */ |
519 | static void | 519 | static void |
520 | isdnloop_fake_err(isdnloop_card * card) | 520 | isdnloop_fake_err(isdnloop_card *card) |
521 | { | 521 | { |
522 | char buf[60]; | 522 | char buf[60]; |
523 | 523 | ||
@@ -543,19 +543,19 @@ static u_char ctable_1t[] = | |||
543 | * Pointer to buffer containing the assembled message. | 543 | * Pointer to buffer containing the assembled message. |
544 | */ | 544 | */ |
545 | static char * | 545 | static char * |
546 | isdnloop_unicause(isdnloop_card * card, int loc, int cau) | 546 | isdnloop_unicause(isdnloop_card *card, int loc, int cau) |
547 | { | 547 | { |
548 | static char buf[6]; | 548 | static char buf[6]; |
549 | 549 | ||
550 | switch (card->ptype) { | 550 | switch (card->ptype) { |
551 | case ISDN_PTYPE_EURO: | 551 | case ISDN_PTYPE_EURO: |
552 | sprintf(buf, "E%02X%02X", (loc) ? 4 : 2, ctable_eu[cau]); | 552 | sprintf(buf, "E%02X%02X", (loc) ? 4 : 2, ctable_eu[cau]); |
553 | break; | 553 | break; |
554 | case ISDN_PTYPE_1TR6: | 554 | case ISDN_PTYPE_1TR6: |
555 | sprintf(buf, "%02X44", ctable_1t[cau]); | 555 | sprintf(buf, "%02X44", ctable_1t[cau]); |
556 | break; | 556 | break; |
557 | default: | 557 | default: |
558 | return ("0000"); | 558 | return ("0000"); |
559 | } | 559 | } |
560 | return (buf); | 560 | return (buf); |
561 | } | 561 | } |
@@ -569,7 +569,7 @@ isdnloop_unicause(isdnloop_card * card, int loc, int cau) | |||
569 | * ch = channel (0-based) | 569 | * ch = channel (0-based) |
570 | */ | 570 | */ |
571 | static void | 571 | static void |
572 | isdnloop_atimeout(isdnloop_card * card, int ch) | 572 | isdnloop_atimeout(isdnloop_card *card, int ch) |
573 | { | 573 | { |
574 | unsigned long flags; | 574 | unsigned long flags; |
575 | char buf[60]; | 575 | char buf[60]; |
@@ -615,7 +615,7 @@ isdnloop_atimeout1(unsigned long data) | |||
615 | * ch = channel to watch for. | 615 | * ch = channel to watch for. |
616 | */ | 616 | */ |
617 | static void | 617 | static void |
618 | isdnloop_start_ctimer(isdnloop_card * card, int ch) | 618 | isdnloop_start_ctimer(isdnloop_card *card, int ch) |
619 | { | 619 | { |
620 | unsigned long flags; | 620 | unsigned long flags; |
621 | 621 | ||
@@ -639,7 +639,7 @@ isdnloop_start_ctimer(isdnloop_card * card, int ch) | |||
639 | * ch = channel (0-based). | 639 | * ch = channel (0-based). |
640 | */ | 640 | */ |
641 | static void | 641 | static void |
642 | isdnloop_kill_ctimer(isdnloop_card * card, int ch) | 642 | isdnloop_kill_ctimer(isdnloop_card *card, int ch) |
643 | { | 643 | { |
644 | unsigned long flags; | 644 | unsigned long flags; |
645 | 645 | ||
@@ -668,7 +668,7 @@ static u_char bit2si[] = | |||
668 | * 3 = found matching number but SI does not match. | 668 | * 3 = found matching number but SI does not match. |
669 | */ | 669 | */ |
670 | static int | 670 | static int |
671 | isdnloop_try_call(isdnloop_card * card, char *p, int lch, isdn_ctrl * cmd) | 671 | isdnloop_try_call(isdnloop_card *card, char *p, int lch, isdn_ctrl *cmd) |
672 | { | 672 | { |
673 | isdnloop_card *cc = cards; | 673 | isdnloop_card *cc = cards; |
674 | unsigned long flags; | 674 | unsigned long flags; |
@@ -686,19 +686,19 @@ isdnloop_try_call(isdnloop_card * card, char *p, int lch, isdn_ctrl * cmd) | |||
686 | continue; | 686 | continue; |
687 | num_match = 0; | 687 | num_match = 0; |
688 | switch (cc->ptype) { | 688 | switch (cc->ptype) { |
689 | case ISDN_PTYPE_EURO: | 689 | case ISDN_PTYPE_EURO: |
690 | for (i = 0; i < 3; i++) | 690 | for (i = 0; i < 3; i++) |
691 | if (!(strcmp(cc->s0num[i], cmd->parm.setup.phone))) | 691 | if (!(strcmp(cc->s0num[i], cmd->parm.setup.phone))) |
692 | num_match = 1; | 692 | num_match = 1; |
693 | break; | 693 | break; |
694 | case ISDN_PTYPE_1TR6: | 694 | case ISDN_PTYPE_1TR6: |
695 | e = cc->eazlist[ch]; | 695 | e = cc->eazlist[ch]; |
696 | while (*e) { | 696 | while (*e) { |
697 | sprintf(nbuf, "%s%c", cc->s0num[0], *e); | 697 | sprintf(nbuf, "%s%c", cc->s0num[0], *e); |
698 | if (!(strcmp(nbuf, cmd->parm.setup.phone))) | 698 | if (!(strcmp(nbuf, cmd->parm.setup.phone))) |
699 | num_match = 1; | 699 | num_match = 1; |
700 | e++; | 700 | e++; |
701 | } | 701 | } |
702 | } | 702 | } |
703 | if (num_match) { | 703 | if (num_match) { |
704 | spin_lock_irqsave(&card->isdnloop_lock, flags); | 704 | spin_lock_irqsave(&card->isdnloop_lock, flags); |
@@ -741,7 +741,7 @@ isdnloop_try_call(isdnloop_card * card, char *p, int lch, isdn_ctrl * cmd) | |||
741 | * pointer to new phone number. | 741 | * pointer to new phone number. |
742 | */ | 742 | */ |
743 | static char * | 743 | static char * |
744 | isdnloop_vstphone(isdnloop_card * card, char *phone, int caller) | 744 | isdnloop_vstphone(isdnloop_card *card, char *phone, int caller) |
745 | { | 745 | { |
746 | int i; | 746 | int i; |
747 | static char nphone[30]; | 747 | static char nphone[30]; |
@@ -751,22 +751,22 @@ isdnloop_vstphone(isdnloop_card * card, char *phone, int caller) | |||
751 | return ""; | 751 | return ""; |
752 | } | 752 | } |
753 | switch (card->ptype) { | 753 | switch (card->ptype) { |
754 | case ISDN_PTYPE_EURO: | 754 | case ISDN_PTYPE_EURO: |
755 | if (caller) { | 755 | if (caller) { |
756 | for (i = 0; i < 2; i++) | 756 | for (i = 0; i < 2; i++) |
757 | if (!(strcmp(card->s0num[i], phone))) | 757 | if (!(strcmp(card->s0num[i], phone))) |
758 | return (phone); | 758 | return (phone); |
759 | return (card->s0num[0]); | 759 | return (card->s0num[0]); |
760 | } | 760 | } |
761 | return (phone); | 761 | return (phone); |
762 | break; | 762 | break; |
763 | case ISDN_PTYPE_1TR6: | 763 | case ISDN_PTYPE_1TR6: |
764 | if (caller) { | 764 | if (caller) { |
765 | sprintf(nphone, "%s%c", card->s0num[0], phone[0]); | 765 | sprintf(nphone, "%s%c", card->s0num[0], phone[0]); |
766 | return (nphone); | 766 | return (nphone); |
767 | } else | 767 | } else |
768 | return (&phone[strlen(phone) - 1]); | 768 | return (&phone[strlen(phone) - 1]); |
769 | break; | 769 | break; |
770 | } | 770 | } |
771 | return ""; | 771 | return ""; |
772 | } | 772 | } |
@@ -779,7 +779,7 @@ isdnloop_vstphone(isdnloop_card * card, char *phone, int caller) | |||
779 | * card = pointer to card struct. | 779 | * card = pointer to card struct. |
780 | */ | 780 | */ |
781 | static void | 781 | static void |
782 | isdnloop_parse_cmd(isdnloop_card * card) | 782 | isdnloop_parse_cmd(isdnloop_card *card) |
783 | { | 783 | { |
784 | char *p = card->omsg; | 784 | char *p = card->omsg; |
785 | isdn_ctrl cmd; | 785 | isdn_ctrl cmd; |
@@ -813,141 +813,141 @@ isdnloop_parse_cmd(isdnloop_card * card) | |||
813 | if (action == -1) | 813 | if (action == -1) |
814 | return; | 814 | return; |
815 | switch (action) { | 815 | switch (action) { |
816 | case 1: | 816 | case 1: |
817 | /* 0x;BCON_R */ | 817 | /* 0x;BCON_R */ |
818 | if (card->rcard[ch - 1]) { | 818 | if (card->rcard[ch - 1]) { |
819 | isdnloop_fake(card->rcard[ch - 1], "BCON_I", | 819 | isdnloop_fake(card->rcard[ch - 1], "BCON_I", |
820 | card->rch[ch - 1] + 1); | 820 | card->rch[ch - 1] + 1); |
821 | isdnloop_fake(card, "BCON_C", ch); | 821 | isdnloop_fake(card, "BCON_C", ch); |
822 | } | 822 | } |
823 | break; | 823 | break; |
824 | case 17: | 824 | case 17: |
825 | /* 0x;BCON_I */ | 825 | /* 0x;BCON_I */ |
826 | if (card->rcard[ch - 1]) { | 826 | if (card->rcard[ch - 1]) { |
827 | isdnloop_fake(card->rcard[ch - 1], "BCON_C", | 827 | isdnloop_fake(card->rcard[ch - 1], "BCON_C", |
828 | card->rch[ch - 1] + 1); | 828 | card->rch[ch - 1] + 1); |
829 | } | 829 | } |
830 | break; | 830 | break; |
831 | case 2: | 831 | case 2: |
832 | /* 0x;BDIS_R */ | 832 | /* 0x;BDIS_R */ |
833 | isdnloop_fake(card, "BDIS_C", ch); | 833 | isdnloop_fake(card, "BDIS_C", ch); |
834 | if (card->rcard[ch - 1]) { | 834 | if (card->rcard[ch - 1]) { |
835 | isdnloop_fake(card->rcard[ch - 1], "BDIS_I", | 835 | isdnloop_fake(card->rcard[ch - 1], "BDIS_I", |
836 | card->rch[ch - 1] + 1); | 836 | card->rch[ch - 1] + 1); |
837 | } | 837 | } |
838 | break; | 838 | break; |
839 | case 16: | 839 | case 16: |
840 | /* 0x;DCON_R */ | 840 | /* 0x;DCON_R */ |
841 | isdnloop_kill_ctimer(card, ch - 1); | 841 | isdnloop_kill_ctimer(card, ch - 1); |
842 | if (card->rcard[ch - 1]) { | 842 | if (card->rcard[ch - 1]) { |
843 | isdnloop_kill_ctimer(card->rcard[ch - 1], card->rch[ch - 1]); | 843 | isdnloop_kill_ctimer(card->rcard[ch - 1], card->rch[ch - 1]); |
844 | isdnloop_fake(card->rcard[ch - 1], "DCON_C", | 844 | isdnloop_fake(card->rcard[ch - 1], "DCON_C", |
845 | card->rch[ch - 1] + 1); | 845 | card->rch[ch - 1] + 1); |
846 | isdnloop_fake(card, "DCON_C", ch); | 846 | isdnloop_fake(card, "DCON_C", ch); |
847 | } | 847 | } |
848 | break; | 848 | break; |
849 | case 3: | 849 | case 3: |
850 | /* 0x;DDIS_R */ | 850 | /* 0x;DDIS_R */ |
851 | isdnloop_kill_ctimer(card, ch - 1); | 851 | isdnloop_kill_ctimer(card, ch - 1); |
852 | if (card->rcard[ch - 1]) { | 852 | if (card->rcard[ch - 1]) { |
853 | isdnloop_kill_ctimer(card->rcard[ch - 1], card->rch[ch - 1]); | 853 | isdnloop_kill_ctimer(card->rcard[ch - 1], card->rch[ch - 1]); |
854 | isdnloop_fake(card->rcard[ch - 1], "DDIS_I", | 854 | isdnloop_fake(card->rcard[ch - 1], "DDIS_I", |
855 | card->rch[ch - 1] + 1); | 855 | card->rch[ch - 1] + 1); |
856 | card->rcard[ch - 1] = NULL; | 856 | card->rcard[ch - 1] = NULL; |
857 | } | 857 | } |
858 | isdnloop_fake(card, "DDIS_C", ch); | 858 | isdnloop_fake(card, "DDIS_C", ch); |
859 | break; | 859 | break; |
860 | case 4: | 860 | case 4: |
861 | /* 0x;DSCA_Rdd,yy,zz,oo */ | 861 | /* 0x;DSCA_Rdd,yy,zz,oo */ |
862 | if (card->ptype != ISDN_PTYPE_1TR6) { | 862 | if (card->ptype != ISDN_PTYPE_1TR6) { |
863 | isdnloop_fake_err(card); | 863 | isdnloop_fake_err(card); |
864 | return; | 864 | return; |
865 | } | 865 | } |
866 | /* Fall through */ | ||
867 | case 5: | ||
868 | /* 0x;DCAL_Rdd,yy,zz,oo */ | ||
869 | p += 6; | ||
870 | switch (isdnloop_try_call(card, p, ch - 1, &cmd)) { | ||
871 | case 0: | ||
872 | /* Alerting */ | ||
873 | sprintf(buf, "D%s_I%s,%02d,%02d,%s", | ||
874 | (action == 4) ? "SCA" : "CAL", | ||
875 | isdnloop_vstphone(card, cmd.parm.setup.eazmsn, 1), | ||
876 | cmd.parm.setup.si1, | ||
877 | cmd.parm.setup.si2, | ||
878 | isdnloop_vstphone(card->rcard[ch - 1], | ||
879 | cmd.parm.setup.phone, 0)); | ||
880 | isdnloop_fake(card->rcard[ch - 1], buf, card->rch[ch - 1] + 1); | ||
866 | /* Fall through */ | 881 | /* Fall through */ |
867 | case 5: | 882 | case 3: |
868 | /* 0x;DCAL_Rdd,yy,zz,oo */ | 883 | /* si1 does not match, don't alert but start timer */ |
869 | p += 6; | 884 | isdnloop_start_ctimer(card, ch - 1); |
870 | switch (isdnloop_try_call(card, p, ch - 1, &cmd)) { | ||
871 | case 0: | ||
872 | /* Alerting */ | ||
873 | sprintf(buf, "D%s_I%s,%02d,%02d,%s", | ||
874 | (action == 4) ? "SCA" : "CAL", | ||
875 | isdnloop_vstphone(card, cmd.parm.setup.eazmsn, 1), | ||
876 | cmd.parm.setup.si1, | ||
877 | cmd.parm.setup.si2, | ||
878 | isdnloop_vstphone(card->rcard[ch - 1], | ||
879 | cmd.parm.setup.phone, 0)); | ||
880 | isdnloop_fake(card->rcard[ch - 1], buf, card->rch[ch - 1] + 1); | ||
881 | /* Fall through */ | ||
882 | case 3: | ||
883 | /* si1 does not match, don't alert but start timer */ | ||
884 | isdnloop_start_ctimer(card, ch - 1); | ||
885 | break; | ||
886 | case 1: | ||
887 | /* Remote busy */ | ||
888 | isdnloop_fake(card, "DDIS_I", ch); | ||
889 | sprintf(buf, "CAU%s", isdnloop_unicause(card, 1, 1)); | ||
890 | isdnloop_fake(card, buf, ch); | ||
891 | break; | ||
892 | case 2: | ||
893 | /* No such user */ | ||
894 | isdnloop_fake(card, "DDIS_I", ch); | ||
895 | sprintf(buf, "CAU%s", isdnloop_unicause(card, 1, 2)); | ||
896 | isdnloop_fake(card, buf, ch); | ||
897 | break; | ||
898 | } | ||
899 | break; | ||
900 | case 6: | ||
901 | /* 0x;EAZC */ | ||
902 | card->eazlist[ch - 1][0] = '\0'; | ||
903 | break; | ||
904 | case 7: | ||
905 | /* 0x;EAZ */ | ||
906 | p += 3; | ||
907 | strcpy(card->eazlist[ch - 1], p); | ||
908 | break; | ||
909 | case 8: | ||
910 | /* 0x;SEEAZ */ | ||
911 | sprintf(buf, "EAZ-LIST: %s", card->eazlist[ch - 1]); | ||
912 | isdnloop_fake(card, buf, ch + 1); | ||
913 | break; | ||
914 | case 9: | ||
915 | /* 0x;MSN */ | ||
916 | break; | ||
917 | case 10: | ||
918 | /* 0x;MSNALL */ | ||
919 | break; | ||
920 | case 11: | ||
921 | /* 0x;SETSIL */ | ||
922 | p += 6; | ||
923 | i = 0; | ||
924 | while (strchr("0157", *p)) { | ||
925 | if (i) | ||
926 | card->sil[ch - 1] |= si2bit[*p - '0']; | ||
927 | i = (*p++ == '0'); | ||
928 | } | ||
929 | if (*p) | ||
930 | isdnloop_fake_err(card); | ||
931 | break; | ||
932 | case 12: | ||
933 | /* 0x;SEESIL */ | ||
934 | sprintf(buf, "SIN-LIST: "); | ||
935 | p = buf + 10; | ||
936 | for (i = 0; i < 3; i++) | ||
937 | if (card->sil[ch - 1] & (1 << i)) | ||
938 | p += sprintf(p, "%02d", bit2si[i]); | ||
939 | isdnloop_fake(card, buf, ch + 1); | ||
940 | break; | ||
941 | case 13: | ||
942 | /* 0x;SILC */ | ||
943 | card->sil[ch - 1] = 0; | ||
944 | break; | 885 | break; |
945 | case 14: | 886 | case 1: |
946 | /* 00;FV2ON */ | 887 | /* Remote busy */ |
888 | isdnloop_fake(card, "DDIS_I", ch); | ||
889 | sprintf(buf, "CAU%s", isdnloop_unicause(card, 1, 1)); | ||
890 | isdnloop_fake(card, buf, ch); | ||
947 | break; | 891 | break; |
948 | case 15: | 892 | case 2: |
949 | /* 00;FV2OFF */ | 893 | /* No such user */ |
894 | isdnloop_fake(card, "DDIS_I", ch); | ||
895 | sprintf(buf, "CAU%s", isdnloop_unicause(card, 1, 2)); | ||
896 | isdnloop_fake(card, buf, ch); | ||
950 | break; | 897 | break; |
898 | } | ||
899 | break; | ||
900 | case 6: | ||
901 | /* 0x;EAZC */ | ||
902 | card->eazlist[ch - 1][0] = '\0'; | ||
903 | break; | ||
904 | case 7: | ||
905 | /* 0x;EAZ */ | ||
906 | p += 3; | ||
907 | strcpy(card->eazlist[ch - 1], p); | ||
908 | break; | ||
909 | case 8: | ||
910 | /* 0x;SEEAZ */ | ||
911 | sprintf(buf, "EAZ-LIST: %s", card->eazlist[ch - 1]); | ||
912 | isdnloop_fake(card, buf, ch + 1); | ||
913 | break; | ||
914 | case 9: | ||
915 | /* 0x;MSN */ | ||
916 | break; | ||
917 | case 10: | ||
918 | /* 0x;MSNALL */ | ||
919 | break; | ||
920 | case 11: | ||
921 | /* 0x;SETSIL */ | ||
922 | p += 6; | ||
923 | i = 0; | ||
924 | while (strchr("0157", *p)) { | ||
925 | if (i) | ||
926 | card->sil[ch - 1] |= si2bit[*p - '0']; | ||
927 | i = (*p++ == '0'); | ||
928 | } | ||
929 | if (*p) | ||
930 | isdnloop_fake_err(card); | ||
931 | break; | ||
932 | case 12: | ||
933 | /* 0x;SEESIL */ | ||
934 | sprintf(buf, "SIN-LIST: "); | ||
935 | p = buf + 10; | ||
936 | for (i = 0; i < 3; i++) | ||
937 | if (card->sil[ch - 1] & (1 << i)) | ||
938 | p += sprintf(p, "%02d", bit2si[i]); | ||
939 | isdnloop_fake(card, buf, ch + 1); | ||
940 | break; | ||
941 | case 13: | ||
942 | /* 0x;SILC */ | ||
943 | card->sil[ch - 1] = 0; | ||
944 | break; | ||
945 | case 14: | ||
946 | /* 00;FV2ON */ | ||
947 | break; | ||
948 | case 15: | ||
949 | /* 00;FV2OFF */ | ||
950 | break; | ||
951 | } | 951 | } |
952 | } | 952 | } |
953 | 953 | ||
@@ -966,7 +966,7 @@ isdnloop_parse_cmd(isdnloop_card * card) | |||
966 | * number of bytes transferred (currently always equals len). | 966 | * number of bytes transferred (currently always equals len). |
967 | */ | 967 | */ |
968 | static int | 968 | static int |
969 | isdnloop_writecmd(const u_char * buf, int len, int user, isdnloop_card * card) | 969 | isdnloop_writecmd(const u_char *buf, int len, int user, isdnloop_card *card) |
970 | { | 970 | { |
971 | int xcount = 0; | 971 | int xcount = 0; |
972 | int ocount = 1; | 972 | int ocount = 1; |
@@ -1016,7 +1016,7 @@ isdnloop_writecmd(const u_char * buf, int len, int user, isdnloop_card * card) | |||
1016 | * Delete card's pending timers, send STOP to linklevel | 1016 | * Delete card's pending timers, send STOP to linklevel |
1017 | */ | 1017 | */ |
1018 | static void | 1018 | static void |
1019 | isdnloop_stopcard(isdnloop_card * card) | 1019 | isdnloop_stopcard(isdnloop_card *card) |
1020 | { | 1020 | { |
1021 | unsigned long flags; | 1021 | unsigned long flags; |
1022 | isdn_ctrl cmd; | 1022 | isdn_ctrl cmd; |
@@ -1061,7 +1061,7 @@ isdnloop_stopallcards(void) | |||
1061 | * 0 on success, -E??? otherwise. | 1061 | * 0 on success, -E??? otherwise. |
1062 | */ | 1062 | */ |
1063 | static int | 1063 | static int |
1064 | isdnloop_start(isdnloop_card * card, isdnloop_sdef * sdefp) | 1064 | isdnloop_start(isdnloop_card *card, isdnloop_sdef *sdefp) |
1065 | { | 1065 | { |
1066 | unsigned long flags; | 1066 | unsigned long flags; |
1067 | isdnloop_sdef sdef; | 1067 | isdnloop_sdef sdef; |
@@ -1073,40 +1073,40 @@ isdnloop_start(isdnloop_card * card, isdnloop_sdef * sdefp) | |||
1073 | return -EFAULT; | 1073 | return -EFAULT; |
1074 | spin_lock_irqsave(&card->isdnloop_lock, flags); | 1074 | spin_lock_irqsave(&card->isdnloop_lock, flags); |
1075 | switch (sdef.ptype) { | 1075 | switch (sdef.ptype) { |
1076 | case ISDN_PTYPE_EURO: | 1076 | case ISDN_PTYPE_EURO: |
1077 | if (isdnloop_fake(card, "DRV1.23EC-Q.931-CAPI-CNS-BASIS-20.02.96", | 1077 | if (isdnloop_fake(card, "DRV1.23EC-Q.931-CAPI-CNS-BASIS-20.02.96", |
1078 | -1)) { | 1078 | -1)) { |
1079 | spin_unlock_irqrestore(&card->isdnloop_lock, flags); | ||
1080 | return -ENOMEM; | ||
1081 | } | ||
1082 | card->sil[0] = card->sil[1] = 4; | ||
1083 | if (isdnloop_fake(card, "TEI OK", 0)) { | ||
1084 | spin_unlock_irqrestore(&card->isdnloop_lock, flags); | ||
1085 | return -ENOMEM; | ||
1086 | } | ||
1087 | for (i = 0; i < 3; i++) | ||
1088 | strcpy(card->s0num[i], sdef.num[i]); | ||
1089 | break; | ||
1090 | case ISDN_PTYPE_1TR6: | ||
1091 | if (isdnloop_fake(card, "DRV1.04TC-1TR6-CAPI-CNS-BASIS-29.11.95", | ||
1092 | -1)) { | ||
1093 | spin_unlock_irqrestore(&card->isdnloop_lock, flags); | ||
1094 | return -ENOMEM; | ||
1095 | } | ||
1096 | card->sil[0] = card->sil[1] = 4; | ||
1097 | if (isdnloop_fake(card, "TEI OK", 0)) { | ||
1098 | spin_unlock_irqrestore(&card->isdnloop_lock, flags); | ||
1099 | return -ENOMEM; | ||
1100 | } | ||
1101 | strcpy(card->s0num[0], sdef.num[0]); | ||
1102 | card->s0num[1][0] = '\0'; | ||
1103 | card->s0num[2][0] = '\0'; | ||
1104 | break; | ||
1105 | default: | ||
1106 | spin_unlock_irqrestore(&card->isdnloop_lock, flags); | 1079 | spin_unlock_irqrestore(&card->isdnloop_lock, flags); |
1107 | printk(KERN_WARNING "isdnloop: Illegal D-channel protocol %d\n", | 1080 | return -ENOMEM; |
1108 | sdef.ptype); | 1081 | } |
1109 | return -EINVAL; | 1082 | card->sil[0] = card->sil[1] = 4; |
1083 | if (isdnloop_fake(card, "TEI OK", 0)) { | ||
1084 | spin_unlock_irqrestore(&card->isdnloop_lock, flags); | ||
1085 | return -ENOMEM; | ||
1086 | } | ||
1087 | for (i = 0; i < 3; i++) | ||
1088 | strcpy(card->s0num[i], sdef.num[i]); | ||
1089 | break; | ||
1090 | case ISDN_PTYPE_1TR6: | ||
1091 | if (isdnloop_fake(card, "DRV1.04TC-1TR6-CAPI-CNS-BASIS-29.11.95", | ||
1092 | -1)) { | ||
1093 | spin_unlock_irqrestore(&card->isdnloop_lock, flags); | ||
1094 | return -ENOMEM; | ||
1095 | } | ||
1096 | card->sil[0] = card->sil[1] = 4; | ||
1097 | if (isdnloop_fake(card, "TEI OK", 0)) { | ||
1098 | spin_unlock_irqrestore(&card->isdnloop_lock, flags); | ||
1099 | return -ENOMEM; | ||
1100 | } | ||
1101 | strcpy(card->s0num[0], sdef.num[0]); | ||
1102 | card->s0num[1][0] = '\0'; | ||
1103 | card->s0num[2][0] = '\0'; | ||
1104 | break; | ||
1105 | default: | ||
1106 | spin_unlock_irqrestore(&card->isdnloop_lock, flags); | ||
1107 | printk(KERN_WARNING "isdnloop: Illegal D-channel protocol %d\n", | ||
1108 | sdef.ptype); | ||
1109 | return -EINVAL; | ||
1110 | } | 1110 | } |
1111 | init_timer(&card->st_timer); | 1111 | init_timer(&card->st_timer); |
1112 | card->st_timer.expires = jiffies + ISDNLOOP_TIMER_DCREAD; | 1112 | card->st_timer.expires = jiffies + ISDNLOOP_TIMER_DCREAD; |
@@ -1122,7 +1122,7 @@ isdnloop_start(isdnloop_card * card, isdnloop_sdef * sdefp) | |||
1122 | * Main handler for commands sent by linklevel. | 1122 | * Main handler for commands sent by linklevel. |
1123 | */ | 1123 | */ |
1124 | static int | 1124 | static int |
1125 | isdnloop_command(isdn_ctrl * c, isdnloop_card * card) | 1125 | isdnloop_command(isdn_ctrl *c, isdnloop_card *card) |
1126 | { | 1126 | { |
1127 | ulong a; | 1127 | ulong a; |
1128 | int i; | 1128 | int i; |
@@ -1131,215 +1131,215 @@ isdnloop_command(isdn_ctrl * c, isdnloop_card * card) | |||
1131 | isdnloop_cdef cdef; | 1131 | isdnloop_cdef cdef; |
1132 | 1132 | ||
1133 | switch (c->command) { | 1133 | switch (c->command) { |
1134 | case ISDN_CMD_IOCTL: | 1134 | case ISDN_CMD_IOCTL: |
1135 | memcpy(&a, c->parm.num, sizeof(ulong)); | 1135 | memcpy(&a, c->parm.num, sizeof(ulong)); |
1136 | switch (c->arg) { | 1136 | switch (c->arg) { |
1137 | case ISDNLOOP_IOCTL_DEBUGVAR: | 1137 | case ISDNLOOP_IOCTL_DEBUGVAR: |
1138 | return (ulong) card; | 1138 | return (ulong) card; |
1139 | case ISDNLOOP_IOCTL_STARTUP: | 1139 | case ISDNLOOP_IOCTL_STARTUP: |
1140 | if (!access_ok(VERIFY_READ, (void *) a, sizeof(isdnloop_sdef))) | 1140 | if (!access_ok(VERIFY_READ, (void *) a, sizeof(isdnloop_sdef))) |
1141 | return -EFAULT; | 1141 | return -EFAULT; |
1142 | return (isdnloop_start(card, (isdnloop_sdef *) a)); | 1142 | return (isdnloop_start(card, (isdnloop_sdef *) a)); |
1143 | break; | 1143 | break; |
1144 | case ISDNLOOP_IOCTL_ADDCARD: | 1144 | case ISDNLOOP_IOCTL_ADDCARD: |
1145 | if (copy_from_user((char *)&cdef, | 1145 | if (copy_from_user((char *)&cdef, |
1146 | (char *)a, | 1146 | (char *)a, |
1147 | sizeof(cdef))) | 1147 | sizeof(cdef))) |
1148 | return -EFAULT; | 1148 | return -EFAULT; |
1149 | return (isdnloop_addcard(cdef.id1)); | 1149 | return (isdnloop_addcard(cdef.id1)); |
1150 | break; | 1150 | break; |
1151 | case ISDNLOOP_IOCTL_LEASEDCFG: | 1151 | case ISDNLOOP_IOCTL_LEASEDCFG: |
1152 | if (a) { | 1152 | if (a) { |
1153 | if (!card->leased) { | 1153 | if (!card->leased) { |
1154 | card->leased = 1; | 1154 | card->leased = 1; |
1155 | while (card->ptype == ISDN_PTYPE_UNKNOWN) | 1155 | while (card->ptype == ISDN_PTYPE_UNKNOWN) |
1156 | schedule_timeout_interruptible(10); | 1156 | schedule_timeout_interruptible(10); |
1157 | schedule_timeout_interruptible(10); | 1157 | schedule_timeout_interruptible(10); |
1158 | sprintf(cbuf, "00;FV2ON\n01;EAZ1\n02;EAZ2\n"); | 1158 | sprintf(cbuf, "00;FV2ON\n01;EAZ1\n02;EAZ2\n"); |
1159 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); | 1159 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); |
1160 | printk(KERN_INFO | 1160 | printk(KERN_INFO |
1161 | "isdnloop: (%s) Leased-line mode enabled\n", | 1161 | "isdnloop: (%s) Leased-line mode enabled\n", |
1162 | CID); | 1162 | CID); |
1163 | cmd.command = ISDN_STAT_RUN; | 1163 | cmd.command = ISDN_STAT_RUN; |
1164 | cmd.driver = card->myid; | 1164 | cmd.driver = card->myid; |
1165 | cmd.arg = 0; | 1165 | cmd.arg = 0; |
1166 | card->interface.statcallb(&cmd); | 1166 | card->interface.statcallb(&cmd); |
1167 | } | 1167 | } |
1168 | } else { | 1168 | } else { |
1169 | if (card->leased) { | 1169 | if (card->leased) { |
1170 | card->leased = 0; | 1170 | card->leased = 0; |
1171 | sprintf(cbuf, "00;FV2OFF\n"); | 1171 | sprintf(cbuf, "00;FV2OFF\n"); |
1172 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); | 1172 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); |
1173 | printk(KERN_INFO | 1173 | printk(KERN_INFO |
1174 | "isdnloop: (%s) Leased-line mode disabled\n", | 1174 | "isdnloop: (%s) Leased-line mode disabled\n", |
1175 | CID); | 1175 | CID); |
1176 | cmd.command = ISDN_STAT_RUN; | 1176 | cmd.command = ISDN_STAT_RUN; |
1177 | cmd.driver = card->myid; | 1177 | cmd.driver = card->myid; |
1178 | cmd.arg = 0; | 1178 | cmd.arg = 0; |
1179 | card->interface.statcallb(&cmd); | 1179 | card->interface.statcallb(&cmd); |
1180 | } | 1180 | } |
1181 | } | ||
1182 | return 0; | ||
1183 | default: | ||
1184 | return -EINVAL; | ||
1185 | } | 1181 | } |
1182 | return 0; | ||
1183 | default: | ||
1184 | return -EINVAL; | ||
1185 | } | ||
1186 | break; | ||
1187 | case ISDN_CMD_DIAL: | ||
1188 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) | ||
1189 | return -ENODEV; | ||
1190 | if (card->leased) | ||
1186 | break; | 1191 | break; |
1187 | case ISDN_CMD_DIAL: | 1192 | if ((c->arg & 255) < ISDNLOOP_BCH) { |
1188 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) | 1193 | char *p; |
1189 | return -ENODEV; | 1194 | char dial[50]; |
1190 | if (card->leased) | 1195 | char dcode[4]; |
1191 | break; | 1196 | |
1192 | if ((c->arg & 255) < ISDNLOOP_BCH) { | 1197 | a = c->arg; |
1193 | char *p; | 1198 | p = c->parm.setup.phone; |
1194 | char dial[50]; | 1199 | if (*p == 's' || *p == 'S') { |
1195 | char dcode[4]; | 1200 | /* Dial for SPV */ |
1196 | 1201 | p++; | |
1197 | a = c->arg; | 1202 | strcpy(dcode, "SCA"); |
1198 | p = c->parm.setup.phone; | 1203 | } else |
1199 | if (*p == 's' || *p == 'S') { | 1204 | /* Normal Dial */ |
1200 | /* Dial for SPV */ | 1205 | strcpy(dcode, "CAL"); |
1201 | p++; | 1206 | strcpy(dial, p); |
1202 | strcpy(dcode, "SCA"); | 1207 | sprintf(cbuf, "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1), |
1203 | } else | 1208 | dcode, dial, c->parm.setup.si1, |
1204 | /* Normal Dial */ | ||
1205 | strcpy(dcode, "CAL"); | ||
1206 | strcpy(dial, p); | ||
1207 | sprintf(cbuf, "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1), | ||
1208 | dcode, dial, c->parm.setup.si1, | ||
1209 | c->parm.setup.si2, c->parm.setup.eazmsn); | 1209 | c->parm.setup.si2, c->parm.setup.eazmsn); |
1210 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); | ||
1211 | } | ||
1212 | break; | ||
1213 | case ISDN_CMD_ACCEPTD: | ||
1214 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) | ||
1215 | return -ENODEV; | ||
1216 | if (c->arg < ISDNLOOP_BCH) { | ||
1217 | a = c->arg + 1; | ||
1218 | cbuf[0] = 0; | ||
1219 | switch (card->l2_proto[a - 1]) { | ||
1220 | case ISDN_PROTO_L2_X75I: | ||
1221 | sprintf(cbuf, "%02d;BX75\n", (int) a); | ||
1222 | break; | ||
1223 | #ifdef CONFIG_ISDN_X25 | ||
1224 | case ISDN_PROTO_L2_X25DTE: | ||
1225 | sprintf(cbuf, "%02d;BX2T\n", (int) a); | ||
1226 | break; | ||
1227 | case ISDN_PROTO_L2_X25DCE: | ||
1228 | sprintf(cbuf, "%02d;BX2C\n", (int) a); | ||
1229 | break; | ||
1230 | #endif | ||
1231 | case ISDN_PROTO_L2_HDLC: | ||
1232 | sprintf(cbuf, "%02d;BTRA\n", (int) a); | ||
1233 | break; | ||
1234 | } | ||
1235 | if (strlen(cbuf)) | ||
1210 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); | 1236 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); |
1237 | sprintf(cbuf, "%02d;DCON_R\n", (int) a); | ||
1238 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); | ||
1239 | } | ||
1240 | break; | ||
1241 | case ISDN_CMD_ACCEPTB: | ||
1242 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) | ||
1243 | return -ENODEV; | ||
1244 | if (c->arg < ISDNLOOP_BCH) { | ||
1245 | a = c->arg + 1; | ||
1246 | switch (card->l2_proto[a - 1]) { | ||
1247 | case ISDN_PROTO_L2_X75I: | ||
1248 | sprintf(cbuf, "%02d;BCON_R,BX75\n", (int) a); | ||
1249 | break; | ||
1250 | #ifdef CONFIG_ISDN_X25 | ||
1251 | case ISDN_PROTO_L2_X25DTE: | ||
1252 | sprintf(cbuf, "%02d;BCON_R,BX2T\n", (int) a); | ||
1253 | break; | ||
1254 | case ISDN_PROTO_L2_X25DCE: | ||
1255 | sprintf(cbuf, "%02d;BCON_R,BX2C\n", (int) a); | ||
1256 | break; | ||
1257 | #endif | ||
1258 | case ISDN_PROTO_L2_HDLC: | ||
1259 | sprintf(cbuf, "%02d;BCON_R,BTRA\n", (int) a); | ||
1260 | break; | ||
1261 | default: | ||
1262 | sprintf(cbuf, "%02d;BCON_R\n", (int) a); | ||
1211 | } | 1263 | } |
1264 | printk(KERN_DEBUG "isdnloop writecmd '%s'\n", cbuf); | ||
1265 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); | ||
1212 | break; | 1266 | break; |
1213 | case ISDN_CMD_ACCEPTD: | 1267 | case ISDN_CMD_HANGUP: |
1214 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) | 1268 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) |
1215 | return -ENODEV; | 1269 | return -ENODEV; |
1216 | if (c->arg < ISDNLOOP_BCH) { | 1270 | if (c->arg < ISDNLOOP_BCH) { |
1217 | a = c->arg + 1; | 1271 | a = c->arg + 1; |
1218 | cbuf[0] = 0; | 1272 | sprintf(cbuf, "%02d;BDIS_R\n%02d;DDIS_R\n", (int) a, (int) a); |
1219 | switch (card->l2_proto[a - 1]) { | ||
1220 | case ISDN_PROTO_L2_X75I: | ||
1221 | sprintf(cbuf, "%02d;BX75\n", (int) a); | ||
1222 | break; | ||
1223 | #ifdef CONFIG_ISDN_X25 | ||
1224 | case ISDN_PROTO_L2_X25DTE: | ||
1225 | sprintf(cbuf, "%02d;BX2T\n", (int) a); | ||
1226 | break; | ||
1227 | case ISDN_PROTO_L2_X25DCE: | ||
1228 | sprintf(cbuf, "%02d;BX2C\n", (int) a); | ||
1229 | break; | ||
1230 | #endif | ||
1231 | case ISDN_PROTO_L2_HDLC: | ||
1232 | sprintf(cbuf, "%02d;BTRA\n", (int) a); | ||
1233 | break; | ||
1234 | } | ||
1235 | if (strlen(cbuf)) | ||
1236 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); | ||
1237 | sprintf(cbuf, "%02d;DCON_R\n", (int) a); | ||
1238 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); | 1273 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); |
1239 | } | 1274 | } |
1240 | break; | 1275 | break; |
1241 | case ISDN_CMD_ACCEPTB: | 1276 | case ISDN_CMD_SETEAZ: |
1242 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) | 1277 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) |
1243 | return -ENODEV; | 1278 | return -ENODEV; |
1279 | if (card->leased) | ||
1280 | break; | ||
1244 | if (c->arg < ISDNLOOP_BCH) { | 1281 | if (c->arg < ISDNLOOP_BCH) { |
1245 | a = c->arg + 1; | 1282 | a = c->arg + 1; |
1246 | switch (card->l2_proto[a - 1]) { | 1283 | if (card->ptype == ISDN_PTYPE_EURO) { |
1247 | case ISDN_PROTO_L2_X75I: | 1284 | sprintf(cbuf, "%02d;MS%s%s\n", (int) a, |
1248 | sprintf(cbuf, "%02d;BCON_R,BX75\n", (int) a); | 1285 | c->parm.num[0] ? "N" : "ALL", c->parm.num); |
1249 | break; | 1286 | } else |
1250 | #ifdef CONFIG_ISDN_X25 | 1287 | sprintf(cbuf, "%02d;EAZ%s\n", (int) a, |
1251 | case ISDN_PROTO_L2_X25DTE: | 1288 | c->parm.num[0] ? c->parm.num : (u_char *) "0123456789"); |
1252 | sprintf(cbuf, "%02d;BCON_R,BX2T\n", (int) a); | ||
1253 | break; | ||
1254 | case ISDN_PROTO_L2_X25DCE: | ||
1255 | sprintf(cbuf, "%02d;BCON_R,BX2C\n", (int) a); | ||
1256 | break; | ||
1257 | #endif | ||
1258 | case ISDN_PROTO_L2_HDLC: | ||
1259 | sprintf(cbuf, "%02d;BCON_R,BTRA\n", (int) a); | ||
1260 | break; | ||
1261 | default: | ||
1262 | sprintf(cbuf, "%02d;BCON_R\n", (int) a); | ||
1263 | } | ||
1264 | printk(KERN_DEBUG "isdnloop writecmd '%s'\n", cbuf); | ||
1265 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); | 1289 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); |
1266 | break; | 1290 | } |
1267 | case ISDN_CMD_HANGUP: | 1291 | break; |
1268 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) | ||
1269 | return -ENODEV; | ||
1270 | if (c->arg < ISDNLOOP_BCH) { | ||
1271 | a = c->arg + 1; | ||
1272 | sprintf(cbuf, "%02d;BDIS_R\n%02d;DDIS_R\n", (int) a, (int) a); | ||
1273 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); | ||
1274 | } | ||
1275 | break; | ||
1276 | case ISDN_CMD_SETEAZ: | ||
1277 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) | ||
1278 | return -ENODEV; | ||
1279 | if (card->leased) | ||
1280 | break; | ||
1281 | if (c->arg < ISDNLOOP_BCH) { | ||
1282 | a = c->arg + 1; | ||
1283 | if (card->ptype == ISDN_PTYPE_EURO) { | ||
1284 | sprintf(cbuf, "%02d;MS%s%s\n", (int) a, | ||
1285 | c->parm.num[0] ? "N" : "ALL", c->parm.num); | ||
1286 | } else | ||
1287 | sprintf(cbuf, "%02d;EAZ%s\n", (int) a, | ||
1288 | c->parm.num[0] ? c->parm.num : (u_char *) "0123456789"); | ||
1289 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); | ||
1290 | } | ||
1291 | break; | ||
1292 | case ISDN_CMD_CLREAZ: | 1292 | case ISDN_CMD_CLREAZ: |
1293 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) | 1293 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) |
1294 | return -ENODEV; | 1294 | return -ENODEV; |
1295 | if (card->leased) | 1295 | if (card->leased) |
1296 | break; | ||
1297 | if (c->arg < ISDNLOOP_BCH) { | ||
1298 | a = c->arg + 1; | ||
1299 | if (card->ptype == ISDN_PTYPE_EURO) | ||
1300 | sprintf(cbuf, "%02d;MSNC\n", (int) a); | ||
1301 | else | ||
1302 | sprintf(cbuf, "%02d;EAZC\n", (int) a); | ||
1303 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); | ||
1304 | } | ||
1305 | break; | 1296 | break; |
1297 | if (c->arg < ISDNLOOP_BCH) { | ||
1298 | a = c->arg + 1; | ||
1299 | if (card->ptype == ISDN_PTYPE_EURO) | ||
1300 | sprintf(cbuf, "%02d;MSNC\n", (int) a); | ||
1301 | else | ||
1302 | sprintf(cbuf, "%02d;EAZC\n", (int) a); | ||
1303 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); | ||
1304 | } | ||
1305 | break; | ||
1306 | case ISDN_CMD_SETL2: | 1306 | case ISDN_CMD_SETL2: |
1307 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) | 1307 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) |
1308 | return -ENODEV; | 1308 | return -ENODEV; |
1309 | if ((c->arg & 255) < ISDNLOOP_BCH) { | 1309 | if ((c->arg & 255) < ISDNLOOP_BCH) { |
1310 | a = c->arg; | 1310 | a = c->arg; |
1311 | switch (a >> 8) { | 1311 | switch (a >> 8) { |
1312 | case ISDN_PROTO_L2_X75I: | 1312 | case ISDN_PROTO_L2_X75I: |
1313 | sprintf(cbuf, "%02d;BX75\n", (int) (a & 255) + 1); | 1313 | sprintf(cbuf, "%02d;BX75\n", (int) (a & 255) + 1); |
1314 | break; | 1314 | break; |
1315 | #ifdef CONFIG_ISDN_X25 | 1315 | #ifdef CONFIG_ISDN_X25 |
1316 | case ISDN_PROTO_L2_X25DTE: | 1316 | case ISDN_PROTO_L2_X25DTE: |
1317 | sprintf(cbuf, "%02d;BX2T\n", (int) (a & 255) + 1); | 1317 | sprintf(cbuf, "%02d;BX2T\n", (int) (a & 255) + 1); |
1318 | break; | 1318 | break; |
1319 | case ISDN_PROTO_L2_X25DCE: | 1319 | case ISDN_PROTO_L2_X25DCE: |
1320 | sprintf(cbuf, "%02d;BX2C\n", (int) (a & 255) + 1); | 1320 | sprintf(cbuf, "%02d;BX2C\n", (int) (a & 255) + 1); |
1321 | break; | 1321 | break; |
1322 | #endif | 1322 | #endif |
1323 | case ISDN_PROTO_L2_HDLC: | 1323 | case ISDN_PROTO_L2_HDLC: |
1324 | sprintf(cbuf, "%02d;BTRA\n", (int) (a & 255) + 1); | 1324 | sprintf(cbuf, "%02d;BTRA\n", (int) (a & 255) + 1); |
1325 | break; | 1325 | break; |
1326 | case ISDN_PROTO_L2_TRANS: | 1326 | case ISDN_PROTO_L2_TRANS: |
1327 | sprintf(cbuf, "%02d;BTRA\n", (int) (a & 255) + 1); | 1327 | sprintf(cbuf, "%02d;BTRA\n", (int) (a & 255) + 1); |
1328 | break; | 1328 | break; |
1329 | default: | 1329 | default: |
1330 | return -EINVAL; | 1330 | return -EINVAL; |
1331 | } | ||
1332 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); | ||
1333 | card->l2_proto[a & 255] = (a >> 8); | ||
1334 | } | 1331 | } |
1335 | break; | 1332 | i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); |
1333 | card->l2_proto[a & 255] = (a >> 8); | ||
1334 | } | ||
1335 | break; | ||
1336 | case ISDN_CMD_SETL3: | 1336 | case ISDN_CMD_SETL3: |
1337 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) | 1337 | if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) |
1338 | return -ENODEV; | 1338 | return -ENODEV; |
1339 | return 0; | 1339 | return 0; |
1340 | default: | 1340 | default: |
1341 | return -EINVAL; | 1341 | return -EINVAL; |
1342 | } | 1342 | } |
1343 | } | 1343 | } |
1344 | return 0; | 1344 | return 0; |
1345 | } | 1345 | } |
@@ -1364,7 +1364,7 @@ isdnloop_findcard(int driverid) | |||
1364 | * Wrapper functions for interface to linklevel | 1364 | * Wrapper functions for interface to linklevel |
1365 | */ | 1365 | */ |
1366 | static int | 1366 | static int |
1367 | if_command(isdn_ctrl * c) | 1367 | if_command(isdn_ctrl *c) |
1368 | { | 1368 | { |
1369 | isdnloop_card *card = isdnloop_findcard(c->driver); | 1369 | isdnloop_card *card = isdnloop_findcard(c->driver); |
1370 | 1370 | ||
@@ -1434,12 +1434,12 @@ isdnloop_initcard(char *id) | |||
1434 | 1434 | ||
1435 | if (!(card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL))) { | 1435 | if (!(card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL))) { |
1436 | printk(KERN_WARNING | 1436 | printk(KERN_WARNING |
1437 | "isdnloop: (%s) Could not allocate card-struct.\n", id); | 1437 | "isdnloop: (%s) Could not allocate card-struct.\n", id); |
1438 | return (isdnloop_card *) 0; | 1438 | return (isdnloop_card *) 0; |
1439 | } | 1439 | } |
1440 | card->interface.owner = THIS_MODULE; | 1440 | card->interface.owner = THIS_MODULE; |
1441 | card->interface.channels = ISDNLOOP_BCH; | 1441 | card->interface.channels = ISDNLOOP_BCH; |
1442 | card->interface.hl_hdrlen = 1; /* scratch area for storing ack flag*/ | 1442 | card->interface.hl_hdrlen = 1; /* scratch area for storing ack flag*/ |
1443 | card->interface.maxbufsize = 4000; | 1443 | card->interface.maxbufsize = 4000; |
1444 | card->interface.command = if_command; | 1444 | card->interface.command = if_command; |
1445 | card->interface.writebuf_skb = if_sendbuf; | 1445 | card->interface.writebuf_skb = if_sendbuf; |
@@ -1447,12 +1447,12 @@ isdnloop_initcard(char *id) | |||
1447 | card->interface.readstat = if_readstatus; | 1447 | card->interface.readstat = if_readstatus; |
1448 | card->interface.features = ISDN_FEATURE_L2_X75I | | 1448 | card->interface.features = ISDN_FEATURE_L2_X75I | |
1449 | #ifdef CONFIG_ISDN_X25 | 1449 | #ifdef CONFIG_ISDN_X25 |
1450 | ISDN_FEATURE_L2_X25DTE | | 1450 | ISDN_FEATURE_L2_X25DTE | |
1451 | ISDN_FEATURE_L2_X25DCE | | 1451 | ISDN_FEATURE_L2_X25DCE | |
1452 | #endif | 1452 | #endif |
1453 | ISDN_FEATURE_L2_HDLC | | 1453 | ISDN_FEATURE_L2_HDLC | |
1454 | ISDN_FEATURE_L3_TRANS | | 1454 | ISDN_FEATURE_L3_TRANS | |
1455 | ISDN_FEATURE_P_UNKNOWN; | 1455 | ISDN_FEATURE_P_UNKNOWN; |
1456 | card->ptype = ISDN_PTYPE_UNKNOWN; | 1456 | card->ptype = ISDN_PTYPE_UNKNOWN; |
1457 | strlcpy(card->interface.id, id, sizeof(card->interface.id)); | 1457 | strlcpy(card->interface.id, id, sizeof(card->interface.id)); |
1458 | card->msg_buf_write = card->msg_buf; | 1458 | card->msg_buf_write = card->msg_buf; |