diff options
Diffstat (limited to 'drivers/isdn/i4l/isdn_tty.c')
-rw-r--r-- | drivers/isdn/i4l/isdn_tty.c | 2440 |
1 files changed, 1220 insertions, 1220 deletions
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index ac4840124bc0..3831abdbc66f 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c | |||
@@ -61,7 +61,7 @@ char *isdn_tty_revision = "$Revision: 1.1.2.3 $"; | |||
61 | * isdn_tty_readmodem(). | 61 | * isdn_tty_readmodem(). |
62 | */ | 62 | */ |
63 | static int | 63 | static int |
64 | isdn_tty_try_read(modem_info * info, struct sk_buff *skb) | 64 | isdn_tty_try_read(modem_info *info, struct sk_buff *skb) |
65 | { | 65 | { |
66 | int c; | 66 | int c; |
67 | int len; | 67 | int len; |
@@ -93,7 +93,7 @@ isdn_tty_try_read(modem_info * info, struct sk_buff *skb) | |||
93 | last = *dp; | 93 | last = *dp; |
94 | } else { | 94 | } else { |
95 | #endif | 95 | #endif |
96 | if(len > 1) | 96 | if (len > 1) |
97 | tty_insert_flip_string(tty, skb->data, len - 1); | 97 | tty_insert_flip_string(tty, skb->data, len - 1); |
98 | last = skb->data[len - 1]; | 98 | last = skb->data[len - 1]; |
99 | #ifdef CONFIG_ISDN_AUDIO | 99 | #ifdef CONFIG_ISDN_AUDIO |
@@ -179,7 +179,7 @@ isdn_tty_rcv_skb(int i, int di, int channel, struct sk_buff *skb) | |||
179 | info = &dev->mdm.info[midx]; | 179 | info = &dev->mdm.info[midx]; |
180 | #ifdef CONFIG_ISDN_AUDIO | 180 | #ifdef CONFIG_ISDN_AUDIO |
181 | ifmt = 1; | 181 | ifmt = 1; |
182 | 182 | ||
183 | if ((info->vonline) && (!info->emu.vpar[4])) | 183 | if ((info->vonline) && (!info->emu.vpar[4])) |
184 | isdn_audio_calc_dtmf(info, skb->data, skb->len, ifmt); | 184 | isdn_audio_calc_dtmf(info, skb->data, skb->len, ifmt); |
185 | if ((info->vonline & 1) && (info->emu.vpar[1])) | 185 | if ((info->vonline & 1) && (info->emu.vpar[1])) |
@@ -213,29 +213,29 @@ isdn_tty_rcv_skb(int i, int di, int channel, struct sk_buff *skb) | |||
213 | if (info->vonline & 1) { | 213 | if (info->vonline & 1) { |
214 | /* voice conversion/compression */ | 214 | /* voice conversion/compression */ |
215 | switch (info->emu.vpar[3]) { | 215 | switch (info->emu.vpar[3]) { |
216 | case 2: | 216 | case 2: |
217 | case 3: | 217 | case 3: |
218 | case 4: | 218 | case 4: |
219 | /* adpcm | 219 | /* adpcm |
220 | * Since compressed data takes less | 220 | * Since compressed data takes less |
221 | * space, we can overwrite the buffer. | 221 | * space, we can overwrite the buffer. |
222 | */ | 222 | */ |
223 | skb_trim(skb, isdn_audio_xlaw2adpcm(info->adpcmr, | 223 | skb_trim(skb, isdn_audio_xlaw2adpcm(info->adpcmr, |
224 | ifmt, | 224 | ifmt, |
225 | skb->data, | 225 | skb->data, |
226 | skb->data, | 226 | skb->data, |
227 | skb->len)); | 227 | skb->len)); |
228 | break; | 228 | break; |
229 | case 5: | 229 | case 5: |
230 | /* a-law */ | 230 | /* a-law */ |
231 | if (!ifmt) | 231 | if (!ifmt) |
232 | isdn_audio_ulaw2alaw(skb->data, skb->len); | 232 | isdn_audio_ulaw2alaw(skb->data, skb->len); |
233 | break; | 233 | break; |
234 | case 6: | 234 | case 6: |
235 | /* u-law */ | 235 | /* u-law */ |
236 | if (ifmt) | 236 | if (ifmt) |
237 | isdn_audio_alaw2ulaw(skb->data, skb->len); | 237 | isdn_audio_alaw2ulaw(skb->data, skb->len); |
238 | break; | 238 | break; |
239 | } | 239 | } |
240 | ISDN_AUDIO_SKB_DLECOUNT(skb) = | 240 | ISDN_AUDIO_SKB_DLECOUNT(skb) = |
241 | isdn_tty_countDLE(skb->data, skb->len); | 241 | isdn_tty_countDLE(skb->data, skb->len); |
@@ -275,7 +275,7 @@ isdn_tty_rcv_skb(int i, int di, int channel, struct sk_buff *skb) | |||
275 | } | 275 | } |
276 | 276 | ||
277 | static void | 277 | static void |
278 | isdn_tty_cleanup_xmit(modem_info * info) | 278 | isdn_tty_cleanup_xmit(modem_info *info) |
279 | { | 279 | { |
280 | skb_queue_purge(&info->xmit_queue); | 280 | skb_queue_purge(&info->xmit_queue); |
281 | #ifdef CONFIG_ISDN_AUDIO | 281 | #ifdef CONFIG_ISDN_AUDIO |
@@ -284,7 +284,7 @@ isdn_tty_cleanup_xmit(modem_info * info) | |||
284 | } | 284 | } |
285 | 285 | ||
286 | static void | 286 | static void |
287 | isdn_tty_tint(modem_info * info) | 287 | isdn_tty_tint(modem_info *info) |
288 | { | 288 | { |
289 | struct sk_buff *skb = skb_dequeue(&info->xmit_queue); | 289 | struct sk_buff *skb = skb_dequeue(&info->xmit_queue); |
290 | int len, slen; | 290 | int len, slen; |
@@ -325,7 +325,7 @@ isdn_tty_countDLE(unsigned char *buf, int len) | |||
325 | * DLE-decoding when sending audio-data. | 325 | * DLE-decoding when sending audio-data. |
326 | */ | 326 | */ |
327 | static int | 327 | static int |
328 | isdn_tty_handleDLEdown(modem_info * info, atemu * m, int len) | 328 | isdn_tty_handleDLEdown(modem_info *info, atemu *m, int len) |
329 | { | 329 | { |
330 | unsigned char *p = &info->xmit_buf[info->xmit_count]; | 330 | unsigned char *p = &info->xmit_buf[info->xmit_count]; |
331 | int count = 0; | 331 | int count = 0; |
@@ -334,42 +334,42 @@ isdn_tty_handleDLEdown(modem_info * info, atemu * m, int len) | |||
334 | if (m->lastDLE) { | 334 | if (m->lastDLE) { |
335 | m->lastDLE = 0; | 335 | m->lastDLE = 0; |
336 | switch (*p) { | 336 | switch (*p) { |
337 | case DLE: | 337 | case DLE: |
338 | /* Escape code */ | 338 | /* Escape code */ |
339 | if (len > 1) | 339 | if (len > 1) |
340 | memmove(p, p + 1, len - 1); | 340 | memmove(p, p + 1, len - 1); |
341 | p--; | 341 | p--; |
342 | count++; | 342 | count++; |
343 | break; | 343 | break; |
344 | case ETX: | 344 | case ETX: |
345 | /* End of data */ | 345 | /* End of data */ |
346 | info->vonline |= 4; | 346 | info->vonline |= 4; |
347 | return count; | 347 | return count; |
348 | case DC4: | 348 | case DC4: |
349 | /* Abort RX */ | 349 | /* Abort RX */ |
350 | info->vonline &= ~1; | 350 | info->vonline &= ~1; |
351 | #ifdef ISDN_DEBUG_MODEM_VOICE | 351 | #ifdef ISDN_DEBUG_MODEM_VOICE |
352 | printk(KERN_DEBUG | 352 | printk(KERN_DEBUG |
353 | "DLEdown: got DLE-DC4, send DLE-ETX on ttyI%d\n", | 353 | "DLEdown: got DLE-DC4, send DLE-ETX on ttyI%d\n", |
354 | info->line); | 354 | info->line); |
355 | #endif | 355 | #endif |
356 | isdn_tty_at_cout("\020\003", info); | 356 | isdn_tty_at_cout("\020\003", info); |
357 | if (!info->vonline) { | 357 | if (!info->vonline) { |
358 | #ifdef ISDN_DEBUG_MODEM_VOICE | 358 | #ifdef ISDN_DEBUG_MODEM_VOICE |
359 | printk(KERN_DEBUG | 359 | printk(KERN_DEBUG |
360 | "DLEdown: send VCON on ttyI%d\n", | 360 | "DLEdown: send VCON on ttyI%d\n", |
361 | info->line); | 361 | info->line); |
362 | #endif | 362 | #endif |
363 | isdn_tty_at_cout("\r\nVCON\r\n", info); | 363 | isdn_tty_at_cout("\r\nVCON\r\n", info); |
364 | } | 364 | } |
365 | /* Fall through */ | 365 | /* Fall through */ |
366 | case 'q': | 366 | case 'q': |
367 | case 's': | 367 | case 's': |
368 | /* Silence */ | 368 | /* Silence */ |
369 | if (len > 1) | 369 | if (len > 1) |
370 | memmove(p, p + 1, len - 1); | 370 | memmove(p, p + 1, len - 1); |
371 | p--; | 371 | p--; |
372 | break; | 372 | break; |
373 | } | 373 | } |
374 | } else { | 374 | } else { |
375 | if (*p == DLE) | 375 | if (*p == DLE) |
@@ -416,7 +416,7 @@ static int voice_cf[7] = | |||
416 | * T.70 if necessary, and finally queues it up for sending via isdn_tty_tint. | 416 | * T.70 if necessary, and finally queues it up for sending via isdn_tty_tint. |
417 | */ | 417 | */ |
418 | static void | 418 | static void |
419 | isdn_tty_senddown(modem_info * info) | 419 | isdn_tty_senddown(modem_info *info) |
420 | { | 420 | { |
421 | int buflen; | 421 | int buflen; |
422 | int skb_res; | 422 | int skb_res; |
@@ -440,9 +440,9 @@ isdn_tty_senddown(modem_info * info) | |||
440 | #endif | 440 | #endif |
441 | if (!(buflen = info->xmit_count)) | 441 | if (!(buflen = info->xmit_count)) |
442 | return; | 442 | return; |
443 | if ((info->emu.mdmreg[REG_CTS] & BIT_CTS) != 0) | 443 | if ((info->emu.mdmreg[REG_CTS] & BIT_CTS) != 0) |
444 | info->msr &= ~UART_MSR_CTS; | 444 | info->msr &= ~UART_MSR_CTS; |
445 | info->lsr &= ~UART_LSR_TEMT; | 445 | info->lsr &= ~UART_LSR_TEMT; |
446 | /* info->xmit_count is modified here and in isdn_tty_write(). | 446 | /* info->xmit_count is modified here and in isdn_tty_write(). |
447 | * So we return here if isdn_tty_write() is in the | 447 | * So we return here if isdn_tty_write() is in the |
448 | * critical section. | 448 | * critical section. |
@@ -485,32 +485,32 @@ isdn_tty_senddown(modem_info * info) | |||
485 | 485 | ||
486 | /* voice conversion/decompression */ | 486 | /* voice conversion/decompression */ |
487 | switch (info->emu.vpar[3]) { | 487 | switch (info->emu.vpar[3]) { |
488 | case 2: | 488 | case 2: |
489 | case 3: | 489 | case 3: |
490 | case 4: | 490 | case 4: |
491 | /* adpcm, compatible to ZyXel 1496 modem | 491 | /* adpcm, compatible to ZyXel 1496 modem |
492 | * with ROM revision 6.01 | 492 | * with ROM revision 6.01 |
493 | */ | 493 | */ |
494 | audio_len = isdn_audio_adpcm2xlaw(info->adpcms, | 494 | audio_len = isdn_audio_adpcm2xlaw(info->adpcms, |
495 | ifmt, | 495 | ifmt, |
496 | skb->data, | 496 | skb->data, |
497 | skb_put(skb, audio_len), | 497 | skb_put(skb, audio_len), |
498 | buflen); | 498 | buflen); |
499 | skb_pull(skb, buflen); | 499 | skb_pull(skb, buflen); |
500 | skb_trim(skb, audio_len); | 500 | skb_trim(skb, audio_len); |
501 | break; | 501 | break; |
502 | case 5: | 502 | case 5: |
503 | /* a-law */ | 503 | /* a-law */ |
504 | if (!ifmt) | 504 | if (!ifmt) |
505 | isdn_audio_alaw2ulaw(skb->data, | 505 | isdn_audio_alaw2ulaw(skb->data, |
506 | buflen); | 506 | buflen); |
507 | break; | 507 | break; |
508 | case 6: | 508 | case 6: |
509 | /* u-law */ | 509 | /* u-law */ |
510 | if (ifmt) | 510 | if (ifmt) |
511 | isdn_audio_ulaw2alaw(skb->data, | 511 | isdn_audio_ulaw2alaw(skb->data, |
512 | buflen); | 512 | buflen); |
513 | break; | 513 | break; |
514 | } | 514 | } |
515 | } | 515 | } |
516 | #endif /* CONFIG_ISDN_AUDIO */ | 516 | #endif /* CONFIG_ISDN_AUDIO */ |
@@ -550,7 +550,7 @@ isdn_tty_modem_do_ncarrier(unsigned long data) | |||
550 | * low. | 550 | * low. |
551 | */ | 551 | */ |
552 | static void | 552 | static void |
553 | isdn_tty_modem_ncarrier(modem_info * info) | 553 | isdn_tty_modem_ncarrier(modem_info *info) |
554 | { | 554 | { |
555 | if (info->ncarrier) { | 555 | if (info->ncarrier) { |
556 | info->nc_timer.expires = jiffies + HZ; | 556 | info->nc_timer.expires = jiffies + HZ; |
@@ -568,30 +568,30 @@ isdn_calc_usage(int si, int l2) | |||
568 | 568 | ||
569 | #ifdef CONFIG_ISDN_AUDIO | 569 | #ifdef CONFIG_ISDN_AUDIO |
570 | if (si == 1) { | 570 | if (si == 1) { |
571 | switch(l2) { | 571 | switch (l2) { |
572 | case ISDN_PROTO_L2_MODEM: | 572 | case ISDN_PROTO_L2_MODEM: |
573 | usg = ISDN_USAGE_MODEM; | 573 | usg = ISDN_USAGE_MODEM; |
574 | break; | 574 | break; |
575 | #ifdef CONFIG_ISDN_TTY_FAX | 575 | #ifdef CONFIG_ISDN_TTY_FAX |
576 | case ISDN_PROTO_L2_FAX: | 576 | case ISDN_PROTO_L2_FAX: |
577 | usg = ISDN_USAGE_FAX; | 577 | usg = ISDN_USAGE_FAX; |
578 | break; | 578 | break; |
579 | #endif | 579 | #endif |
580 | case ISDN_PROTO_L2_TRANS: | 580 | case ISDN_PROTO_L2_TRANS: |
581 | default: | 581 | default: |
582 | usg = ISDN_USAGE_VOICE; | 582 | usg = ISDN_USAGE_VOICE; |
583 | break; | 583 | break; |
584 | } | 584 | } |
585 | } | 585 | } |
586 | #endif | 586 | #endif |
587 | return(usg); | 587 | return (usg); |
588 | } | 588 | } |
589 | 589 | ||
590 | /* isdn_tty_dial() performs dialing of a tty an the necessary | 590 | /* isdn_tty_dial() performs dialing of a tty an the necessary |
591 | * setup of the lower levels before that. | 591 | * setup of the lower levels before that. |
592 | */ | 592 | */ |
593 | static void | 593 | static void |
594 | isdn_tty_dial(char *n, modem_info * info, atemu * m) | 594 | isdn_tty_dial(char *n, modem_info *info, atemu *m) |
595 | { | 595 | { |
596 | int usg = ISDN_USAGE_MODEM; | 596 | int usg = ISDN_USAGE_MODEM; |
597 | int si = 7; | 597 | int si = 7; |
@@ -608,10 +608,10 @@ isdn_tty_dial(char *n, modem_info * info, atemu * m) | |||
608 | } | 608 | } |
609 | usg = isdn_calc_usage(si, l2); | 609 | usg = isdn_calc_usage(si, l2); |
610 | #ifdef CONFIG_ISDN_AUDIO | 610 | #ifdef CONFIG_ISDN_AUDIO |
611 | if ((si == 1) && | 611 | if ((si == 1) && |
612 | (l2 != ISDN_PROTO_L2_MODEM) | 612 | (l2 != ISDN_PROTO_L2_MODEM) |
613 | #ifdef CONFIG_ISDN_TTY_FAX | 613 | #ifdef CONFIG_ISDN_TTY_FAX |
614 | && (l2 != ISDN_PROTO_L2_FAX) | 614 | && (l2 != ISDN_PROTO_L2_FAX) |
615 | #endif | 615 | #endif |
616 | ) { | 616 | ) { |
617 | l2 = ISDN_PROTO_L2_TRANS; | 617 | l2 = ISDN_PROTO_L2_TRANS; |
@@ -679,7 +679,7 @@ isdn_tty_dial(char *n, modem_info * info, atemu * m) | |||
679 | * and some cleanup is done also. | 679 | * and some cleanup is done also. |
680 | */ | 680 | */ |
681 | void | 681 | void |
682 | isdn_tty_modem_hup(modem_info * info, int local) | 682 | isdn_tty_modem_hup(modem_info *info, int local) |
683 | { | 683 | { |
684 | isdn_ctrl cmd; | 684 | isdn_ctrl cmd; |
685 | int di, ch; | 685 | int di, ch; |
@@ -723,7 +723,7 @@ isdn_tty_modem_hup(modem_info * info, int local) | |||
723 | info->adpcmr = NULL; | 723 | info->adpcmr = NULL; |
724 | #endif | 724 | #endif |
725 | if ((info->msr & UART_MSR_RI) && | 725 | if ((info->msr & UART_MSR_RI) && |
726 | (info->emu.mdmreg[REG_RUNG] & BIT_RUNG)) | 726 | (info->emu.mdmreg[REG_RUNG] & BIT_RUNG)) |
727 | isdn_tty_modem_result(RESULT_RUNG, info); | 727 | isdn_tty_modem_result(RESULT_RUNG, info); |
728 | info->msr &= ~(UART_MSR_DCD | UART_MSR_RI); | 728 | info->msr &= ~(UART_MSR_DCD | UART_MSR_RI); |
729 | info->lsr |= UART_LSR_TEMT; | 729 | info->lsr |= UART_LSR_TEMT; |
@@ -746,7 +746,7 @@ isdn_tty_modem_hup(modem_info * info, int local) | |||
746 | } | 746 | } |
747 | 747 | ||
748 | /* | 748 | /* |
749 | * Begin of a CAPI like interface, currently used only for | 749 | * Begin of a CAPI like interface, currently used only for |
750 | * supplementary service (CAPI 2.0 part III) | 750 | * supplementary service (CAPI 2.0 part III) |
751 | */ | 751 | */ |
752 | #include <linux/isdn/capicmd.h> | 752 | #include <linux/isdn/capicmd.h> |
@@ -754,16 +754,16 @@ isdn_tty_modem_hup(modem_info * info, int local) | |||
754 | 754 | ||
755 | int | 755 | int |
756 | isdn_tty_capi_facility(capi_msg *cm) { | 756 | isdn_tty_capi_facility(capi_msg *cm) { |
757 | return(-1); /* dummy */ | 757 | return (-1); /* dummy */ |
758 | } | 758 | } |
759 | 759 | ||
760 | /* isdn_tty_suspend() tries to suspend the current tty connection | 760 | /* isdn_tty_suspend() tries to suspend the current tty connection |
761 | */ | 761 | */ |
762 | static void | 762 | static void |
763 | isdn_tty_suspend(char *id, modem_info * info, atemu * m) | 763 | isdn_tty_suspend(char *id, modem_info *info, atemu *m) |
764 | { | 764 | { |
765 | isdn_ctrl cmd; | 765 | isdn_ctrl cmd; |
766 | 766 | ||
767 | int l; | 767 | int l; |
768 | 768 | ||
769 | if (!info) | 769 | if (!info) |
@@ -774,7 +774,7 @@ isdn_tty_suspend(char *id, modem_info * info, atemu * m) | |||
774 | #endif | 774 | #endif |
775 | l = strlen(id); | 775 | l = strlen(id); |
776 | if ((info->isdn_driver >= 0)) { | 776 | if ((info->isdn_driver >= 0)) { |
777 | cmd.parm.cmsg.Length = l+18; | 777 | cmd.parm.cmsg.Length = l + 18; |
778 | cmd.parm.cmsg.Command = CAPI_FACILITY; | 778 | cmd.parm.cmsg.Command = CAPI_FACILITY; |
779 | cmd.parm.cmsg.Subcommand = CAPI_REQ; | 779 | cmd.parm.cmsg.Subcommand = CAPI_REQ; |
780 | cmd.parm.cmsg.adr.Controller = info->isdn_driver + 1; | 780 | cmd.parm.cmsg.adr.Controller = info->isdn_driver + 1; |
@@ -800,7 +800,7 @@ isdn_tty_suspend(char *id, modem_info * info, atemu * m) | |||
800 | */ | 800 | */ |
801 | 801 | ||
802 | static void | 802 | static void |
803 | isdn_tty_resume(char *id, modem_info * info, atemu * m) | 803 | isdn_tty_resume(char *id, modem_info *info, atemu *m) |
804 | { | 804 | { |
805 | int usg = ISDN_USAGE_MODEM; | 805 | int usg = ISDN_USAGE_MODEM; |
806 | int si = 7; | 806 | int si = 7; |
@@ -819,10 +819,10 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m) | |||
819 | } | 819 | } |
820 | usg = isdn_calc_usage(si, l2); | 820 | usg = isdn_calc_usage(si, l2); |
821 | #ifdef CONFIG_ISDN_AUDIO | 821 | #ifdef CONFIG_ISDN_AUDIO |
822 | if ((si == 1) && | 822 | if ((si == 1) && |
823 | (l2 != ISDN_PROTO_L2_MODEM) | 823 | (l2 != ISDN_PROTO_L2_MODEM) |
824 | #ifdef CONFIG_ISDN_TTY_FAX | 824 | #ifdef CONFIG_ISDN_TTY_FAX |
825 | && (l2 != ISDN_PROTO_L2_FAX) | 825 | && (l2 != ISDN_PROTO_L2_FAX) |
826 | #endif | 826 | #endif |
827 | ) { | 827 | ) { |
828 | l2 = ISDN_PROTO_L2_TRANS; | 828 | l2 = ISDN_PROTO_L2_TRANS; |
@@ -864,18 +864,18 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m) | |||
864 | isdn_command(&cmd); | 864 | isdn_command(&cmd); |
865 | cmd.driver = info->isdn_driver; | 865 | cmd.driver = info->isdn_driver; |
866 | cmd.arg = info->isdn_channel; | 866 | cmd.arg = info->isdn_channel; |
867 | cmd.parm.cmsg.Length = l+18; | 867 | cmd.parm.cmsg.Length = l + 18; |
868 | cmd.parm.cmsg.Command = CAPI_FACILITY; | 868 | cmd.parm.cmsg.Command = CAPI_FACILITY; |
869 | cmd.parm.cmsg.Subcommand = CAPI_REQ; | 869 | cmd.parm.cmsg.Subcommand = CAPI_REQ; |
870 | cmd.parm.cmsg.adr.Controller = info->isdn_driver + 1; | 870 | cmd.parm.cmsg.adr.Controller = info->isdn_driver + 1; |
871 | cmd.parm.cmsg.para[0] = 3; /* 16 bit 0x0003 suplementary service */ | 871 | cmd.parm.cmsg.para[0] = 3; /* 16 bit 0x0003 suplementary service */ |
872 | cmd.parm.cmsg.para[1] = 0; | 872 | cmd.parm.cmsg.para[1] = 0; |
873 | cmd.parm.cmsg.para[2] = l+3; | 873 | cmd.parm.cmsg.para[2] = l + 3; |
874 | cmd.parm.cmsg.para[3] = 5; /* 16 bit 0x0005 Resume */ | 874 | cmd.parm.cmsg.para[3] = 5; /* 16 bit 0x0005 Resume */ |
875 | cmd.parm.cmsg.para[4] = 0; | 875 | cmd.parm.cmsg.para[4] = 0; |
876 | cmd.parm.cmsg.para[5] = l; | 876 | cmd.parm.cmsg.para[5] = l; |
877 | strncpy(&cmd.parm.cmsg.para[6], id, l); | 877 | strncpy(&cmd.parm.cmsg.para[6], id, l); |
878 | cmd.command =CAPI_PUT_MESSAGE; | 878 | cmd.command = CAPI_PUT_MESSAGE; |
879 | info->dialing = 1; | 879 | info->dialing = 1; |
880 | // strcpy(dev->num[i], n); | 880 | // strcpy(dev->num[i], n); |
881 | isdn_info_update(); | 881 | isdn_info_update(); |
@@ -889,7 +889,7 @@ isdn_tty_resume(char *id, modem_info * info, atemu * m) | |||
889 | */ | 889 | */ |
890 | 890 | ||
891 | static void | 891 | static void |
892 | isdn_tty_send_msg(modem_info * info, atemu * m, char *msg) | 892 | isdn_tty_send_msg(modem_info *info, atemu *m, char *msg) |
893 | { | 893 | { |
894 | int usg = ISDN_USAGE_MODEM; | 894 | int usg = ISDN_USAGE_MODEM; |
895 | int si = 7; | 895 | int si = 7; |
@@ -912,10 +912,10 @@ isdn_tty_send_msg(modem_info * info, atemu * m, char *msg) | |||
912 | } | 912 | } |
913 | usg = isdn_calc_usage(si, l2); | 913 | usg = isdn_calc_usage(si, l2); |
914 | #ifdef CONFIG_ISDN_AUDIO | 914 | #ifdef CONFIG_ISDN_AUDIO |
915 | if ((si == 1) && | 915 | if ((si == 1) && |
916 | (l2 != ISDN_PROTO_L2_MODEM) | 916 | (l2 != ISDN_PROTO_L2_MODEM) |
917 | #ifdef CONFIG_ISDN_TTY_FAX | 917 | #ifdef CONFIG_ISDN_TTY_FAX |
918 | && (l2 != ISDN_PROTO_L2_FAX) | 918 | && (l2 != ISDN_PROTO_L2_FAX) |
919 | #endif | 919 | #endif |
920 | ) { | 920 | ) { |
921 | l2 = ISDN_PROTO_L2_TRANS; | 921 | l2 = ISDN_PROTO_L2_TRANS; |
@@ -956,14 +956,14 @@ isdn_tty_send_msg(modem_info * info, atemu * m, char *msg) | |||
956 | isdn_command(&cmd); | 956 | isdn_command(&cmd); |
957 | cmd.driver = info->isdn_driver; | 957 | cmd.driver = info->isdn_driver; |
958 | cmd.arg = info->isdn_channel; | 958 | cmd.arg = info->isdn_channel; |
959 | cmd.parm.cmsg.Length = l+14; | 959 | cmd.parm.cmsg.Length = l + 14; |
960 | cmd.parm.cmsg.Command = CAPI_MANUFACTURER; | 960 | cmd.parm.cmsg.Command = CAPI_MANUFACTURER; |
961 | cmd.parm.cmsg.Subcommand = CAPI_REQ; | 961 | cmd.parm.cmsg.Subcommand = CAPI_REQ; |
962 | cmd.parm.cmsg.adr.Controller = info->isdn_driver + 1; | 962 | cmd.parm.cmsg.adr.Controller = info->isdn_driver + 1; |
963 | cmd.parm.cmsg.para[0] = l+1; | 963 | cmd.parm.cmsg.para[0] = l + 1; |
964 | strncpy(&cmd.parm.cmsg.para[1], msg, l); | 964 | strncpy(&cmd.parm.cmsg.para[1], msg, l); |
965 | cmd.parm.cmsg.para[l+1] = 0xd; | 965 | cmd.parm.cmsg.para[l + 1] = 0xd; |
966 | cmd.command =CAPI_PUT_MESSAGE; | 966 | cmd.command = CAPI_PUT_MESSAGE; |
967 | /* info->dialing = 1; | 967 | /* info->dialing = 1; |
968 | strcpy(dev->num[i], n); | 968 | strcpy(dev->num[i], n); |
969 | isdn_info_update(); | 969 | isdn_info_update(); |
@@ -978,7 +978,7 @@ isdn_tty_paranoia_check(modem_info *info, char *name, const char *routine) | |||
978 | #ifdef MODEM_PARANOIA_CHECK | 978 | #ifdef MODEM_PARANOIA_CHECK |
979 | if (!info) { | 979 | if (!info) { |
980 | printk(KERN_WARNING "isdn_tty: null info_struct for %s in %s\n", | 980 | printk(KERN_WARNING "isdn_tty: null info_struct for %s in %s\n", |
981 | name, routine); | 981 | name, routine); |
982 | return 1; | 982 | return 1; |
983 | } | 983 | } |
984 | if (info->magic != ISDN_ASYNC_MAGIC) { | 984 | if (info->magic != ISDN_ASYNC_MAGIC) { |
@@ -995,11 +995,11 @@ isdn_tty_paranoia_check(modem_info *info, char *name, const char *routine) | |||
995 | * the specified baud rate for a serial port. | 995 | * the specified baud rate for a serial port. |
996 | */ | 996 | */ |
997 | static void | 997 | static void |
998 | isdn_tty_change_speed(modem_info * info) | 998 | isdn_tty_change_speed(modem_info *info) |
999 | { | 999 | { |
1000 | uint cflag, | 1000 | uint cflag, |
1001 | cval, | 1001 | cval, |
1002 | quot; | 1002 | quot; |
1003 | int i; | 1003 | int i; |
1004 | 1004 | ||
1005 | if (!info->tty || !info->tty->termios) | 1005 | if (!info->tty || !info->tty->termios) |
@@ -1051,7 +1051,7 @@ isdn_tty_change_speed(modem_info * info) | |||
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | static int | 1053 | static int |
1054 | isdn_tty_startup(modem_info * info) | 1054 | isdn_tty_startup(modem_info *info) |
1055 | { | 1055 | { |
1056 | if (info->flags & ISDN_ASYNC_INITIALIZED) | 1056 | if (info->flags & ISDN_ASYNC_INITIALIZED) |
1057 | return 0; | 1057 | return 0; |
@@ -1081,7 +1081,7 @@ isdn_tty_startup(modem_info * info) | |||
1081 | * DTR is dropped if the hangup on close termio flag is on. | 1081 | * DTR is dropped if the hangup on close termio flag is on. |
1082 | */ | 1082 | */ |
1083 | static void | 1083 | static void |
1084 | isdn_tty_shutdown(modem_info * info) | 1084 | isdn_tty_shutdown(modem_info *info) |
1085 | { | 1085 | { |
1086 | if (!(info->flags & ISDN_ASYNC_INITIALIZED)) | 1086 | if (!(info->flags & ISDN_ASYNC_INITIALIZED)) |
1087 | return; | 1087 | return; |
@@ -1116,7 +1116,7 @@ isdn_tty_shutdown(modem_info * info) | |||
1116 | * - If dialing, abort dial. | 1116 | * - If dialing, abort dial. |
1117 | */ | 1117 | */ |
1118 | static int | 1118 | static int |
1119 | isdn_tty_write(struct tty_struct *tty, const u_char * buf, int count) | 1119 | isdn_tty_write(struct tty_struct *tty, const u_char *buf, int count) |
1120 | { | 1120 | { |
1121 | int c; | 1121 | int c; |
1122 | int total = 0; | 1122 | int total = 0; |
@@ -1176,27 +1176,27 @@ isdn_tty_write(struct tty_struct *tty, const u_char * buf, int count) | |||
1176 | } | 1176 | } |
1177 | } | 1177 | } |
1178 | } else | 1178 | } else |
1179 | if (TTY_IS_FCLASS1(info)) { | 1179 | if (TTY_IS_FCLASS1(info)) { |
1180 | int cc = isdn_tty_handleDLEdown(info, m, c); | 1180 | int cc = isdn_tty_handleDLEdown(info, m, c); |
1181 | 1181 | ||
1182 | if (info->vonline & 4) { /* ETX seen */ | 1182 | if (info->vonline & 4) { /* ETX seen */ |
1183 | isdn_ctrl c; | 1183 | isdn_ctrl c; |
1184 | 1184 | ||
1185 | c.command = ISDN_CMD_FAXCMD; | 1185 | c.command = ISDN_CMD_FAXCMD; |
1186 | c.driver = info->isdn_driver; | 1186 | c.driver = info->isdn_driver; |
1187 | c.arg = info->isdn_channel; | 1187 | c.arg = info->isdn_channel; |
1188 | c.parm.aux.cmd = ISDN_FAX_CLASS1_CTRL; | 1188 | c.parm.aux.cmd = ISDN_FAX_CLASS1_CTRL; |
1189 | c.parm.aux.subcmd = ETX; | 1189 | c.parm.aux.subcmd = ETX; |
1190 | isdn_command(&c); | 1190 | isdn_command(&c); |
1191 | } | 1191 | } |
1192 | info->vonline = 0; | 1192 | info->vonline = 0; |
1193 | #ifdef ISDN_DEBUG_MODEM_VOICE | 1193 | #ifdef ISDN_DEBUG_MODEM_VOICE |
1194 | printk(KERN_DEBUG "fax dle cc/c %d/%d\n", cc, c); | 1194 | printk(KERN_DEBUG "fax dle cc/c %d/%d\n", cc, c); |
1195 | #endif | 1195 | #endif |
1196 | info->xmit_count += cc; | 1196 | info->xmit_count += cc; |
1197 | } else | 1197 | } else |
1198 | #endif | 1198 | #endif |
1199 | info->xmit_count += c; | 1199 | info->xmit_count += c; |
1200 | } else { | 1200 | } else { |
1201 | info->msr |= UART_MSR_CTS; | 1201 | info->msr |= UART_MSR_CTS; |
1202 | info->lsr |= UART_LSR_TEMT; | 1202 | info->lsr |= UART_LSR_TEMT; |
@@ -1332,7 +1332,7 @@ isdn_tty_unthrottle(struct tty_struct *tty) | |||
1332 | * allows RS485 driver to be written in user space. | 1332 | * allows RS485 driver to be written in user space. |
1333 | */ | 1333 | */ |
1334 | static int | 1334 | static int |
1335 | isdn_tty_get_lsr_info(modem_info * info, uint __user * value) | 1335 | isdn_tty_get_lsr_info(modem_info *info, uint __user *value) |
1336 | { | 1336 | { |
1337 | u_char status; | 1337 | u_char status; |
1338 | uint result; | 1338 | uint result; |
@@ -1363,16 +1363,16 @@ isdn_tty_tiocmget(struct tty_struct *tty) | |||
1363 | status = info->msr; | 1363 | status = info->msr; |
1364 | mutex_unlock(&modem_info_mutex); | 1364 | mutex_unlock(&modem_info_mutex); |
1365 | return ((control & UART_MCR_RTS) ? TIOCM_RTS : 0) | 1365 | return ((control & UART_MCR_RTS) ? TIOCM_RTS : 0) |
1366 | | ((control & UART_MCR_DTR) ? TIOCM_DTR : 0) | 1366 | | ((control & UART_MCR_DTR) ? TIOCM_DTR : 0) |
1367 | | ((status & UART_MSR_DCD) ? TIOCM_CAR : 0) | 1367 | | ((status & UART_MSR_DCD) ? TIOCM_CAR : 0) |
1368 | | ((status & UART_MSR_RI) ? TIOCM_RNG : 0) | 1368 | | ((status & UART_MSR_RI) ? TIOCM_RNG : 0) |
1369 | | ((status & UART_MSR_DSR) ? TIOCM_DSR : 0) | 1369 | | ((status & UART_MSR_DSR) ? TIOCM_DSR : 0) |
1370 | | ((status & UART_MSR_CTS) ? TIOCM_CTS : 0); | 1370 | | ((status & UART_MSR_CTS) ? TIOCM_CTS : 0); |
1371 | } | 1371 | } |
1372 | 1372 | ||
1373 | static int | 1373 | static int |
1374 | isdn_tty_tiocmset(struct tty_struct *tty, | 1374 | isdn_tty_tiocmset(struct tty_struct *tty, |
1375 | unsigned int set, unsigned int clear) | 1375 | unsigned int set, unsigned int clear) |
1376 | { | 1376 | { |
1377 | modem_info *info = (modem_info *) tty->driver_data; | 1377 | modem_info *info = (modem_info *) tty->driver_data; |
1378 | 1378 | ||
@@ -1422,34 +1422,34 @@ isdn_tty_ioctl(struct tty_struct *tty, uint cmd, ulong arg) | |||
1422 | if (tty->flags & (1 << TTY_IO_ERROR)) | 1422 | if (tty->flags & (1 << TTY_IO_ERROR)) |
1423 | return -EIO; | 1423 | return -EIO; |
1424 | switch (cmd) { | 1424 | switch (cmd) { |
1425 | case TCSBRK: /* SVID version: non-zero arg --> no break */ | 1425 | case TCSBRK: /* SVID version: non-zero arg --> no break */ |
1426 | #ifdef ISDN_DEBUG_MODEM_IOCTL | 1426 | #ifdef ISDN_DEBUG_MODEM_IOCTL |
1427 | printk(KERN_DEBUG "ttyI%d ioctl TCSBRK\n", info->line); | 1427 | printk(KERN_DEBUG "ttyI%d ioctl TCSBRK\n", info->line); |
1428 | #endif | 1428 | #endif |
1429 | retval = tty_check_change(tty); | 1429 | retval = tty_check_change(tty); |
1430 | if (retval) | 1430 | if (retval) |
1431 | return retval; | 1431 | return retval; |
1432 | tty_wait_until_sent(tty, 0); | 1432 | tty_wait_until_sent(tty, 0); |
1433 | return 0; | 1433 | return 0; |
1434 | case TCSBRKP: /* support for POSIX tcsendbreak() */ | 1434 | case TCSBRKP: /* support for POSIX tcsendbreak() */ |
1435 | #ifdef ISDN_DEBUG_MODEM_IOCTL | 1435 | #ifdef ISDN_DEBUG_MODEM_IOCTL |
1436 | printk(KERN_DEBUG "ttyI%d ioctl TCSBRKP\n", info->line); | 1436 | printk(KERN_DEBUG "ttyI%d ioctl TCSBRKP\n", info->line); |
1437 | #endif | 1437 | #endif |
1438 | retval = tty_check_change(tty); | 1438 | retval = tty_check_change(tty); |
1439 | if (retval) | 1439 | if (retval) |
1440 | return retval; | 1440 | return retval; |
1441 | tty_wait_until_sent(tty, 0); | 1441 | tty_wait_until_sent(tty, 0); |
1442 | return 0; | 1442 | return 0; |
1443 | case TIOCSERGETLSR: /* Get line status register */ | 1443 | case TIOCSERGETLSR: /* Get line status register */ |
1444 | #ifdef ISDN_DEBUG_MODEM_IOCTL | 1444 | #ifdef ISDN_DEBUG_MODEM_IOCTL |
1445 | printk(KERN_DEBUG "ttyI%d ioctl TIOCSERGETLSR\n", info->line); | 1445 | printk(KERN_DEBUG "ttyI%d ioctl TIOCSERGETLSR\n", info->line); |
1446 | #endif | 1446 | #endif |
1447 | return isdn_tty_get_lsr_info(info, (uint __user *) arg); | 1447 | return isdn_tty_get_lsr_info(info, (uint __user *) arg); |
1448 | default: | 1448 | default: |
1449 | #ifdef ISDN_DEBUG_MODEM_IOCTL | 1449 | #ifdef ISDN_DEBUG_MODEM_IOCTL |
1450 | printk(KERN_DEBUG "UNKNOWN ioctl 0x%08x on ttyi%d\n", cmd, info->line); | 1450 | printk(KERN_DEBUG "UNKNOWN ioctl 0x%08x on ttyi%d\n", cmd, info->line); |
1451 | #endif | 1451 | #endif |
1452 | return -ENOIOCTLCMD; | 1452 | return -ENOIOCTLCMD; |
1453 | } | 1453 | } |
1454 | return 0; | 1454 | return 0; |
1455 | } | 1455 | } |
@@ -1479,7 +1479,7 @@ isdn_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios) | |||
1479 | * ------------------------------------------------------------ | 1479 | * ------------------------------------------------------------ |
1480 | */ | 1480 | */ |
1481 | static int | 1481 | static int |
1482 | isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info * info) | 1482 | isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info *info) |
1483 | { | 1483 | { |
1484 | DECLARE_WAITQUEUE(wait, NULL); | 1484 | DECLARE_WAITQUEUE(wait, NULL); |
1485 | int do_clocal = 0; | 1485 | int do_clocal = 0; |
@@ -1600,7 +1600,7 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp) | |||
1600 | return -ENODEV; | 1600 | return -ENODEV; |
1601 | } | 1601 | } |
1602 | #ifdef ISDN_DEBUG_MODEM_OPEN | 1602 | #ifdef ISDN_DEBUG_MODEM_OPEN |
1603 | printk(KERN_DEBUG "isdn_tty_open %s, count = %d\n", tty->name, | 1603 | printk(KERN_DEBUG "isdn_tty_open %s, count = %d\n", tty->name, |
1604 | info->count); | 1604 | info->count); |
1605 | #endif | 1605 | #endif |
1606 | info->count++; | 1606 | info->count++; |
@@ -1700,7 +1700,7 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp) | |||
1700 | timeout = jiffies + HZ; | 1700 | timeout = jiffies + HZ; |
1701 | while (!(info->lsr & UART_LSR_TEMT)) { | 1701 | while (!(info->lsr & UART_LSR_TEMT)) { |
1702 | schedule_timeout_interruptible(20); | 1702 | schedule_timeout_interruptible(20); |
1703 | if (time_after(jiffies,timeout)) | 1703 | if (time_after(jiffies, timeout)) |
1704 | break; | 1704 | break; |
1705 | } | 1705 | } |
1706 | } | 1706 | } |
@@ -1743,7 +1743,7 @@ isdn_tty_hangup(struct tty_struct *tty) | |||
1743 | /* This routine initializes all emulator-data. | 1743 | /* This routine initializes all emulator-data. |
1744 | */ | 1744 | */ |
1745 | static void | 1745 | static void |
1746 | isdn_tty_reset_profile(atemu * m) | 1746 | isdn_tty_reset_profile(atemu *m) |
1747 | { | 1747 | { |
1748 | m->profile[0] = 0; | 1748 | m->profile[0] = 0; |
1749 | m->profile[1] = 0; | 1749 | m->profile[1] = 0; |
@@ -1773,7 +1773,7 @@ isdn_tty_reset_profile(atemu * m) | |||
1773 | 1773 | ||
1774 | #ifdef CONFIG_ISDN_AUDIO | 1774 | #ifdef CONFIG_ISDN_AUDIO |
1775 | static void | 1775 | static void |
1776 | isdn_tty_modem_reset_vpar(atemu * m) | 1776 | isdn_tty_modem_reset_vpar(atemu *m) |
1777 | { | 1777 | { |
1778 | m->vpar[0] = 2; /* Voice-device (2 = phone line) */ | 1778 | m->vpar[0] = 2; /* Voice-device (2 = phone line) */ |
1779 | m->vpar[1] = 0; /* Silence detection level (0 = none ) */ | 1779 | m->vpar[1] = 0; /* Silence detection level (0 = none ) */ |
@@ -1786,7 +1786,7 @@ isdn_tty_modem_reset_vpar(atemu * m) | |||
1786 | 1786 | ||
1787 | #ifdef CONFIG_ISDN_TTY_FAX | 1787 | #ifdef CONFIG_ISDN_TTY_FAX |
1788 | static void | 1788 | static void |
1789 | isdn_tty_modem_reset_faxpar(modem_info * info) | 1789 | isdn_tty_modem_reset_faxpar(modem_info *info) |
1790 | { | 1790 | { |
1791 | T30_s *f = info->fax; | 1791 | T30_s *f = info->fax; |
1792 | 1792 | ||
@@ -1819,7 +1819,7 @@ isdn_tty_modem_reset_faxpar(modem_info * info) | |||
1819 | #endif | 1819 | #endif |
1820 | 1820 | ||
1821 | static void | 1821 | static void |
1822 | isdn_tty_modem_reset_regs(modem_info * info, int force) | 1822 | isdn_tty_modem_reset_regs(modem_info *info, int force) |
1823 | { | 1823 | { |
1824 | atemu *m = &info->emu; | 1824 | atemu *m = &info->emu; |
1825 | if ((m->mdmreg[REG_DTRR] & BIT_DTRR) || force) { | 1825 | if ((m->mdmreg[REG_DTRR] & BIT_DTRR) || force) { |
@@ -1838,7 +1838,7 @@ isdn_tty_modem_reset_regs(modem_info * info, int force) | |||
1838 | } | 1838 | } |
1839 | 1839 | ||
1840 | static void | 1840 | static void |
1841 | modem_write_profile(atemu * m) | 1841 | modem_write_profile(atemu *m) |
1842 | { | 1842 | { |
1843 | memcpy(m->profile, m->mdmreg, ISDN_MODEM_NUMREG); | 1843 | memcpy(m->profile, m->mdmreg, ISDN_MODEM_NUMREG); |
1844 | memcpy(m->pmsn, m->msn, ISDN_MSNLEN); | 1844 | memcpy(m->pmsn, m->msn, ISDN_MSNLEN); |
@@ -1848,7 +1848,7 @@ modem_write_profile(atemu * m) | |||
1848 | } | 1848 | } |
1849 | 1849 | ||
1850 | static const struct tty_operations modem_ops = { | 1850 | static const struct tty_operations modem_ops = { |
1851 | .open = isdn_tty_open, | 1851 | .open = isdn_tty_open, |
1852 | .close = isdn_tty_close, | 1852 | .close = isdn_tty_close, |
1853 | .write = isdn_tty_write, | 1853 | .write = isdn_tty_write, |
1854 | .flush_chars = isdn_tty_flush_chars, | 1854 | .flush_chars = isdn_tty_flush_chars, |
@@ -1948,7 +1948,7 @@ err_unregister: | |||
1948 | kfree(info->xmit_buf - 4); | 1948 | kfree(info->xmit_buf - 4); |
1949 | } | 1949 | } |
1950 | tty_unregister_driver(m->tty_modem); | 1950 | tty_unregister_driver(m->tty_modem); |
1951 | err: | 1951 | err: |
1952 | put_tty_driver(m->tty_modem); | 1952 | put_tty_driver(m->tty_modem); |
1953 | m->tty_modem = NULL; | 1953 | m->tty_modem = NULL; |
1954 | return retval; | 1954 | return retval; |
@@ -2018,8 +2018,8 @@ isdn_tty_match_icall(char *cid, atemu *emu, int di) | |||
2018 | int tmp; | 2018 | int tmp; |
2019 | tmp = isdn_msncmp(cid, isdn_map_eaz2msn(emu->msn, di)); | 2019 | tmp = isdn_msncmp(cid, isdn_map_eaz2msn(emu->msn, di)); |
2020 | #ifdef ISDN_DEBUG_MODEM_ICALL | 2020 | #ifdef ISDN_DEBUG_MODEM_ICALL |
2021 | printk(KERN_DEBUG "m_fi: mmsn=%s -> tmp=%d\n", | 2021 | printk(KERN_DEBUG "m_fi: mmsn=%s -> tmp=%d\n", |
2022 | isdn_map_eaz2msn(emu->msn, di), tmp); | 2022 | isdn_map_eaz2msn(emu->msn, di), tmp); |
2023 | #endif | 2023 | #endif |
2024 | return tmp; | 2024 | return tmp; |
2025 | } | 2025 | } |
@@ -2068,8 +2068,8 @@ isdn_tty_find_icall(int di, int ch, setup_parm *setup) | |||
2068 | for (i = 0; i < ISDN_MAX_CHANNELS; i++) { | 2068 | for (i = 0; i < ISDN_MAX_CHANNELS; i++) { |
2069 | modem_info *info = &dev->mdm.info[i]; | 2069 | modem_info *info = &dev->mdm.info[i]; |
2070 | 2070 | ||
2071 | if (info->count == 0) | 2071 | if (info->count == 0) |
2072 | continue; | 2072 | continue; |
2073 | if ((info->emu.mdmreg[REG_SI1] & si2bit[si1]) && /* SI1 is matching */ | 2073 | if ((info->emu.mdmreg[REG_SI1] & si2bit[si1]) && /* SI1 is matching */ |
2074 | (info->emu.mdmreg[REG_SI2] == si2)) { /* SI2 is matching */ | 2074 | (info->emu.mdmreg[REG_SI2] == si2)) { /* SI2 is matching */ |
2075 | idx = isdn_dc2minor(di, ch); | 2075 | idx = isdn_dc2minor(di, ch); |
@@ -2096,7 +2096,7 @@ isdn_tty_find_icall(int di, int ch, setup_parm *setup) | |||
2096 | info->drv_index = idx; | 2096 | info->drv_index = idx; |
2097 | dev->m_idx[idx] = info->line; | 2097 | dev->m_idx[idx] = info->line; |
2098 | dev->usage[idx] &= ISDN_USAGE_EXCLUSIVE; | 2098 | dev->usage[idx] &= ISDN_USAGE_EXCLUSIVE; |
2099 | dev->usage[idx] |= isdn_calc_usage(si1, info->emu.mdmreg[REG_L2PROT]); | 2099 | dev->usage[idx] |= isdn_calc_usage(si1, info->emu.mdmreg[REG_L2PROT]); |
2100 | strcpy(dev->num[idx], nr); | 2100 | strcpy(dev->num[idx], nr); |
2101 | strcpy(info->emu.cpn, eaz); | 2101 | strcpy(info->emu.cpn, eaz); |
2102 | info->emu.mdmreg[REG_SI1I] = si2bit[si1]; | 2102 | info->emu.mdmreg[REG_SI1I] = si2bit[si1]; |
@@ -2116,11 +2116,11 @@ isdn_tty_find_icall(int di, int ch, setup_parm *setup) | |||
2116 | } | 2116 | } |
2117 | spin_unlock_irqrestore(&dev->lock, flags); | 2117 | spin_unlock_irqrestore(&dev->lock, flags); |
2118 | printk(KERN_INFO "isdn_tty: call from %s -> %s %s\n", nr, eaz, | 2118 | printk(KERN_INFO "isdn_tty: call from %s -> %s %s\n", nr, eaz, |
2119 | ((dev->drv[di]->flags & DRV_FLAG_REJBUS) && (wret != 2))? "rejected" : "ignored"); | 2119 | ((dev->drv[di]->flags & DRV_FLAG_REJBUS) && (wret != 2)) ? "rejected" : "ignored"); |
2120 | return (wret == 2)?3:0; | 2120 | return (wret == 2) ? 3 : 0; |
2121 | } | 2121 | } |
2122 | 2122 | ||
2123 | #define TTY_IS_ACTIVE(info) \ | 2123 | #define TTY_IS_ACTIVE(info) \ |
2124 | (info->flags & (ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CALLOUT_ACTIVE)) | 2124 | (info->flags & (ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CALLOUT_ACTIVE)) |
2125 | 2125 | ||
2126 | int | 2126 | int |
@@ -2135,174 +2135,174 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c) | |||
2135 | if ((mi = dev->m_idx[i]) >= 0) { | 2135 | if ((mi = dev->m_idx[i]) >= 0) { |
2136 | info = &dev->mdm.info[mi]; | 2136 | info = &dev->mdm.info[mi]; |
2137 | switch (c->command) { | 2137 | switch (c->command) { |
2138 | case ISDN_STAT_CINF: | 2138 | case ISDN_STAT_CINF: |
2139 | printk(KERN_DEBUG "CHARGEINFO on ttyI%d: %ld %s\n", info->line, c->arg, c->parm.num); | 2139 | printk(KERN_DEBUG "CHARGEINFO on ttyI%d: %ld %s\n", info->line, c->arg, c->parm.num); |
2140 | info->emu.charge = (unsigned) simple_strtoul(c->parm.num, &e, 10); | 2140 | info->emu.charge = (unsigned) simple_strtoul(c->parm.num, &e, 10); |
2141 | if (e == (char *)c->parm.num) | 2141 | if (e == (char *)c->parm.num) |
2142 | info->emu.charge = 0; | 2142 | info->emu.charge = 0; |
2143 | 2143 | ||
2144 | break; | 2144 | break; |
2145 | case ISDN_STAT_BSENT: | 2145 | case ISDN_STAT_BSENT: |
2146 | #ifdef ISDN_TTY_STAT_DEBUG | ||
2147 | printk(KERN_DEBUG "tty_STAT_BSENT ttyI%d\n", info->line); | ||
2148 | #endif | ||
2149 | if ((info->isdn_driver == c->driver) && | ||
2150 | (info->isdn_channel == c->arg)) { | ||
2151 | info->msr |= UART_MSR_CTS; | ||
2152 | if (info->send_outstanding) | ||
2153 | if (!(--info->send_outstanding)) | ||
2154 | info->lsr |= UART_LSR_TEMT; | ||
2155 | isdn_tty_tint(info); | ||
2156 | return 1; | ||
2157 | } | ||
2158 | break; | ||
2159 | case ISDN_STAT_CAUSE: | ||
2160 | #ifdef ISDN_TTY_STAT_DEBUG | 2146 | #ifdef ISDN_TTY_STAT_DEBUG |
2161 | printk(KERN_DEBUG "tty_STAT_CAUSE ttyI%d\n", info->line); | 2147 | printk(KERN_DEBUG "tty_STAT_BSENT ttyI%d\n", info->line); |
2162 | #endif | 2148 | #endif |
2163 | /* Signal cause to tty-device */ | 2149 | if ((info->isdn_driver == c->driver) && |
2164 | strncpy(info->last_cause, c->parm.num, 5); | 2150 | (info->isdn_channel == c->arg)) { |
2151 | info->msr |= UART_MSR_CTS; | ||
2152 | if (info->send_outstanding) | ||
2153 | if (!(--info->send_outstanding)) | ||
2154 | info->lsr |= UART_LSR_TEMT; | ||
2155 | isdn_tty_tint(info); | ||
2165 | return 1; | 2156 | return 1; |
2166 | case ISDN_STAT_DISPLAY: | 2157 | } |
2158 | break; | ||
2159 | case ISDN_STAT_CAUSE: | ||
2167 | #ifdef ISDN_TTY_STAT_DEBUG | 2160 | #ifdef ISDN_TTY_STAT_DEBUG |
2168 | printk(KERN_DEBUG "tty_STAT_DISPLAY ttyI%d\n", info->line); | 2161 | printk(KERN_DEBUG "tty_STAT_CAUSE ttyI%d\n", info->line); |
2169 | #endif | 2162 | #endif |
2170 | /* Signal display to tty-device */ | 2163 | /* Signal cause to tty-device */ |
2171 | if ((info->emu.mdmreg[REG_DISPLAY] & BIT_DISPLAY) && | 2164 | strncpy(info->last_cause, c->parm.num, 5); |
2172 | !(info->emu.mdmreg[REG_RESPNUM] & BIT_RESPNUM)) { | 2165 | return 1; |
2173 | isdn_tty_at_cout("\r\n", info); | 2166 | case ISDN_STAT_DISPLAY: |
2174 | isdn_tty_at_cout("DISPLAY: ", info); | ||
2175 | isdn_tty_at_cout(c->parm.display, info); | ||
2176 | isdn_tty_at_cout("\r\n", info); | ||
2177 | } | ||
2178 | return 1; | ||
2179 | case ISDN_STAT_DCONN: | ||
2180 | #ifdef ISDN_TTY_STAT_DEBUG | 2167 | #ifdef ISDN_TTY_STAT_DEBUG |
2181 | printk(KERN_DEBUG "tty_STAT_DCONN ttyI%d\n", info->line); | 2168 | printk(KERN_DEBUG "tty_STAT_DISPLAY ttyI%d\n", info->line); |
2182 | #endif | 2169 | #endif |
2183 | if (TTY_IS_ACTIVE(info)) { | 2170 | /* Signal display to tty-device */ |
2184 | if (info->dialing == 1) { | 2171 | if ((info->emu.mdmreg[REG_DISPLAY] & BIT_DISPLAY) && |
2185 | info->dialing = 2; | 2172 | !(info->emu.mdmreg[REG_RESPNUM] & BIT_RESPNUM)) { |
2186 | return 1; | 2173 | isdn_tty_at_cout("\r\n", info); |
2187 | } | 2174 | isdn_tty_at_cout("DISPLAY: ", info); |
2175 | isdn_tty_at_cout(c->parm.display, info); | ||
2176 | isdn_tty_at_cout("\r\n", info); | ||
2177 | } | ||
2178 | return 1; | ||
2179 | case ISDN_STAT_DCONN: | ||
2180 | #ifdef ISDN_TTY_STAT_DEBUG | ||
2181 | printk(KERN_DEBUG "tty_STAT_DCONN ttyI%d\n", info->line); | ||
2182 | #endif | ||
2183 | if (TTY_IS_ACTIVE(info)) { | ||
2184 | if (info->dialing == 1) { | ||
2185 | info->dialing = 2; | ||
2186 | return 1; | ||
2188 | } | 2187 | } |
2189 | break; | 2188 | } |
2190 | case ISDN_STAT_DHUP: | 2189 | break; |
2190 | case ISDN_STAT_DHUP: | ||
2191 | #ifdef ISDN_TTY_STAT_DEBUG | 2191 | #ifdef ISDN_TTY_STAT_DEBUG |
2192 | printk(KERN_DEBUG "tty_STAT_DHUP ttyI%d\n", info->line); | 2192 | printk(KERN_DEBUG "tty_STAT_DHUP ttyI%d\n", info->line); |
2193 | #endif | 2193 | #endif |
2194 | if (TTY_IS_ACTIVE(info)) { | 2194 | if (TTY_IS_ACTIVE(info)) { |
2195 | if (info->dialing == 1) | 2195 | if (info->dialing == 1) |
2196 | isdn_tty_modem_result(RESULT_BUSY, info); | 2196 | isdn_tty_modem_result(RESULT_BUSY, info); |
2197 | if (info->dialing > 1) | 2197 | if (info->dialing > 1) |
2198 | isdn_tty_modem_result(RESULT_NO_CARRIER, info); | 2198 | isdn_tty_modem_result(RESULT_NO_CARRIER, info); |
2199 | info->dialing = 0; | 2199 | info->dialing = 0; |
2200 | #ifdef ISDN_DEBUG_MODEM_HUP | 2200 | #ifdef ISDN_DEBUG_MODEM_HUP |
2201 | printk(KERN_DEBUG "Mhup in ISDN_STAT_DHUP\n"); | 2201 | printk(KERN_DEBUG "Mhup in ISDN_STAT_DHUP\n"); |
2202 | #endif | 2202 | #endif |
2203 | isdn_tty_modem_hup(info, 0); | 2203 | isdn_tty_modem_hup(info, 0); |
2204 | return 1; | 2204 | return 1; |
2205 | } | 2205 | } |
2206 | break; | 2206 | break; |
2207 | case ISDN_STAT_BCONN: | 2207 | case ISDN_STAT_BCONN: |
2208 | #ifdef ISDN_TTY_STAT_DEBUG | 2208 | #ifdef ISDN_TTY_STAT_DEBUG |
2209 | printk(KERN_DEBUG "tty_STAT_BCONN ttyI%d\n", info->line); | 2209 | printk(KERN_DEBUG "tty_STAT_BCONN ttyI%d\n", info->line); |
2210 | #endif | 2210 | #endif |
2211 | /* Wake up any processes waiting | 2211 | /* Wake up any processes waiting |
2212 | * for incoming call of this device when | 2212 | * for incoming call of this device when |
2213 | * DCD follow the state of incoming carrier | 2213 | * DCD follow the state of incoming carrier |
2214 | */ | 2214 | */ |
2215 | if (info->blocked_open && | 2215 | if (info->blocked_open && |
2216 | (info->emu.mdmreg[REG_DCD] & BIT_DCD)) { | 2216 | (info->emu.mdmreg[REG_DCD] & BIT_DCD)) { |
2217 | wake_up_interruptible(&info->open_wait); | 2217 | wake_up_interruptible(&info->open_wait); |
2218 | } | 2218 | } |
2219 | 2219 | ||
2220 | /* Schedule CONNECT-Message to any tty | 2220 | /* Schedule CONNECT-Message to any tty |
2221 | * waiting for it and | 2221 | * waiting for it and |
2222 | * set DCD-bit of its modem-status. | 2222 | * set DCD-bit of its modem-status. |
2223 | */ | 2223 | */ |
2224 | if (TTY_IS_ACTIVE(info) || | 2224 | if (TTY_IS_ACTIVE(info) || |
2225 | (info->blocked_open && (info->emu.mdmreg[REG_DCD] & BIT_DCD))) { | 2225 | (info->blocked_open && (info->emu.mdmreg[REG_DCD] & BIT_DCD))) { |
2226 | info->msr |= UART_MSR_DCD; | 2226 | info->msr |= UART_MSR_DCD; |
2227 | info->emu.charge = 0; | 2227 | info->emu.charge = 0; |
2228 | if (info->dialing & 0xf) | 2228 | if (info->dialing & 0xf) |
2229 | info->last_dir = 1; | 2229 | info->last_dir = 1; |
2230 | else | 2230 | else |
2231 | info->last_dir = 0; | 2231 | info->last_dir = 0; |
2232 | info->dialing = 0; | 2232 | info->dialing = 0; |
2233 | info->rcvsched = 1; | 2233 | info->rcvsched = 1; |
2234 | if (USG_MODEM(dev->usage[i])) { | 2234 | if (USG_MODEM(dev->usage[i])) { |
2235 | if (info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_MODEM) { | 2235 | if (info->emu.mdmreg[REG_L2PROT] == ISDN_PROTO_L2_MODEM) { |
2236 | strcpy(info->emu.connmsg, c->parm.num); | 2236 | strcpy(info->emu.connmsg, c->parm.num); |
2237 | isdn_tty_modem_result(RESULT_CONNECT, info); | 2237 | isdn_tty_modem_result(RESULT_CONNECT, info); |
2238 | } else | 2238 | } else |
2239 | isdn_tty_modem_result(RESULT_CONNECT64000, info); | 2239 | isdn_tty_modem_result(RESULT_CONNECT64000, info); |
2240 | } | ||
2241 | if (USG_VOICE(dev->usage[i])) | ||
2242 | isdn_tty_modem_result(RESULT_VCON, info); | ||
2243 | return 1; | ||
2244 | } | 2240 | } |
2245 | break; | 2241 | if (USG_VOICE(dev->usage[i])) |
2246 | case ISDN_STAT_BHUP: | 2242 | isdn_tty_modem_result(RESULT_VCON, info); |
2243 | return 1; | ||
2244 | } | ||
2245 | break; | ||
2246 | case ISDN_STAT_BHUP: | ||
2247 | #ifdef ISDN_TTY_STAT_DEBUG | 2247 | #ifdef ISDN_TTY_STAT_DEBUG |
2248 | printk(KERN_DEBUG "tty_STAT_BHUP ttyI%d\n", info->line); | 2248 | printk(KERN_DEBUG "tty_STAT_BHUP ttyI%d\n", info->line); |
2249 | #endif | 2249 | #endif |
2250 | if (TTY_IS_ACTIVE(info)) { | 2250 | if (TTY_IS_ACTIVE(info)) { |
2251 | #ifdef ISDN_DEBUG_MODEM_HUP | 2251 | #ifdef ISDN_DEBUG_MODEM_HUP |
2252 | printk(KERN_DEBUG "Mhup in ISDN_STAT_BHUP\n"); | 2252 | printk(KERN_DEBUG "Mhup in ISDN_STAT_BHUP\n"); |
2253 | #endif | 2253 | #endif |
2254 | isdn_tty_modem_hup(info, 0); | 2254 | isdn_tty_modem_hup(info, 0); |
2255 | return 1; | 2255 | return 1; |
2256 | } | 2256 | } |
2257 | break; | 2257 | break; |
2258 | case ISDN_STAT_NODCH: | 2258 | case ISDN_STAT_NODCH: |
2259 | #ifdef ISDN_TTY_STAT_DEBUG | 2259 | #ifdef ISDN_TTY_STAT_DEBUG |
2260 | printk(KERN_DEBUG "tty_STAT_NODCH ttyI%d\n", info->line); | 2260 | printk(KERN_DEBUG "tty_STAT_NODCH ttyI%d\n", info->line); |
2261 | #endif | 2261 | #endif |
2262 | if (TTY_IS_ACTIVE(info)) { | 2262 | if (TTY_IS_ACTIVE(info)) { |
2263 | if (info->dialing) { | 2263 | if (info->dialing) { |
2264 | info->dialing = 0; | 2264 | info->dialing = 0; |
2265 | info->last_l2 = -1; | 2265 | info->last_l2 = -1; |
2266 | info->last_si = 0; | 2266 | info->last_si = 0; |
2267 | sprintf(info->last_cause, "0000"); | 2267 | sprintf(info->last_cause, "0000"); |
2268 | isdn_tty_modem_result(RESULT_NO_DIALTONE, info); | 2268 | isdn_tty_modem_result(RESULT_NO_DIALTONE, info); |
2269 | } | ||
2270 | isdn_tty_modem_hup(info, 0); | ||
2271 | return 1; | ||
2272 | } | 2269 | } |
2273 | break; | 2270 | isdn_tty_modem_hup(info, 0); |
2274 | case ISDN_STAT_UNLOAD: | 2271 | return 1; |
2272 | } | ||
2273 | break; | ||
2274 | case ISDN_STAT_UNLOAD: | ||
2275 | #ifdef ISDN_TTY_STAT_DEBUG | 2275 | #ifdef ISDN_TTY_STAT_DEBUG |
2276 | printk(KERN_DEBUG "tty_STAT_UNLOAD ttyI%d\n", info->line); | 2276 | printk(KERN_DEBUG "tty_STAT_UNLOAD ttyI%d\n", info->line); |
2277 | #endif | 2277 | #endif |
2278 | for (i = 0; i < ISDN_MAX_CHANNELS; i++) { | 2278 | for (i = 0; i < ISDN_MAX_CHANNELS; i++) { |
2279 | info = &dev->mdm.info[i]; | 2279 | info = &dev->mdm.info[i]; |
2280 | if (info->isdn_driver == c->driver) { | 2280 | if (info->isdn_driver == c->driver) { |
2281 | if (info->online) | 2281 | if (info->online) |
2282 | isdn_tty_modem_hup(info, 1); | 2282 | isdn_tty_modem_hup(info, 1); |
2283 | } | ||
2284 | } | 2283 | } |
2285 | return 1; | 2284 | } |
2285 | return 1; | ||
2286 | #ifdef CONFIG_ISDN_TTY_FAX | 2286 | #ifdef CONFIG_ISDN_TTY_FAX |
2287 | case ISDN_STAT_FAXIND: | 2287 | case ISDN_STAT_FAXIND: |
2288 | if (TTY_IS_ACTIVE(info)) { | 2288 | if (TTY_IS_ACTIVE(info)) { |
2289 | isdn_tty_fax_command(info, c); | 2289 | isdn_tty_fax_command(info, c); |
2290 | } | 2290 | } |
2291 | break; | 2291 | break; |
2292 | #endif | 2292 | #endif |
2293 | #ifdef CONFIG_ISDN_AUDIO | 2293 | #ifdef CONFIG_ISDN_AUDIO |
2294 | case ISDN_STAT_AUDIO: | 2294 | case ISDN_STAT_AUDIO: |
2295 | if (TTY_IS_ACTIVE(info)) { | 2295 | if (TTY_IS_ACTIVE(info)) { |
2296 | switch(c->parm.num[0]) { | 2296 | switch (c->parm.num[0]) { |
2297 | case ISDN_AUDIO_DTMF: | 2297 | case ISDN_AUDIO_DTMF: |
2298 | if (info->vonline) { | 2298 | if (info->vonline) { |
2299 | isdn_audio_put_dle_code(info, | 2299 | isdn_audio_put_dle_code(info, |
2300 | c->parm.num[1]); | 2300 | c->parm.num[1]); |
2301 | } | ||
2302 | break; | ||
2303 | } | 2301 | } |
2302 | break; | ||
2304 | } | 2303 | } |
2305 | break; | 2304 | } |
2305 | break; | ||
2306 | #endif | 2306 | #endif |
2307 | } | 2307 | } |
2308 | } | 2308 | } |
@@ -2311,16 +2311,16 @@ isdn_tty_stat_callback(int i, isdn_ctrl *c) | |||
2311 | 2311 | ||
2312 | /********************************************************************* | 2312 | /********************************************************************* |
2313 | Modem-Emulator-Routines | 2313 | Modem-Emulator-Routines |
2314 | *********************************************************************/ | 2314 | *********************************************************************/ |
2315 | 2315 | ||
2316 | #define cmdchar(c) ((c>=' ')&&(c<=0x7f)) | 2316 | #define cmdchar(c) ((c >= ' ') && (c <= 0x7f)) |
2317 | 2317 | ||
2318 | /* | 2318 | /* |
2319 | * Put a message from the AT-emulator into receive-buffer of tty, | 2319 | * Put a message from the AT-emulator into receive-buffer of tty, |
2320 | * convert CR, LF, and BS to values in modem-registers 3, 4 and 5. | 2320 | * convert CR, LF, and BS to values in modem-registers 3, 4 and 5. |
2321 | */ | 2321 | */ |
2322 | void | 2322 | void |
2323 | isdn_tty_at_cout(char *msg, modem_info * info) | 2323 | isdn_tty_at_cout(char *msg, modem_info *info) |
2324 | { | 2324 | { |
2325 | struct tty_struct *tty; | 2325 | struct tty_struct *tty; |
2326 | atemu *m = &info->emu; | 2326 | atemu *m = &info->emu; |
@@ -2348,7 +2348,7 @@ isdn_tty_at_cout(char *msg, modem_info * info) | |||
2348 | /* use queue instead of direct, if online and */ | 2348 | /* use queue instead of direct, if online and */ |
2349 | /* data is in queue or buffer is full */ | 2349 | /* data is in queue or buffer is full */ |
2350 | if (info->online && ((tty_buffer_request_room(tty, l) < l) || | 2350 | if (info->online && ((tty_buffer_request_room(tty, l) < l) || |
2351 | !skb_queue_empty(&dev->drv[info->isdn_driver]->rpqueue[info->isdn_channel]))) { | 2351 | !skb_queue_empty(&dev->drv[info->isdn_driver]->rpqueue[info->isdn_channel]))) { |
2352 | skb = alloc_skb(l, GFP_ATOMIC); | 2352 | skb = alloc_skb(l, GFP_ATOMIC); |
2353 | if (!skb) { | 2353 | if (!skb) { |
2354 | spin_unlock_irqrestore(&info->readlock, flags); | 2354 | spin_unlock_irqrestore(&info->readlock, flags); |
@@ -2363,22 +2363,22 @@ isdn_tty_at_cout(char *msg, modem_info * info) | |||
2363 | 2363 | ||
2364 | for (p = msg; *p; p++) { | 2364 | for (p = msg; *p; p++) { |
2365 | switch (*p) { | 2365 | switch (*p) { |
2366 | case '\r': | 2366 | case '\r': |
2367 | c = m->mdmreg[REG_CR]; | 2367 | c = m->mdmreg[REG_CR]; |
2368 | break; | 2368 | break; |
2369 | case '\n': | 2369 | case '\n': |
2370 | c = m->mdmreg[REG_LF]; | 2370 | c = m->mdmreg[REG_LF]; |
2371 | break; | 2371 | break; |
2372 | case '\b': | 2372 | case '\b': |
2373 | c = m->mdmreg[REG_BS]; | 2373 | c = m->mdmreg[REG_BS]; |
2374 | break; | 2374 | break; |
2375 | default: | 2375 | default: |
2376 | c = *p; | 2376 | c = *p; |
2377 | } | 2377 | } |
2378 | if (skb) { | 2378 | if (skb) { |
2379 | *sp++ = c; | 2379 | *sp++ = c; |
2380 | } else { | 2380 | } else { |
2381 | if(tty_insert_flip_char(tty, c, TTY_NORMAL) == 0) | 2381 | if (tty_insert_flip_char(tty, c, TTY_NORMAL) == 0) |
2382 | break; | 2382 | break; |
2383 | } | 2383 | } |
2384 | } | 2384 | } |
@@ -2400,7 +2400,7 @@ isdn_tty_at_cout(char *msg, modem_info * info) | |||
2400 | * Perform ATH Hangup | 2400 | * Perform ATH Hangup |
2401 | */ | 2401 | */ |
2402 | static void | 2402 | static void |
2403 | isdn_tty_on_hook(modem_info * info) | 2403 | isdn_tty_on_hook(modem_info *info) |
2404 | { | 2404 | { |
2405 | if (info->isdn_channel >= 0) { | 2405 | if (info->isdn_channel >= 0) { |
2406 | #ifdef ISDN_DEBUG_MODEM_HUP | 2406 | #ifdef ISDN_DEBUG_MODEM_HUP |
@@ -2416,8 +2416,8 @@ isdn_tty_off_hook(void) | |||
2416 | printk(KERN_DEBUG "isdn_tty_off_hook\n"); | 2416 | printk(KERN_DEBUG "isdn_tty_off_hook\n"); |
2417 | } | 2417 | } |
2418 | 2418 | ||
2419 | #define PLUSWAIT1 (HZ/2) /* 0.5 sec. */ | 2419 | #define PLUSWAIT1 (HZ / 2) /* 0.5 sec. */ |
2420 | #define PLUSWAIT2 (HZ*3/2) /* 1.5 sec */ | 2420 | #define PLUSWAIT2 (HZ * 3 / 2) /* 1.5 sec */ |
2421 | 2421 | ||
2422 | /* | 2422 | /* |
2423 | * Check Buffer for Modem-escape-sequence, activate timer-callback to | 2423 | * Check Buffer for Modem-escape-sequence, activate timer-callback to |
@@ -2431,7 +2431,7 @@ isdn_tty_off_hook(void) | |||
2431 | * lastplus timestamp of last character | 2431 | * lastplus timestamp of last character |
2432 | */ | 2432 | */ |
2433 | static void | 2433 | static void |
2434 | isdn_tty_check_esc(const u_char * p, u_char plus, int count, int *pluscount, | 2434 | isdn_tty_check_esc(const u_char *p, u_char plus, int count, int *pluscount, |
2435 | u_long *lastplus) | 2435 | u_long *lastplus) |
2436 | { | 2436 | { |
2437 | if (plus > 127) | 2437 | if (plus > 127) |
@@ -2471,69 +2471,69 @@ isdn_tty_check_esc(const u_char * p, u_char plus, int count, int *pluscount, | |||
2471 | */ | 2471 | */ |
2472 | 2472 | ||
2473 | static void | 2473 | static void |
2474 | isdn_tty_modem_result(int code, modem_info * info) | 2474 | isdn_tty_modem_result(int code, modem_info *info) |
2475 | { | 2475 | { |
2476 | atemu *m = &info->emu; | 2476 | atemu *m = &info->emu; |
2477 | static char *msg[] = | 2477 | static char *msg[] = |
2478 | {"OK", "CONNECT", "RING", "NO CARRIER", "ERROR", | 2478 | {"OK", "CONNECT", "RING", "NO CARRIER", "ERROR", |
2479 | "CONNECT 64000", "NO DIALTONE", "BUSY", "NO ANSWER", | 2479 | "CONNECT 64000", "NO DIALTONE", "BUSY", "NO ANSWER", |
2480 | "RINGING", "NO MSN/EAZ", "VCON", "RUNG"}; | 2480 | "RINGING", "NO MSN/EAZ", "VCON", "RUNG"}; |
2481 | char s[ISDN_MSNLEN+10]; | 2481 | char s[ISDN_MSNLEN + 10]; |
2482 | 2482 | ||
2483 | switch (code) { | 2483 | switch (code) { |
2484 | case RESULT_RING: | 2484 | case RESULT_RING: |
2485 | m->mdmreg[REG_RINGCNT]++; | 2485 | m->mdmreg[REG_RINGCNT]++; |
2486 | if (m->mdmreg[REG_RINGCNT] == m->mdmreg[REG_RINGATA]) | 2486 | if (m->mdmreg[REG_RINGCNT] == m->mdmreg[REG_RINGATA]) |
2487 | /* Automatically accept incoming call */ | 2487 | /* Automatically accept incoming call */ |
2488 | isdn_tty_cmd_ATA(info); | 2488 | isdn_tty_cmd_ATA(info); |
2489 | break; | 2489 | break; |
2490 | case RESULT_NO_CARRIER: | 2490 | case RESULT_NO_CARRIER: |
2491 | #ifdef ISDN_DEBUG_MODEM_HUP | 2491 | #ifdef ISDN_DEBUG_MODEM_HUP |
2492 | printk(KERN_DEBUG "modem_result: NO CARRIER %d %d\n", | 2492 | printk(KERN_DEBUG "modem_result: NO CARRIER %d %d\n", |
2493 | (info->flags & ISDN_ASYNC_CLOSING), | 2493 | (info->flags & ISDN_ASYNC_CLOSING), |
2494 | (!info->tty)); | 2494 | (!info->tty)); |
2495 | #endif | 2495 | #endif |
2496 | m->mdmreg[REG_RINGCNT] = 0; | 2496 | m->mdmreg[REG_RINGCNT] = 0; |
2497 | del_timer(&info->nc_timer); | 2497 | del_timer(&info->nc_timer); |
2498 | info->ncarrier = 0; | 2498 | info->ncarrier = 0; |
2499 | if ((info->flags & ISDN_ASYNC_CLOSING) || (!info->tty)) { | 2499 | if ((info->flags & ISDN_ASYNC_CLOSING) || (!info->tty)) { |
2500 | return; | 2500 | return; |
2501 | } | 2501 | } |
2502 | #ifdef CONFIG_ISDN_AUDIO | 2502 | #ifdef CONFIG_ISDN_AUDIO |
2503 | if (info->vonline & 1) { | 2503 | if (info->vonline & 1) { |
2504 | #ifdef ISDN_DEBUG_MODEM_VOICE | 2504 | #ifdef ISDN_DEBUG_MODEM_VOICE |
2505 | printk(KERN_DEBUG "res3: send DLE-ETX on ttyI%d\n", | 2505 | printk(KERN_DEBUG "res3: send DLE-ETX on ttyI%d\n", |
2506 | info->line); | 2506 | info->line); |
2507 | #endif | 2507 | #endif |
2508 | /* voice-recording, add DLE-ETX */ | 2508 | /* voice-recording, add DLE-ETX */ |
2509 | isdn_tty_at_cout("\020\003", info); | 2509 | isdn_tty_at_cout("\020\003", info); |
2510 | } | 2510 | } |
2511 | if (info->vonline & 2) { | 2511 | if (info->vonline & 2) { |
2512 | #ifdef ISDN_DEBUG_MODEM_VOICE | 2512 | #ifdef ISDN_DEBUG_MODEM_VOICE |
2513 | printk(KERN_DEBUG "res3: send DLE-DC4 on ttyI%d\n", | 2513 | printk(KERN_DEBUG "res3: send DLE-DC4 on ttyI%d\n", |
2514 | info->line); | 2514 | info->line); |
2515 | #endif | 2515 | #endif |
2516 | /* voice-playing, add DLE-DC4 */ | 2516 | /* voice-playing, add DLE-DC4 */ |
2517 | isdn_tty_at_cout("\020\024", info); | 2517 | isdn_tty_at_cout("\020\024", info); |
2518 | } | 2518 | } |
2519 | #endif | 2519 | #endif |
2520 | break; | 2520 | break; |
2521 | case RESULT_CONNECT: | 2521 | case RESULT_CONNECT: |
2522 | case RESULT_CONNECT64000: | 2522 | case RESULT_CONNECT64000: |
2523 | sprintf(info->last_cause, "0000"); | 2523 | sprintf(info->last_cause, "0000"); |
2524 | if (!info->online) | 2524 | if (!info->online) |
2525 | info->online = 2; | 2525 | info->online = 2; |
2526 | break; | 2526 | break; |
2527 | case RESULT_VCON: | 2527 | case RESULT_VCON: |
2528 | #ifdef ISDN_DEBUG_MODEM_VOICE | 2528 | #ifdef ISDN_DEBUG_MODEM_VOICE |
2529 | printk(KERN_DEBUG "res3: send VCON on ttyI%d\n", | 2529 | printk(KERN_DEBUG "res3: send VCON on ttyI%d\n", |
2530 | info->line); | 2530 | info->line); |
2531 | #endif | 2531 | #endif |
2532 | sprintf(info->last_cause, "0000"); | 2532 | sprintf(info->last_cause, "0000"); |
2533 | if (!info->online) | 2533 | if (!info->online) |
2534 | info->online = 1; | 2534 | info->online = 1; |
2535 | break; | 2535 | break; |
2536 | } /* switch(code) */ | 2536 | } /* switch (code) */ |
2537 | 2537 | ||
2538 | if (m->mdmreg[REG_RESP] & BIT_RESP) { | 2538 | if (m->mdmreg[REG_RESP] & BIT_RESP) { |
2539 | /* Show results */ | 2539 | /* Show results */ |
@@ -2543,87 +2543,87 @@ isdn_tty_modem_result(int code, modem_info * info) | |||
2543 | isdn_tty_at_cout(s, info); | 2543 | isdn_tty_at_cout(s, info); |
2544 | } else { | 2544 | } else { |
2545 | if (code == RESULT_RING) { | 2545 | if (code == RESULT_RING) { |
2546 | /* return if "show RUNG" and ringcounter>1 */ | 2546 | /* return if "show RUNG" and ringcounter>1 */ |
2547 | if ((m->mdmreg[REG_RUNG] & BIT_RUNG) && | 2547 | if ((m->mdmreg[REG_RUNG] & BIT_RUNG) && |
2548 | (m->mdmreg[REG_RINGCNT] > 1)) | 2548 | (m->mdmreg[REG_RINGCNT] > 1)) |
2549 | return; | 2549 | return; |
2550 | /* print CID, _before_ _every_ ring */ | 2550 | /* print CID, _before_ _every_ ring */ |
2551 | if (!(m->mdmreg[REG_CIDONCE] & BIT_CIDONCE)) { | 2551 | if (!(m->mdmreg[REG_CIDONCE] & BIT_CIDONCE)) { |
2552 | isdn_tty_at_cout("\r\nCALLER NUMBER: ", info); | 2552 | isdn_tty_at_cout("\r\nCALLER NUMBER: ", info); |
2553 | isdn_tty_at_cout(dev->num[info->drv_index], info); | 2553 | isdn_tty_at_cout(dev->num[info->drv_index], info); |
2554 | if (m->mdmreg[REG_CDN] & BIT_CDN) { | 2554 | if (m->mdmreg[REG_CDN] & BIT_CDN) { |
2555 | isdn_tty_at_cout("\r\nCALLED NUMBER: ", info); | 2555 | isdn_tty_at_cout("\r\nCALLED NUMBER: ", info); |
2556 | isdn_tty_at_cout(info->emu.cpn, info); | 2556 | isdn_tty_at_cout(info->emu.cpn, info); |
2557 | } | 2557 | } |
2558 | } | 2558 | } |
2559 | } | 2559 | } |
2560 | isdn_tty_at_cout("\r\n", info); | 2560 | isdn_tty_at_cout("\r\n", info); |
2561 | isdn_tty_at_cout(msg[code], info); | 2561 | isdn_tty_at_cout(msg[code], info); |
2562 | switch (code) { | 2562 | switch (code) { |
2563 | case RESULT_CONNECT: | 2563 | case RESULT_CONNECT: |
2564 | switch (m->mdmreg[REG_L2PROT]) { | 2564 | switch (m->mdmreg[REG_L2PROT]) { |
2565 | case ISDN_PROTO_L2_MODEM: | 2565 | case ISDN_PROTO_L2_MODEM: |
2566 | isdn_tty_at_cout(" ", info); | 2566 | isdn_tty_at_cout(" ", info); |
2567 | isdn_tty_at_cout(m->connmsg, info); | 2567 | isdn_tty_at_cout(m->connmsg, info); |
2568 | break; | ||
2569 | } | ||
2570 | break; | 2568 | break; |
2571 | case RESULT_RING: | 2569 | } |
2572 | /* Append CPN, if enabled */ | 2570 | break; |
2573 | if ((m->mdmreg[REG_CPN] & BIT_CPN)) { | 2571 | case RESULT_RING: |
2574 | sprintf(s, "/%s", m->cpn); | 2572 | /* Append CPN, if enabled */ |
2575 | isdn_tty_at_cout(s, info); | 2573 | if ((m->mdmreg[REG_CPN] & BIT_CPN)) { |
2576 | } | 2574 | sprintf(s, "/%s", m->cpn); |
2577 | /* Print CID only once, _after_ 1st RING */ | 2575 | isdn_tty_at_cout(s, info); |
2578 | if ((m->mdmreg[REG_CIDONCE] & BIT_CIDONCE) && | 2576 | } |
2579 | (m->mdmreg[REG_RINGCNT] == 1)) { | 2577 | /* Print CID only once, _after_ 1st RING */ |
2580 | isdn_tty_at_cout("\r\n", info); | 2578 | if ((m->mdmreg[REG_CIDONCE] & BIT_CIDONCE) && |
2581 | isdn_tty_at_cout("CALLER NUMBER: ", info); | 2579 | (m->mdmreg[REG_RINGCNT] == 1)) { |
2582 | isdn_tty_at_cout(dev->num[info->drv_index], info); | 2580 | isdn_tty_at_cout("\r\n", info); |
2583 | if (m->mdmreg[REG_CDN] & BIT_CDN) { | 2581 | isdn_tty_at_cout("CALLER NUMBER: ", info); |
2584 | isdn_tty_at_cout("\r\nCALLED NUMBER: ", info); | 2582 | isdn_tty_at_cout(dev->num[info->drv_index], info); |
2585 | isdn_tty_at_cout(info->emu.cpn, info); | 2583 | if (m->mdmreg[REG_CDN] & BIT_CDN) { |
2586 | } | 2584 | isdn_tty_at_cout("\r\nCALLED NUMBER: ", info); |
2585 | isdn_tty_at_cout(info->emu.cpn, info); | ||
2587 | } | 2586 | } |
2587 | } | ||
2588 | break; | ||
2589 | case RESULT_NO_CARRIER: | ||
2590 | case RESULT_NO_DIALTONE: | ||
2591 | case RESULT_BUSY: | ||
2592 | case RESULT_NO_ANSWER: | ||
2593 | m->mdmreg[REG_RINGCNT] = 0; | ||
2594 | /* Append Cause-Message if enabled */ | ||
2595 | if (m->mdmreg[REG_RESPXT] & BIT_RESPXT) { | ||
2596 | sprintf(s, "/%s", info->last_cause); | ||
2597 | isdn_tty_at_cout(s, info); | ||
2598 | } | ||
2599 | break; | ||
2600 | case RESULT_CONNECT64000: | ||
2601 | /* Append Protocol to CONNECT message */ | ||
2602 | switch (m->mdmreg[REG_L2PROT]) { | ||
2603 | case ISDN_PROTO_L2_X75I: | ||
2604 | case ISDN_PROTO_L2_X75UI: | ||
2605 | case ISDN_PROTO_L2_X75BUI: | ||
2606 | isdn_tty_at_cout("/X.75", info); | ||
2588 | break; | 2607 | break; |
2589 | case RESULT_NO_CARRIER: | 2608 | case ISDN_PROTO_L2_HDLC: |
2590 | case RESULT_NO_DIALTONE: | 2609 | isdn_tty_at_cout("/HDLC", info); |
2591 | case RESULT_BUSY: | ||
2592 | case RESULT_NO_ANSWER: | ||
2593 | m->mdmreg[REG_RINGCNT] = 0; | ||
2594 | /* Append Cause-Message if enabled */ | ||
2595 | if (m->mdmreg[REG_RESPXT] & BIT_RESPXT) { | ||
2596 | sprintf(s, "/%s", info->last_cause); | ||
2597 | isdn_tty_at_cout(s, info); | ||
2598 | } | ||
2599 | break; | 2610 | break; |
2600 | case RESULT_CONNECT64000: | 2611 | case ISDN_PROTO_L2_V11096: |
2601 | /* Append Protocol to CONNECT message */ | 2612 | isdn_tty_at_cout("/V110/9600", info); |
2602 | switch (m->mdmreg[REG_L2PROT]) { | 2613 | break; |
2603 | case ISDN_PROTO_L2_X75I: | 2614 | case ISDN_PROTO_L2_V11019: |
2604 | case ISDN_PROTO_L2_X75UI: | 2615 | isdn_tty_at_cout("/V110/19200", info); |
2605 | case ISDN_PROTO_L2_X75BUI: | 2616 | break; |
2606 | isdn_tty_at_cout("/X.75", info); | 2617 | case ISDN_PROTO_L2_V11038: |
2607 | break; | 2618 | isdn_tty_at_cout("/V110/38400", info); |
2608 | case ISDN_PROTO_L2_HDLC: | ||
2609 | isdn_tty_at_cout("/HDLC", info); | ||
2610 | break; | ||
2611 | case ISDN_PROTO_L2_V11096: | ||
2612 | isdn_tty_at_cout("/V110/9600", info); | ||
2613 | break; | ||
2614 | case ISDN_PROTO_L2_V11019: | ||
2615 | isdn_tty_at_cout("/V110/19200", info); | ||
2616 | break; | ||
2617 | case ISDN_PROTO_L2_V11038: | ||
2618 | isdn_tty_at_cout("/V110/38400", info); | ||
2619 | break; | ||
2620 | } | ||
2621 | if (m->mdmreg[REG_T70] & BIT_T70) { | ||
2622 | isdn_tty_at_cout("/T.70", info); | ||
2623 | if (m->mdmreg[REG_T70] & BIT_T70_EXT) | ||
2624 | isdn_tty_at_cout("+", info); | ||
2625 | } | ||
2626 | break; | 2619 | break; |
2620 | } | ||
2621 | if (m->mdmreg[REG_T70] & BIT_T70) { | ||
2622 | isdn_tty_at_cout("/T.70", info); | ||
2623 | if (m->mdmreg[REG_T70] & BIT_T70_EXT) | ||
2624 | isdn_tty_at_cout("+", info); | ||
2625 | } | ||
2626 | break; | ||
2627 | } | 2627 | } |
2628 | isdn_tty_at_cout("\r\n", info); | 2628 | isdn_tty_at_cout("\r\n", info); |
2629 | } | 2629 | } |
@@ -2645,7 +2645,7 @@ isdn_tty_modem_result(int code, modem_info * info) | |||
2645 | * Display a modem-register-value. | 2645 | * Display a modem-register-value. |
2646 | */ | 2646 | */ |
2647 | static void | 2647 | static void |
2648 | isdn_tty_show_profile(int ridx, modem_info * info) | 2648 | isdn_tty_show_profile(int ridx, modem_info *info) |
2649 | { | 2649 | { |
2650 | char v[6]; | 2650 | char v[6]; |
2651 | 2651 | ||
@@ -2664,7 +2664,7 @@ isdn_tty_get_msnstr(char *n, char **p) | |||
2664 | while (((*p[0] >= '0' && *p[0] <= '9') || | 2664 | while (((*p[0] >= '0' && *p[0] <= '9') || |
2665 | /* Why a comma ??? */ | 2665 | /* Why a comma ??? */ |
2666 | (*p[0] == ',') || (*p[0] == ':')) && | 2666 | (*p[0] == ',') || (*p[0] == ':')) && |
2667 | (limit--)) | 2667 | (limit--)) |
2668 | *n++ = *p[0]++; | 2668 | *n++ = *p[0]++; |
2669 | *n = '\0'; | 2669 | *n = '\0'; |
2670 | } | 2670 | } |
@@ -2673,20 +2673,20 @@ isdn_tty_get_msnstr(char *n, char **p) | |||
2673 | * Get phone-number from modem-commandbuffer | 2673 | * Get phone-number from modem-commandbuffer |
2674 | */ | 2674 | */ |
2675 | static void | 2675 | static void |
2676 | isdn_tty_getdial(char *p, char *q,int cnt) | 2676 | isdn_tty_getdial(char *p, char *q, int cnt) |
2677 | { | 2677 | { |
2678 | int first = 1; | 2678 | int first = 1; |
2679 | int limit = ISDN_MSNLEN - 1; /* MUST match the size of interface var to avoid | 2679 | int limit = ISDN_MSNLEN - 1; /* MUST match the size of interface var to avoid |
2680 | buffer overflow */ | 2680 | buffer overflow */ |
2681 | 2681 | ||
2682 | while (strchr(" 0123456789,#.*WPTSR-", *p) && *p && --cnt>0) { | 2682 | while (strchr(" 0123456789,#.*WPTSR-", *p) && *p && --cnt > 0) { |
2683 | if ((*p >= '0' && *p <= '9') || ((*p == 'S') && first) || | 2683 | if ((*p >= '0' && *p <= '9') || ((*p == 'S') && first) || |
2684 | ((*p == 'R') && first) || | 2684 | ((*p == 'R') && first) || |
2685 | (*p == '*') || (*p == '#')) { | 2685 | (*p == '*') || (*p == '#')) { |
2686 | *q++ = *p; | 2686 | *q++ = *p; |
2687 | limit--; | 2687 | limit--; |
2688 | } | 2688 | } |
2689 | if(!limit) | 2689 | if (!limit) |
2690 | break; | 2690 | break; |
2691 | p++; | 2691 | p++; |
2692 | first = 0; | 2692 | first = 0; |
@@ -2698,7 +2698,7 @@ isdn_tty_getdial(char *p, char *q,int cnt) | |||
2698 | #define PARSE_ERROR1 { isdn_tty_modem_result(RESULT_ERROR, info); return 1; } | 2698 | #define PARSE_ERROR1 { isdn_tty_modem_result(RESULT_ERROR, info); return 1; } |
2699 | 2699 | ||
2700 | static void | 2700 | static void |
2701 | isdn_tty_report(modem_info * info) | 2701 | isdn_tty_report(modem_info *info) |
2702 | { | 2702 | { |
2703 | atemu *m = &info->emu; | 2703 | atemu *m = &info->emu; |
2704 | char s[80]; | 2704 | char s[80]; |
@@ -2710,39 +2710,39 @@ isdn_tty_report(modem_info * info) | |||
2710 | isdn_tty_at_cout(s, info); | 2710 | isdn_tty_at_cout(s, info); |
2711 | isdn_tty_at_cout(" Layer-2 Protocol: ", info); | 2711 | isdn_tty_at_cout(" Layer-2 Protocol: ", info); |
2712 | switch (info->last_l2) { | 2712 | switch (info->last_l2) { |
2713 | case ISDN_PROTO_L2_X75I: | 2713 | case ISDN_PROTO_L2_X75I: |
2714 | isdn_tty_at_cout("X.75i", info); | 2714 | isdn_tty_at_cout("X.75i", info); |
2715 | break; | 2715 | break; |
2716 | case ISDN_PROTO_L2_X75UI: | 2716 | case ISDN_PROTO_L2_X75UI: |
2717 | isdn_tty_at_cout("X.75ui", info); | 2717 | isdn_tty_at_cout("X.75ui", info); |
2718 | break; | 2718 | break; |
2719 | case ISDN_PROTO_L2_X75BUI: | 2719 | case ISDN_PROTO_L2_X75BUI: |
2720 | isdn_tty_at_cout("X.75bui", info); | 2720 | isdn_tty_at_cout("X.75bui", info); |
2721 | break; | 2721 | break; |
2722 | case ISDN_PROTO_L2_HDLC: | 2722 | case ISDN_PROTO_L2_HDLC: |
2723 | isdn_tty_at_cout("HDLC", info); | 2723 | isdn_tty_at_cout("HDLC", info); |
2724 | break; | 2724 | break; |
2725 | case ISDN_PROTO_L2_V11096: | 2725 | case ISDN_PROTO_L2_V11096: |
2726 | isdn_tty_at_cout("V.110 9600 Baud", info); | 2726 | isdn_tty_at_cout("V.110 9600 Baud", info); |
2727 | break; | 2727 | break; |
2728 | case ISDN_PROTO_L2_V11019: | 2728 | case ISDN_PROTO_L2_V11019: |
2729 | isdn_tty_at_cout("V.110 19200 Baud", info); | 2729 | isdn_tty_at_cout("V.110 19200 Baud", info); |
2730 | break; | 2730 | break; |
2731 | case ISDN_PROTO_L2_V11038: | 2731 | case ISDN_PROTO_L2_V11038: |
2732 | isdn_tty_at_cout("V.110 38400 Baud", info); | 2732 | isdn_tty_at_cout("V.110 38400 Baud", info); |
2733 | break; | 2733 | break; |
2734 | case ISDN_PROTO_L2_TRANS: | 2734 | case ISDN_PROTO_L2_TRANS: |
2735 | isdn_tty_at_cout("transparent", info); | 2735 | isdn_tty_at_cout("transparent", info); |
2736 | break; | 2736 | break; |
2737 | case ISDN_PROTO_L2_MODEM: | 2737 | case ISDN_PROTO_L2_MODEM: |
2738 | isdn_tty_at_cout("modem", info); | 2738 | isdn_tty_at_cout("modem", info); |
2739 | break; | 2739 | break; |
2740 | case ISDN_PROTO_L2_FAX: | 2740 | case ISDN_PROTO_L2_FAX: |
2741 | isdn_tty_at_cout("fax", info); | 2741 | isdn_tty_at_cout("fax", info); |
2742 | break; | 2742 | break; |
2743 | default: | 2743 | default: |
2744 | isdn_tty_at_cout("unknown", info); | 2744 | isdn_tty_at_cout("unknown", info); |
2745 | break; | 2745 | break; |
2746 | } | 2746 | } |
2747 | if (m->mdmreg[REG_T70] & BIT_T70) { | 2747 | if (m->mdmreg[REG_T70] & BIT_T70) { |
2748 | isdn_tty_at_cout("/T.70", info); | 2748 | isdn_tty_at_cout("/T.70", info); |
@@ -2752,19 +2752,19 @@ isdn_tty_report(modem_info * info) | |||
2752 | isdn_tty_at_cout("\r\n", info); | 2752 | isdn_tty_at_cout("\r\n", info); |
2753 | isdn_tty_at_cout(" Service: ", info); | 2753 | isdn_tty_at_cout(" Service: ", info); |
2754 | switch (info->last_si) { | 2754 | switch (info->last_si) { |
2755 | case 1: | 2755 | case 1: |
2756 | isdn_tty_at_cout("audio\r\n", info); | 2756 | isdn_tty_at_cout("audio\r\n", info); |
2757 | break; | 2757 | break; |
2758 | case 5: | 2758 | case 5: |
2759 | isdn_tty_at_cout("btx\r\n", info); | 2759 | isdn_tty_at_cout("btx\r\n", info); |
2760 | break; | 2760 | break; |
2761 | case 7: | 2761 | case 7: |
2762 | isdn_tty_at_cout("data\r\n", info); | 2762 | isdn_tty_at_cout("data\r\n", info); |
2763 | break; | 2763 | break; |
2764 | default: | 2764 | default: |
2765 | sprintf(s, "%d\r\n", info->last_si); | 2765 | sprintf(s, "%d\r\n", info->last_si); |
2766 | isdn_tty_at_cout(s, info); | 2766 | isdn_tty_at_cout(s, info); |
2767 | break; | 2767 | break; |
2768 | } | 2768 | } |
2769 | sprintf(s, " Hangup location: %s\r\n", info->last_lhup ? "local" : "remote"); | 2769 | sprintf(s, " Hangup location: %s\r\n", info->last_lhup ? "local" : "remote"); |
2770 | isdn_tty_at_cout(s, info); | 2770 | isdn_tty_at_cout(s, info); |
@@ -2776,7 +2776,7 @@ isdn_tty_report(modem_info * info) | |||
2776 | * Parse AT&.. commands. | 2776 | * Parse AT&.. commands. |
2777 | */ | 2777 | */ |
2778 | static int | 2778 | static int |
2779 | isdn_tty_cmd_ATand(char **p, modem_info * info) | 2779 | isdn_tty_cmd_ATand(char **p, modem_info *info) |
2780 | { | 2780 | { |
2781 | atemu *m = &info->emu; | 2781 | atemu *m = &info->emu; |
2782 | int i; | 2782 | int i; |
@@ -2785,224 +2785,224 @@ isdn_tty_cmd_ATand(char **p, modem_info * info) | |||
2785 | #define MAXRB (sizeof(rb) - 1) | 2785 | #define MAXRB (sizeof(rb) - 1) |
2786 | 2786 | ||
2787 | switch (*p[0]) { | 2787 | switch (*p[0]) { |
2788 | case 'B': | 2788 | case 'B': |
2789 | /* &B - Set Buffersize */ | 2789 | /* &B - Set Buffersize */ |
2790 | p[0]++; | 2790 | p[0]++; |
2791 | i = isdn_getnum(p); | 2791 | i = isdn_getnum(p); |
2792 | if ((i < 0) || (i > ISDN_SERIAL_XMIT_MAX)) | 2792 | if ((i < 0) || (i > ISDN_SERIAL_XMIT_MAX)) |
2793 | PARSE_ERROR1; | 2793 | PARSE_ERROR1; |
2794 | #ifdef CONFIG_ISDN_AUDIO | 2794 | #ifdef CONFIG_ISDN_AUDIO |
2795 | if ((m->mdmreg[REG_SI1] & 1) && (i > VBUF)) | 2795 | if ((m->mdmreg[REG_SI1] & 1) && (i > VBUF)) |
2796 | PARSE_ERROR1; | 2796 | PARSE_ERROR1; |
2797 | #endif | 2797 | #endif |
2798 | m->mdmreg[REG_PSIZE] = i / 16; | 2798 | m->mdmreg[REG_PSIZE] = i / 16; |
2799 | info->xmit_size = m->mdmreg[REG_PSIZE] * 16; | 2799 | info->xmit_size = m->mdmreg[REG_PSIZE] * 16; |
2800 | switch (m->mdmreg[REG_L2PROT]) { | 2800 | switch (m->mdmreg[REG_L2PROT]) { |
2801 | case ISDN_PROTO_L2_V11096: | 2801 | case ISDN_PROTO_L2_V11096: |
2802 | case ISDN_PROTO_L2_V11019: | 2802 | case ISDN_PROTO_L2_V11019: |
2803 | case ISDN_PROTO_L2_V11038: | 2803 | case ISDN_PROTO_L2_V11038: |
2804 | info->xmit_size /= 10; | 2804 | info->xmit_size /= 10; |
2805 | } | 2805 | } |
2806 | break; | ||
2807 | case 'C': | ||
2808 | /* &C - DCD Status */ | ||
2809 | p[0]++; | ||
2810 | switch (isdn_getnum(p)) { | ||
2811 | case 0: | ||
2812 | m->mdmreg[REG_DCD] &= ~BIT_DCD; | ||
2806 | break; | 2813 | break; |
2807 | case 'C': | 2814 | case 1: |
2808 | /* &C - DCD Status */ | 2815 | m->mdmreg[REG_DCD] |= BIT_DCD; |
2809 | p[0]++; | ||
2810 | switch (isdn_getnum(p)) { | ||
2811 | case 0: | ||
2812 | m->mdmreg[REG_DCD] &= ~BIT_DCD; | ||
2813 | break; | ||
2814 | case 1: | ||
2815 | m->mdmreg[REG_DCD] |= BIT_DCD; | ||
2816 | break; | ||
2817 | default: | ||
2818 | PARSE_ERROR1 | ||
2819 | } | ||
2820 | break; | 2816 | break; |
2821 | case 'D': | 2817 | default: |
2822 | /* &D - Set DTR-Low-behavior */ | 2818 | PARSE_ERROR1 |
2823 | p[0]++; | 2819 | } |
2824 | switch (isdn_getnum(p)) { | 2820 | break; |
2825 | case 0: | 2821 | case 'D': |
2826 | m->mdmreg[REG_DTRHUP] &= ~BIT_DTRHUP; | 2822 | /* &D - Set DTR-Low-behavior */ |
2827 | m->mdmreg[REG_DTRR] &= ~BIT_DTRR; | 2823 | p[0]++; |
2828 | break; | 2824 | switch (isdn_getnum(p)) { |
2829 | case 2: | 2825 | case 0: |
2830 | m->mdmreg[REG_DTRHUP] |= BIT_DTRHUP; | 2826 | m->mdmreg[REG_DTRHUP] &= ~BIT_DTRHUP; |
2831 | m->mdmreg[REG_DTRR] &= ~BIT_DTRR; | 2827 | m->mdmreg[REG_DTRR] &= ~BIT_DTRR; |
2832 | break; | ||
2833 | case 3: | ||
2834 | m->mdmreg[REG_DTRHUP] |= BIT_DTRHUP; | ||
2835 | m->mdmreg[REG_DTRR] |= BIT_DTRR; | ||
2836 | break; | ||
2837 | default: | ||
2838 | PARSE_ERROR1 | ||
2839 | } | ||
2840 | break; | 2828 | break; |
2841 | case 'E': | 2829 | case 2: |
2842 | /* &E -Set EAZ/MSN */ | 2830 | m->mdmreg[REG_DTRHUP] |= BIT_DTRHUP; |
2843 | p[0]++; | 2831 | m->mdmreg[REG_DTRR] &= ~BIT_DTRR; |
2844 | isdn_tty_get_msnstr(m->msn, p); | ||
2845 | break; | 2832 | break; |
2846 | case 'F': | 2833 | case 3: |
2847 | /* &F -Set Factory-Defaults */ | 2834 | m->mdmreg[REG_DTRHUP] |= BIT_DTRHUP; |
2848 | p[0]++; | 2835 | m->mdmreg[REG_DTRR] |= BIT_DTRR; |
2849 | if (info->msr & UART_MSR_DCD) | ||
2850 | PARSE_ERROR1; | ||
2851 | isdn_tty_reset_profile(m); | ||
2852 | isdn_tty_modem_reset_regs(info, 1); | ||
2853 | break; | 2836 | break; |
2837 | default: | ||
2838 | PARSE_ERROR1 | ||
2839 | } | ||
2840 | break; | ||
2841 | case 'E': | ||
2842 | /* &E -Set EAZ/MSN */ | ||
2843 | p[0]++; | ||
2844 | isdn_tty_get_msnstr(m->msn, p); | ||
2845 | break; | ||
2846 | case 'F': | ||
2847 | /* &F -Set Factory-Defaults */ | ||
2848 | p[0]++; | ||
2849 | if (info->msr & UART_MSR_DCD) | ||
2850 | PARSE_ERROR1; | ||
2851 | isdn_tty_reset_profile(m); | ||
2852 | isdn_tty_modem_reset_regs(info, 1); | ||
2853 | break; | ||
2854 | #ifdef DUMMY_HAYES_AT | 2854 | #ifdef DUMMY_HAYES_AT |
2855 | case 'K': | 2855 | case 'K': |
2856 | /* only for be compilant with common scripts */ | 2856 | /* only for be compilant with common scripts */ |
2857 | /* &K Flowcontrol - no function */ | 2857 | /* &K Flowcontrol - no function */ |
2858 | p[0]++; | 2858 | p[0]++; |
2859 | isdn_getnum(p); | 2859 | isdn_getnum(p); |
2860 | break; | ||
2861 | #endif | ||
2862 | case 'L': | ||
2863 | /* &L -Set Numbers to listen on */ | ||
2864 | p[0]++; | ||
2865 | i = 0; | ||
2866 | while (*p[0] && (strchr("0123456789,-*[]?;", *p[0])) && | ||
2867 | (i < ISDN_LMSNLEN - 1)) | ||
2868 | m->lmsn[i++] = *p[0]++; | ||
2869 | m->lmsn[i] = '\0'; | ||
2870 | break; | ||
2871 | case 'R': | ||
2872 | /* &R - Set V.110 bitrate adaption */ | ||
2873 | p[0]++; | ||
2874 | i = isdn_getnum(p); | ||
2875 | switch (i) { | ||
2876 | case 0: | ||
2877 | /* Switch off V.110, back to X.75 */ | ||
2878 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I; | ||
2879 | m->mdmreg[REG_SI2] = 0; | ||
2880 | info->xmit_size = m->mdmreg[REG_PSIZE] * 16; | ||
2860 | break; | 2881 | break; |
2861 | #endif | 2882 | case 9600: |
2862 | case 'L': | 2883 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_V11096; |
2863 | /* &L -Set Numbers to listen on */ | 2884 | m->mdmreg[REG_SI2] = 197; |
2864 | p[0]++; | 2885 | info->xmit_size = m->mdmreg[REG_PSIZE] * 16 / 10; |
2865 | i = 0; | ||
2866 | while (*p[0] && (strchr("0123456789,-*[]?;", *p[0])) && | ||
2867 | (i < ISDN_LMSNLEN - 1)) | ||
2868 | m->lmsn[i++] = *p[0]++; | ||
2869 | m->lmsn[i] = '\0'; | ||
2870 | break; | ||
2871 | case 'R': | ||
2872 | /* &R - Set V.110 bitrate adaption */ | ||
2873 | p[0]++; | ||
2874 | i = isdn_getnum(p); | ||
2875 | switch (i) { | ||
2876 | case 0: | ||
2877 | /* Switch off V.110, back to X.75 */ | ||
2878 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I; | ||
2879 | m->mdmreg[REG_SI2] = 0; | ||
2880 | info->xmit_size = m->mdmreg[REG_PSIZE] * 16; | ||
2881 | break; | ||
2882 | case 9600: | ||
2883 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_V11096; | ||
2884 | m->mdmreg[REG_SI2] = 197; | ||
2885 | info->xmit_size = m->mdmreg[REG_PSIZE] * 16 / 10; | ||
2886 | break; | ||
2887 | case 19200: | ||
2888 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_V11019; | ||
2889 | m->mdmreg[REG_SI2] = 199; | ||
2890 | info->xmit_size = m->mdmreg[REG_PSIZE] * 16 / 10; | ||
2891 | break; | ||
2892 | case 38400: | ||
2893 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_V11038; | ||
2894 | m->mdmreg[REG_SI2] = 198; /* no existing standard for this */ | ||
2895 | info->xmit_size = m->mdmreg[REG_PSIZE] * 16 / 10; | ||
2896 | break; | ||
2897 | default: | ||
2898 | PARSE_ERROR1; | ||
2899 | } | ||
2900 | /* Switch off T.70 */ | ||
2901 | m->mdmreg[REG_T70] &= ~(BIT_T70 | BIT_T70_EXT); | ||
2902 | /* Set Service 7 */ | ||
2903 | m->mdmreg[REG_SI1] |= 4; | ||
2904 | break; | 2886 | break; |
2905 | case 'S': | 2887 | case 19200: |
2906 | /* &S - Set Windowsize */ | 2888 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_V11019; |
2907 | p[0]++; | 2889 | m->mdmreg[REG_SI2] = 199; |
2908 | i = isdn_getnum(p); | 2890 | info->xmit_size = m->mdmreg[REG_PSIZE] * 16 / 10; |
2909 | if ((i > 0) && (i < 9)) | ||
2910 | m->mdmreg[REG_WSIZE] = i; | ||
2911 | else | ||
2912 | PARSE_ERROR1; | ||
2913 | break; | 2891 | break; |
2914 | case 'V': | 2892 | case 38400: |
2915 | /* &V - Show registers */ | 2893 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_V11038; |
2916 | p[0]++; | 2894 | m->mdmreg[REG_SI2] = 198; /* no existing standard for this */ |
2917 | isdn_tty_at_cout("\r\n", info); | 2895 | info->xmit_size = m->mdmreg[REG_PSIZE] * 16 / 10; |
2918 | for (i = 0; i < ISDN_MODEM_NUMREG; i++) { | ||
2919 | sprintf(rb, "S%02d=%03d%s", i, | ||
2920 | m->mdmreg[i], ((i + 1) % 10) ? " " : "\r\n"); | ||
2921 | isdn_tty_at_cout(rb, info); | ||
2922 | } | ||
2923 | sprintf(rb, "\r\nEAZ/MSN: %.50s\r\n", | ||
2924 | strlen(m->msn) ? m->msn : "None"); | ||
2925 | isdn_tty_at_cout(rb, info); | ||
2926 | if (strlen(m->lmsn)) { | ||
2927 | isdn_tty_at_cout("\r\nListen: ", info); | ||
2928 | isdn_tty_at_cout(m->lmsn, info); | ||
2929 | isdn_tty_at_cout("\r\n", info); | ||
2930 | } | ||
2931 | break; | 2896 | break; |
2932 | case 'W': | 2897 | default: |
2933 | /* &W - Write Profile */ | 2898 | PARSE_ERROR1; |
2899 | } | ||
2900 | /* Switch off T.70 */ | ||
2901 | m->mdmreg[REG_T70] &= ~(BIT_T70 | BIT_T70_EXT); | ||
2902 | /* Set Service 7 */ | ||
2903 | m->mdmreg[REG_SI1] |= 4; | ||
2904 | break; | ||
2905 | case 'S': | ||
2906 | /* &S - Set Windowsize */ | ||
2907 | p[0]++; | ||
2908 | i = isdn_getnum(p); | ||
2909 | if ((i > 0) && (i < 9)) | ||
2910 | m->mdmreg[REG_WSIZE] = i; | ||
2911 | else | ||
2912 | PARSE_ERROR1; | ||
2913 | break; | ||
2914 | case 'V': | ||
2915 | /* &V - Show registers */ | ||
2916 | p[0]++; | ||
2917 | isdn_tty_at_cout("\r\n", info); | ||
2918 | for (i = 0; i < ISDN_MODEM_NUMREG; i++) { | ||
2919 | sprintf(rb, "S%02d=%03d%s", i, | ||
2920 | m->mdmreg[i], ((i + 1) % 10) ? " " : "\r\n"); | ||
2921 | isdn_tty_at_cout(rb, info); | ||
2922 | } | ||
2923 | sprintf(rb, "\r\nEAZ/MSN: %.50s\r\n", | ||
2924 | strlen(m->msn) ? m->msn : "None"); | ||
2925 | isdn_tty_at_cout(rb, info); | ||
2926 | if (strlen(m->lmsn)) { | ||
2927 | isdn_tty_at_cout("\r\nListen: ", info); | ||
2928 | isdn_tty_at_cout(m->lmsn, info); | ||
2929 | isdn_tty_at_cout("\r\n", info); | ||
2930 | } | ||
2931 | break; | ||
2932 | case 'W': | ||
2933 | /* &W - Write Profile */ | ||
2934 | p[0]++; | ||
2935 | switch (*p[0]) { | ||
2936 | case '0': | ||
2934 | p[0]++; | 2937 | p[0]++; |
2935 | switch (*p[0]) { | 2938 | modem_write_profile(m); |
2936 | case '0': | ||
2937 | p[0]++; | ||
2938 | modem_write_profile(m); | ||
2939 | break; | ||
2940 | default: | ||
2941 | PARSE_ERROR1; | ||
2942 | } | ||
2943 | break; | 2939 | break; |
2944 | case 'X': | 2940 | default: |
2945 | /* &X - Switch to BTX-Mode and T.70 */ | 2941 | PARSE_ERROR1; |
2946 | p[0]++; | 2942 | } |
2947 | switch (isdn_getnum(p)) { | 2943 | break; |
2948 | case 0: | 2944 | case 'X': |
2949 | m->mdmreg[REG_T70] &= ~(BIT_T70 | BIT_T70_EXT); | 2945 | /* &X - Switch to BTX-Mode and T.70 */ |
2950 | info->xmit_size = m->mdmreg[REG_PSIZE] * 16; | 2946 | p[0]++; |
2951 | break; | 2947 | switch (isdn_getnum(p)) { |
2952 | case 1: | 2948 | case 0: |
2953 | m->mdmreg[REG_T70] |= BIT_T70; | 2949 | m->mdmreg[REG_T70] &= ~(BIT_T70 | BIT_T70_EXT); |
2954 | m->mdmreg[REG_T70] &= ~BIT_T70_EXT; | 2950 | info->xmit_size = m->mdmreg[REG_PSIZE] * 16; |
2955 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I; | 2951 | break; |
2956 | info->xmit_size = 112; | 2952 | case 1: |
2957 | m->mdmreg[REG_SI1] = 4; | 2953 | m->mdmreg[REG_T70] |= BIT_T70; |
2958 | m->mdmreg[REG_SI2] = 0; | 2954 | m->mdmreg[REG_T70] &= ~BIT_T70_EXT; |
2959 | break; | 2955 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I; |
2960 | case 2: | 2956 | info->xmit_size = 112; |
2961 | m->mdmreg[REG_T70] |= (BIT_T70 | BIT_T70_EXT); | 2957 | m->mdmreg[REG_SI1] = 4; |
2962 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I; | 2958 | m->mdmreg[REG_SI2] = 0; |
2963 | info->xmit_size = 112; | 2959 | break; |
2964 | m->mdmreg[REG_SI1] = 4; | 2960 | case 2: |
2965 | m->mdmreg[REG_SI2] = 0; | 2961 | m->mdmreg[REG_T70] |= (BIT_T70 | BIT_T70_EXT); |
2966 | break; | 2962 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I; |
2967 | default: | 2963 | info->xmit_size = 112; |
2968 | PARSE_ERROR1; | 2964 | m->mdmreg[REG_SI1] = 4; |
2969 | } | 2965 | m->mdmreg[REG_SI2] = 0; |
2970 | break; | 2966 | break; |
2971 | default: | 2967 | default: |
2972 | PARSE_ERROR1; | 2968 | PARSE_ERROR1; |
2969 | } | ||
2970 | break; | ||
2971 | default: | ||
2972 | PARSE_ERROR1; | ||
2973 | } | 2973 | } |
2974 | return 0; | 2974 | return 0; |
2975 | } | 2975 | } |
2976 | 2976 | ||
2977 | static int | 2977 | static int |
2978 | isdn_tty_check_ats(int mreg, int mval, modem_info * info, atemu * m) | 2978 | isdn_tty_check_ats(int mreg, int mval, modem_info *info, atemu *m) |
2979 | { | 2979 | { |
2980 | /* Some plausibility checks */ | 2980 | /* Some plausibility checks */ |
2981 | switch (mreg) { | 2981 | switch (mreg) { |
2982 | case REG_L2PROT: | 2982 | case REG_L2PROT: |
2983 | if (mval > ISDN_PROTO_L2_MAX) | 2983 | if (mval > ISDN_PROTO_L2_MAX) |
2984 | return 1; | 2984 | return 1; |
2985 | break; | 2985 | break; |
2986 | case REG_PSIZE: | 2986 | case REG_PSIZE: |
2987 | if ((mval * 16) > ISDN_SERIAL_XMIT_MAX) | 2987 | if ((mval * 16) > ISDN_SERIAL_XMIT_MAX) |
2988 | return 1; | 2988 | return 1; |
2989 | #ifdef CONFIG_ISDN_AUDIO | 2989 | #ifdef CONFIG_ISDN_AUDIO |
2990 | if ((m->mdmreg[REG_SI1] & 1) && (mval > VBUFX)) | 2990 | if ((m->mdmreg[REG_SI1] & 1) && (mval > VBUFX)) |
2991 | return 1; | ||
2992 | #endif | ||
2993 | info->xmit_size = mval * 16; | ||
2994 | switch (m->mdmreg[REG_L2PROT]) { | ||
2995 | case ISDN_PROTO_L2_V11096: | ||
2996 | case ISDN_PROTO_L2_V11019: | ||
2997 | case ISDN_PROTO_L2_V11038: | ||
2998 | info->xmit_size /= 10; | ||
2999 | } | ||
3000 | break; | ||
3001 | case REG_SI1I: | ||
3002 | case REG_PLAN: | ||
3003 | case REG_SCREEN: | ||
3004 | /* readonly registers */ | ||
3005 | return 1; | 2991 | return 1; |
2992 | #endif | ||
2993 | info->xmit_size = mval * 16; | ||
2994 | switch (m->mdmreg[REG_L2PROT]) { | ||
2995 | case ISDN_PROTO_L2_V11096: | ||
2996 | case ISDN_PROTO_L2_V11019: | ||
2997 | case ISDN_PROTO_L2_V11038: | ||
2998 | info->xmit_size /= 10; | ||
2999 | } | ||
3000 | break; | ||
3001 | case REG_SI1I: | ||
3002 | case REG_PLAN: | ||
3003 | case REG_SCREEN: | ||
3004 | /* readonly registers */ | ||
3005 | return 1; | ||
3006 | } | 3006 | } |
3007 | return 0; | 3007 | return 0; |
3008 | } | 3008 | } |
@@ -3011,7 +3011,7 @@ isdn_tty_check_ats(int mreg, int mval, modem_info * info, atemu * m) | |||
3011 | * Perform ATS command | 3011 | * Perform ATS command |
3012 | */ | 3012 | */ |
3013 | static int | 3013 | static int |
3014 | isdn_tty_cmd_ATS(char **p, modem_info * info) | 3014 | isdn_tty_cmd_ATS(char **p, modem_info *info) |
3015 | { | 3015 | { |
3016 | atemu *m = &info->emu; | 3016 | atemu *m = &info->emu; |
3017 | int bitpos; | 3017 | int bitpos; |
@@ -3023,52 +3023,52 @@ isdn_tty_cmd_ATS(char **p, modem_info * info) | |||
3023 | if (mreg < 0 || mreg >= ISDN_MODEM_NUMREG) | 3023 | if (mreg < 0 || mreg >= ISDN_MODEM_NUMREG) |
3024 | PARSE_ERROR1; | 3024 | PARSE_ERROR1; |
3025 | switch (*p[0]) { | 3025 | switch (*p[0]) { |
3026 | case '=': | ||
3027 | p[0]++; | ||
3028 | mval = isdn_getnum(p); | ||
3029 | if (mval < 0 || mval > 255) | ||
3030 | PARSE_ERROR1; | ||
3031 | if (isdn_tty_check_ats(mreg, mval, info, m)) | ||
3032 | PARSE_ERROR1; | ||
3033 | m->mdmreg[mreg] = mval; | ||
3034 | break; | ||
3035 | case '.': | ||
3036 | /* Set/Clear a single bit */ | ||
3037 | p[0]++; | ||
3038 | bitpos = isdn_getnum(p); | ||
3039 | if ((bitpos < 0) || (bitpos > 7)) | ||
3040 | PARSE_ERROR1; | ||
3041 | switch (*p[0]) { | ||
3026 | case '=': | 3042 | case '=': |
3027 | p[0]++; | 3043 | p[0]++; |
3028 | mval = isdn_getnum(p); | 3044 | bval = isdn_getnum(p); |
3029 | if (mval < 0 || mval > 255) | 3045 | if (bval < 0 || bval > 1) |
3030 | PARSE_ERROR1; | 3046 | PARSE_ERROR1; |
3047 | if (bval) | ||
3048 | mval = m->mdmreg[mreg] | (1 << bitpos); | ||
3049 | else | ||
3050 | mval = m->mdmreg[mreg] & ~(1 << bitpos); | ||
3031 | if (isdn_tty_check_ats(mreg, mval, info, m)) | 3051 | if (isdn_tty_check_ats(mreg, mval, info, m)) |
3032 | PARSE_ERROR1; | 3052 | PARSE_ERROR1; |
3033 | m->mdmreg[mreg] = mval; | 3053 | m->mdmreg[mreg] = mval; |
3034 | break; | 3054 | break; |
3035 | case '.': | ||
3036 | /* Set/Clear a single bit */ | ||
3037 | p[0]++; | ||
3038 | bitpos = isdn_getnum(p); | ||
3039 | if ((bitpos < 0) || (bitpos > 7)) | ||
3040 | PARSE_ERROR1; | ||
3041 | switch (*p[0]) { | ||
3042 | case '=': | ||
3043 | p[0]++; | ||
3044 | bval = isdn_getnum(p); | ||
3045 | if (bval < 0 || bval > 1) | ||
3046 | PARSE_ERROR1; | ||
3047 | if (bval) | ||
3048 | mval = m->mdmreg[mreg] | (1 << bitpos); | ||
3049 | else | ||
3050 | mval = m->mdmreg[mreg] & ~(1 << bitpos); | ||
3051 | if (isdn_tty_check_ats(mreg, mval, info, m)) | ||
3052 | PARSE_ERROR1; | ||
3053 | m->mdmreg[mreg] = mval; | ||
3054 | break; | ||
3055 | case '?': | ||
3056 | p[0]++; | ||
3057 | isdn_tty_at_cout("\r\n", info); | ||
3058 | isdn_tty_at_cout((m->mdmreg[mreg] & (1 << bitpos)) ? "1" : "0", | ||
3059 | info); | ||
3060 | break; | ||
3061 | default: | ||
3062 | PARSE_ERROR1; | ||
3063 | } | ||
3064 | break; | ||
3065 | case '?': | 3055 | case '?': |
3066 | p[0]++; | 3056 | p[0]++; |
3067 | isdn_tty_show_profile(mreg, info); | 3057 | isdn_tty_at_cout("\r\n", info); |
3058 | isdn_tty_at_cout((m->mdmreg[mreg] & (1 << bitpos)) ? "1" : "0", | ||
3059 | info); | ||
3068 | break; | 3060 | break; |
3069 | default: | 3061 | default: |
3070 | PARSE_ERROR1; | 3062 | PARSE_ERROR1; |
3071 | break; | 3063 | } |
3064 | break; | ||
3065 | case '?': | ||
3066 | p[0]++; | ||
3067 | isdn_tty_show_profile(mreg, info); | ||
3068 | break; | ||
3069 | default: | ||
3070 | PARSE_ERROR1; | ||
3071 | break; | ||
3072 | } | 3072 | } |
3073 | return 0; | 3073 | return 0; |
3074 | } | 3074 | } |
@@ -3077,7 +3077,7 @@ isdn_tty_cmd_ATS(char **p, modem_info * info) | |||
3077 | * Perform ATA command | 3077 | * Perform ATA command |
3078 | */ | 3078 | */ |
3079 | static void | 3079 | static void |
3080 | isdn_tty_cmd_ATA(modem_info * info) | 3080 | isdn_tty_cmd_ATA(modem_info *info) |
3081 | { | 3081 | { |
3082 | atemu *m = &info->emu; | 3082 | atemu *m = &info->emu; |
3083 | isdn_ctrl cmd; | 3083 | isdn_ctrl cmd; |
@@ -3131,7 +3131,7 @@ isdn_tty_cmd_ATA(modem_info * info) | |||
3131 | * Parse AT+F.. commands | 3131 | * Parse AT+F.. commands |
3132 | */ | 3132 | */ |
3133 | static int | 3133 | static int |
3134 | isdn_tty_cmd_PLUSF(char **p, modem_info * info) | 3134 | isdn_tty_cmd_PLUSF(char **p, modem_info *info) |
3135 | { | 3135 | { |
3136 | atemu *m = &info->emu; | 3136 | atemu *m = &info->emu; |
3137 | char rs[20]; | 3137 | char rs[20]; |
@@ -3139,81 +3139,81 @@ isdn_tty_cmd_PLUSF(char **p, modem_info * info) | |||
3139 | if (!strncmp(p[0], "CLASS", 5)) { | 3139 | if (!strncmp(p[0], "CLASS", 5)) { |
3140 | p[0] += 5; | 3140 | p[0] += 5; |
3141 | switch (*p[0]) { | 3141 | switch (*p[0]) { |
3142 | case '?': | 3142 | case '?': |
3143 | p[0]++; | 3143 | p[0]++; |
3144 | sprintf(rs, "\r\n%d", | 3144 | sprintf(rs, "\r\n%d", |
3145 | (m->mdmreg[REG_SI1] & 1) ? 8 : 0); | 3145 | (m->mdmreg[REG_SI1] & 1) ? 8 : 0); |
3146 | #ifdef CONFIG_ISDN_TTY_FAX | 3146 | #ifdef CONFIG_ISDN_TTY_FAX |
3147 | if (TTY_IS_FCLASS2(info)) | 3147 | if (TTY_IS_FCLASS2(info)) |
3148 | sprintf(rs, "\r\n2"); | 3148 | sprintf(rs, "\r\n2"); |
3149 | else if (TTY_IS_FCLASS1(info)) | 3149 | else if (TTY_IS_FCLASS1(info)) |
3150 | sprintf(rs, "\r\n1"); | 3150 | sprintf(rs, "\r\n1"); |
3151 | #endif | 3151 | #endif |
3152 | isdn_tty_at_cout(rs, info); | 3152 | isdn_tty_at_cout(rs, info); |
3153 | break; | 3153 | break; |
3154 | case '=': | 3154 | case '=': |
3155 | p[0]++; | ||
3156 | switch (*p[0]) { | ||
3157 | case '0': | ||
3155 | p[0]++; | 3158 | p[0]++; |
3156 | switch (*p[0]) { | 3159 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I; |
3157 | case '0': | 3160 | m->mdmreg[REG_L3PROT] = ISDN_PROTO_L3_TRANS; |
3158 | p[0]++; | 3161 | m->mdmreg[REG_SI1] = 4; |
3159 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I; | 3162 | info->xmit_size = |
3160 | m->mdmreg[REG_L3PROT] = ISDN_PROTO_L3_TRANS; | 3163 | m->mdmreg[REG_PSIZE] * 16; |
3161 | m->mdmreg[REG_SI1] = 4; | 3164 | break; |
3162 | info->xmit_size = | ||
3163 | m->mdmreg[REG_PSIZE] * 16; | ||
3164 | break; | ||
3165 | #ifdef CONFIG_ISDN_TTY_FAX | 3165 | #ifdef CONFIG_ISDN_TTY_FAX |
3166 | case '1': | 3166 | case '1': |
3167 | p[0]++; | 3167 | p[0]++; |
3168 | if (!(dev->global_features & | 3168 | if (!(dev->global_features & |
3169 | ISDN_FEATURE_L3_FCLASS1)) | 3169 | ISDN_FEATURE_L3_FCLASS1)) |
3170 | PARSE_ERROR1; | 3170 | PARSE_ERROR1; |
3171 | m->mdmreg[REG_SI1] = 1; | 3171 | m->mdmreg[REG_SI1] = 1; |
3172 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_FAX; | 3172 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_FAX; |
3173 | m->mdmreg[REG_L3PROT] = ISDN_PROTO_L3_FCLASS1; | 3173 | m->mdmreg[REG_L3PROT] = ISDN_PROTO_L3_FCLASS1; |
3174 | info->xmit_size = | 3174 | info->xmit_size = |
3175 | m->mdmreg[REG_PSIZE] * 16; | 3175 | m->mdmreg[REG_PSIZE] * 16; |
3176 | break; | 3176 | break; |
3177 | case '2': | 3177 | case '2': |
3178 | p[0]++; | 3178 | p[0]++; |
3179 | if (!(dev->global_features & | 3179 | if (!(dev->global_features & |
3180 | ISDN_FEATURE_L3_FCLASS2)) | 3180 | ISDN_FEATURE_L3_FCLASS2)) |
3181 | PARSE_ERROR1; | 3181 | PARSE_ERROR1; |
3182 | m->mdmreg[REG_SI1] = 1; | 3182 | m->mdmreg[REG_SI1] = 1; |
3183 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_FAX; | 3183 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_FAX; |
3184 | m->mdmreg[REG_L3PROT] = ISDN_PROTO_L3_FCLASS2; | 3184 | m->mdmreg[REG_L3PROT] = ISDN_PROTO_L3_FCLASS2; |
3185 | info->xmit_size = | 3185 | info->xmit_size = |
3186 | m->mdmreg[REG_PSIZE] * 16; | 3186 | m->mdmreg[REG_PSIZE] * 16; |
3187 | break; | 3187 | break; |
3188 | #endif | 3188 | #endif |
3189 | case '8': | 3189 | case '8': |
3190 | p[0]++; | 3190 | p[0]++; |
3191 | /* L2 will change on dialout with si=1 */ | 3191 | /* L2 will change on dialout with si=1 */ |
3192 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I; | 3192 | m->mdmreg[REG_L2PROT] = ISDN_PROTO_L2_X75I; |
3193 | m->mdmreg[REG_L3PROT] = ISDN_PROTO_L3_TRANS; | 3193 | m->mdmreg[REG_L3PROT] = ISDN_PROTO_L3_TRANS; |
3194 | m->mdmreg[REG_SI1] = 5; | 3194 | m->mdmreg[REG_SI1] = 5; |
3195 | info->xmit_size = VBUF; | 3195 | info->xmit_size = VBUF; |
3196 | break; | 3196 | break; |
3197 | case '?': | 3197 | case '?': |
3198 | p[0]++; | 3198 | p[0]++; |
3199 | strcpy(rs, "\r\n0,"); | 3199 | strcpy(rs, "\r\n0,"); |
3200 | #ifdef CONFIG_ISDN_TTY_FAX | 3200 | #ifdef CONFIG_ISDN_TTY_FAX |
3201 | if (dev->global_features & | 3201 | if (dev->global_features & |
3202 | ISDN_FEATURE_L3_FCLASS1) | 3202 | ISDN_FEATURE_L3_FCLASS1) |
3203 | strcat(rs, "1,"); | 3203 | strcat(rs, "1,"); |
3204 | if (dev->global_features & | 3204 | if (dev->global_features & |
3205 | ISDN_FEATURE_L3_FCLASS2) | 3205 | ISDN_FEATURE_L3_FCLASS2) |
3206 | strcat(rs, "2,"); | 3206 | strcat(rs, "2,"); |
3207 | #endif | 3207 | #endif |
3208 | strcat(rs, "8"); | 3208 | strcat(rs, "8"); |
3209 | isdn_tty_at_cout(rs, info); | 3209 | isdn_tty_at_cout(rs, info); |
3210 | break; | ||
3211 | default: | ||
3212 | PARSE_ERROR1; | ||
3213 | } | ||
3214 | break; | 3210 | break; |
3215 | default: | 3211 | default: |
3216 | PARSE_ERROR1; | 3212 | PARSE_ERROR1; |
3213 | } | ||
3214 | break; | ||
3215 | default: | ||
3216 | PARSE_ERROR1; | ||
3217 | } | 3217 | } |
3218 | return 0; | 3218 | return 0; |
3219 | } | 3219 | } |
@@ -3228,12 +3228,12 @@ isdn_tty_cmd_PLUSF(char **p, modem_info * info) | |||
3228 | * Parse AT+V.. commands | 3228 | * Parse AT+V.. commands |
3229 | */ | 3229 | */ |
3230 | static int | 3230 | static int |
3231 | isdn_tty_cmd_PLUSV(char **p, modem_info * info) | 3231 | isdn_tty_cmd_PLUSV(char **p, modem_info *info) |
3232 | { | 3232 | { |
3233 | atemu *m = &info->emu; | 3233 | atemu *m = &info->emu; |
3234 | isdn_ctrl cmd; | 3234 | isdn_ctrl cmd; |
3235 | static char *vcmd[] = | 3235 | static char *vcmd[] = |
3236 | {"NH", "IP", "LS", "RX", "SD", "SM", "TX", "DD", NULL}; | 3236 | {"NH", "IP", "LS", "RX", "SD", "SM", "TX", "DD", NULL}; |
3237 | int i; | 3237 | int i; |
3238 | int par1; | 3238 | int par1; |
3239 | int par2; | 3239 | int par2; |
@@ -3248,256 +3248,256 @@ isdn_tty_cmd_PLUSV(char **p, modem_info * info) | |||
3248 | i++; | 3248 | i++; |
3249 | } | 3249 | } |
3250 | switch (i) { | 3250 | switch (i) { |
3251 | case 0: | 3251 | case 0: |
3252 | /* AT+VNH - Auto hangup feature */ | 3252 | /* AT+VNH - Auto hangup feature */ |
3253 | switch (*p[0]) { | ||
3254 | case '?': | ||
3255 | p[0]++; | ||
3256 | isdn_tty_at_cout("\r\n1", info); | ||
3257 | break; | ||
3258 | case '=': | ||
3259 | p[0]++; | ||
3253 | switch (*p[0]) { | 3260 | switch (*p[0]) { |
3254 | case '?': | 3261 | case '1': |
3255 | p[0]++; | 3262 | p[0]++; |
3256 | isdn_tty_at_cout("\r\n1", info); | 3263 | break; |
3257 | break; | 3264 | case '?': |
3258 | case '=': | 3265 | p[0]++; |
3259 | p[0]++; | 3266 | isdn_tty_at_cout("\r\n1", info); |
3260 | switch (*p[0]) { | 3267 | break; |
3261 | case '1': | 3268 | default: |
3262 | p[0]++; | 3269 | PARSE_ERROR1; |
3263 | break; | ||
3264 | case '?': | ||
3265 | p[0]++; | ||
3266 | isdn_tty_at_cout("\r\n1", info); | ||
3267 | break; | ||
3268 | default: | ||
3269 | PARSE_ERROR1; | ||
3270 | } | ||
3271 | break; | ||
3272 | default: | ||
3273 | PARSE_ERROR1; | ||
3274 | } | 3270 | } |
3275 | break; | 3271 | break; |
3276 | case 1: | 3272 | default: |
3277 | /* AT+VIP - Reset all voice parameters */ | 3273 | PARSE_ERROR1; |
3278 | isdn_tty_modem_reset_vpar(m); | 3274 | } |
3275 | break; | ||
3276 | case 1: | ||
3277 | /* AT+VIP - Reset all voice parameters */ | ||
3278 | isdn_tty_modem_reset_vpar(m); | ||
3279 | break; | ||
3280 | case 2: | ||
3281 | /* AT+VLS - Select device, accept incoming call */ | ||
3282 | switch (*p[0]) { | ||
3283 | case '?': | ||
3284 | p[0]++; | ||
3285 | sprintf(rs, "\r\n%d", m->vpar[0]); | ||
3286 | isdn_tty_at_cout(rs, info); | ||
3279 | break; | 3287 | break; |
3280 | case 2: | 3288 | case '=': |
3281 | /* AT+VLS - Select device, accept incoming call */ | 3289 | p[0]++; |
3282 | switch (*p[0]) { | 3290 | switch (*p[0]) { |
3283 | case '?': | 3291 | case '0': |
3284 | p[0]++; | 3292 | p[0]++; |
3285 | sprintf(rs, "\r\n%d", m->vpar[0]); | 3293 | m->vpar[0] = 0; |
3286 | isdn_tty_at_cout(rs, info); | 3294 | break; |
3287 | break; | 3295 | case '2': |
3288 | case '=': | 3296 | p[0]++; |
3289 | p[0]++; | 3297 | m->vpar[0] = 2; |
3290 | switch (*p[0]) { | 3298 | break; |
3291 | case '0': | 3299 | case '?': |
3292 | p[0]++; | 3300 | p[0]++; |
3293 | m->vpar[0] = 0; | 3301 | isdn_tty_at_cout("\r\n0,2", info); |
3294 | break; | 3302 | break; |
3295 | case '2': | 3303 | default: |
3296 | p[0]++; | ||
3297 | m->vpar[0] = 2; | ||
3298 | break; | ||
3299 | case '?': | ||
3300 | p[0]++; | ||
3301 | isdn_tty_at_cout("\r\n0,2", info); | ||
3302 | break; | ||
3303 | default: | ||
3304 | PARSE_ERROR1; | ||
3305 | } | ||
3306 | break; | ||
3307 | default: | ||
3308 | PARSE_ERROR1; | ||
3309 | } | ||
3310 | break; | ||
3311 | case 3: | ||
3312 | /* AT+VRX - Start recording */ | ||
3313 | if (!m->vpar[0]) | ||
3314 | PARSE_ERROR1; | ||
3315 | if (info->online != 1) { | ||
3316 | isdn_tty_modem_result(RESULT_NO_ANSWER, info); | ||
3317 | return 1; | ||
3318 | } | ||
3319 | info->dtmf_state = isdn_audio_dtmf_init(info->dtmf_state); | ||
3320 | if (!info->dtmf_state) { | ||
3321 | printk(KERN_WARNING "isdn_tty: Couldn't malloc dtmf state\n"); | ||
3322 | PARSE_ERROR1; | 3304 | PARSE_ERROR1; |
3323 | } | 3305 | } |
3324 | info->silence_state = isdn_audio_silence_init(info->silence_state); | 3306 | break; |
3325 | if (!info->silence_state) { | 3307 | default: |
3326 | printk(KERN_WARNING "isdn_tty: Couldn't malloc silence state\n"); | 3308 | PARSE_ERROR1; |
3309 | } | ||
3310 | break; | ||
3311 | case 3: | ||
3312 | /* AT+VRX - Start recording */ | ||
3313 | if (!m->vpar[0]) | ||
3314 | PARSE_ERROR1; | ||
3315 | if (info->online != 1) { | ||
3316 | isdn_tty_modem_result(RESULT_NO_ANSWER, info); | ||
3317 | return 1; | ||
3318 | } | ||
3319 | info->dtmf_state = isdn_audio_dtmf_init(info->dtmf_state); | ||
3320 | if (!info->dtmf_state) { | ||
3321 | printk(KERN_WARNING "isdn_tty: Couldn't malloc dtmf state\n"); | ||
3322 | PARSE_ERROR1; | ||
3323 | } | ||
3324 | info->silence_state = isdn_audio_silence_init(info->silence_state); | ||
3325 | if (!info->silence_state) { | ||
3326 | printk(KERN_WARNING "isdn_tty: Couldn't malloc silence state\n"); | ||
3327 | PARSE_ERROR1; | ||
3328 | } | ||
3329 | if (m->vpar[3] < 5) { | ||
3330 | info->adpcmr = isdn_audio_adpcm_init(info->adpcmr, m->vpar[3]); | ||
3331 | if (!info->adpcmr) { | ||
3332 | printk(KERN_WARNING "isdn_tty: Couldn't malloc adpcm state\n"); | ||
3327 | PARSE_ERROR1; | 3333 | PARSE_ERROR1; |
3328 | } | 3334 | } |
3329 | if (m->vpar[3] < 5) { | 3335 | } |
3330 | info->adpcmr = isdn_audio_adpcm_init(info->adpcmr, m->vpar[3]); | ||
3331 | if (!info->adpcmr) { | ||
3332 | printk(KERN_WARNING "isdn_tty: Couldn't malloc adpcm state\n"); | ||
3333 | PARSE_ERROR1; | ||
3334 | } | ||
3335 | } | ||
3336 | #ifdef ISDN_DEBUG_AT | 3336 | #ifdef ISDN_DEBUG_AT |
3337 | printk(KERN_DEBUG "AT: +VRX\n"); | 3337 | printk(KERN_DEBUG "AT: +VRX\n"); |
3338 | #endif | 3338 | #endif |
3339 | info->vonline |= 1; | 3339 | info->vonline |= 1; |
3340 | isdn_tty_modem_result(RESULT_CONNECT, info); | 3340 | isdn_tty_modem_result(RESULT_CONNECT, info); |
3341 | return 0; | 3341 | return 0; |
3342 | break; | ||
3343 | case 4: | ||
3344 | /* AT+VSD - Silence detection */ | ||
3345 | switch (*p[0]) { | ||
3346 | case '?': | ||
3347 | p[0]++; | ||
3348 | sprintf(rs, "\r\n<%d>,<%d>", | ||
3349 | m->vpar[1], | ||
3350 | m->vpar[2]); | ||
3351 | isdn_tty_at_cout(rs, info); | ||
3342 | break; | 3352 | break; |
3343 | case 4: | 3353 | case '=': |
3344 | /* AT+VSD - Silence detection */ | 3354 | p[0]++; |
3345 | switch (*p[0]) { | 3355 | if ((*p[0] >= '0') && (*p[0] <= '9')) { |
3346 | case '?': | 3356 | par1 = isdn_getnum(p); |
3347 | p[0]++; | 3357 | if ((par1 < 0) || (par1 > 31)) |
3348 | sprintf(rs, "\r\n<%d>,<%d>", | ||
3349 | m->vpar[1], | ||
3350 | m->vpar[2]); | ||
3351 | isdn_tty_at_cout(rs, info); | ||
3352 | break; | ||
3353 | case '=': | ||
3354 | p[0]++; | ||
3355 | if ((*p[0]>='0') && (*p[0]<='9')) { | ||
3356 | par1 = isdn_getnum(p); | ||
3357 | if ((par1 < 0) || (par1 > 31)) | ||
3358 | PARSE_ERROR1; | ||
3359 | if (*p[0] != ',') | ||
3360 | PARSE_ERROR1; | ||
3361 | p[0]++; | ||
3362 | par2 = isdn_getnum(p); | ||
3363 | if ((par2 < 0) || (par2 > 255)) | ||
3364 | PARSE_ERROR1; | ||
3365 | m->vpar[1] = par1; | ||
3366 | m->vpar[2] = par2; | ||
3367 | break; | ||
3368 | } else | ||
3369 | if (*p[0] == '?') { | ||
3370 | p[0]++; | ||
3371 | isdn_tty_at_cout("\r\n<0-31>,<0-255>", | ||
3372 | info); | ||
3373 | break; | ||
3374 | } else | ||
3375 | PARSE_ERROR1; | 3358 | PARSE_ERROR1; |
3376 | break; | 3359 | if (*p[0] != ',') |
3377 | default: | ||
3378 | PARSE_ERROR1; | 3360 | PARSE_ERROR1; |
3379 | } | 3361 | p[0]++; |
3380 | break; | 3362 | par2 = isdn_getnum(p); |
3381 | case 5: | 3363 | if ((par2 < 0) || (par2 > 255)) |
3382 | /* AT+VSM - Select compression */ | 3364 | PARSE_ERROR1; |
3383 | switch (*p[0]) { | 3365 | m->vpar[1] = par1; |
3384 | case '?': | 3366 | m->vpar[2] = par2; |
3385 | p[0]++; | 3367 | break; |
3386 | sprintf(rs, "\r\n<%d>,<%d><8000>", | 3368 | } else |
3387 | m->vpar[3], | 3369 | if (*p[0] == '?') { |
3388 | m->vpar[1]); | ||
3389 | isdn_tty_at_cout(rs, info); | ||
3390 | break; | ||
3391 | case '=': | ||
3392 | p[0]++; | 3370 | p[0]++; |
3393 | switch (*p[0]) { | 3371 | isdn_tty_at_cout("\r\n<0-31>,<0-255>", |
3394 | case '2': | 3372 | info); |
3395 | case '3': | ||
3396 | case '4': | ||
3397 | case '5': | ||
3398 | case '6': | ||
3399 | par1 = isdn_getnum(p); | ||
3400 | if ((par1 < 2) || (par1 > 6)) | ||
3401 | PARSE_ERROR1; | ||
3402 | m->vpar[3] = par1; | ||
3403 | break; | ||
3404 | case '?': | ||
3405 | p[0]++; | ||
3406 | isdn_tty_at_cout("\r\n2;ADPCM;2;0;(8000)\r\n", | ||
3407 | info); | ||
3408 | isdn_tty_at_cout("3;ADPCM;3;0;(8000)\r\n", | ||
3409 | info); | ||
3410 | isdn_tty_at_cout("4;ADPCM;4;0;(8000)\r\n", | ||
3411 | info); | ||
3412 | isdn_tty_at_cout("5;ALAW;8;0;(8000)\r\n", | ||
3413 | info); | ||
3414 | isdn_tty_at_cout("6;ULAW;8;0;(8000)\r\n", | ||
3415 | info); | ||
3416 | break; | ||
3417 | default: | ||
3418 | PARSE_ERROR1; | ||
3419 | } | ||
3420 | break; | 3373 | break; |
3421 | default: | 3374 | } else |
3422 | PARSE_ERROR1; | 3375 | PARSE_ERROR1; |
3423 | } | ||
3424 | break; | 3376 | break; |
3425 | case 6: | 3377 | default: |
3426 | /* AT+VTX - Start sending */ | 3378 | PARSE_ERROR1; |
3427 | if (!m->vpar[0]) | 3379 | } |
3380 | break; | ||
3381 | case 5: | ||
3382 | /* AT+VSM - Select compression */ | ||
3383 | switch (*p[0]) { | ||
3384 | case '?': | ||
3385 | p[0]++; | ||
3386 | sprintf(rs, "\r\n<%d>,<%d><8000>", | ||
3387 | m->vpar[3], | ||
3388 | m->vpar[1]); | ||
3389 | isdn_tty_at_cout(rs, info); | ||
3390 | break; | ||
3391 | case '=': | ||
3392 | p[0]++; | ||
3393 | switch (*p[0]) { | ||
3394 | case '2': | ||
3395 | case '3': | ||
3396 | case '4': | ||
3397 | case '5': | ||
3398 | case '6': | ||
3399 | par1 = isdn_getnum(p); | ||
3400 | if ((par1 < 2) || (par1 > 6)) | ||
3401 | PARSE_ERROR1; | ||
3402 | m->vpar[3] = par1; | ||
3403 | break; | ||
3404 | case '?': | ||
3405 | p[0]++; | ||
3406 | isdn_tty_at_cout("\r\n2;ADPCM;2;0;(8000)\r\n", | ||
3407 | info); | ||
3408 | isdn_tty_at_cout("3;ADPCM;3;0;(8000)\r\n", | ||
3409 | info); | ||
3410 | isdn_tty_at_cout("4;ADPCM;4;0;(8000)\r\n", | ||
3411 | info); | ||
3412 | isdn_tty_at_cout("5;ALAW;8;0;(8000)\r\n", | ||
3413 | info); | ||
3414 | isdn_tty_at_cout("6;ULAW;8;0;(8000)\r\n", | ||
3415 | info); | ||
3416 | break; | ||
3417 | default: | ||
3428 | PARSE_ERROR1; | 3418 | PARSE_ERROR1; |
3429 | if (info->online != 1) { | ||
3430 | isdn_tty_modem_result(RESULT_NO_ANSWER, info); | ||
3431 | return 1; | ||
3432 | } | 3419 | } |
3433 | info->dtmf_state = isdn_audio_dtmf_init(info->dtmf_state); | 3420 | break; |
3434 | if (!info->dtmf_state) { | 3421 | default: |
3435 | printk(KERN_WARNING "isdn_tty: Couldn't malloc dtmf state\n"); | 3422 | PARSE_ERROR1; |
3423 | } | ||
3424 | break; | ||
3425 | case 6: | ||
3426 | /* AT+VTX - Start sending */ | ||
3427 | if (!m->vpar[0]) | ||
3428 | PARSE_ERROR1; | ||
3429 | if (info->online != 1) { | ||
3430 | isdn_tty_modem_result(RESULT_NO_ANSWER, info); | ||
3431 | return 1; | ||
3432 | } | ||
3433 | info->dtmf_state = isdn_audio_dtmf_init(info->dtmf_state); | ||
3434 | if (!info->dtmf_state) { | ||
3435 | printk(KERN_WARNING "isdn_tty: Couldn't malloc dtmf state\n"); | ||
3436 | PARSE_ERROR1; | ||
3437 | } | ||
3438 | if (m->vpar[3] < 5) { | ||
3439 | info->adpcms = isdn_audio_adpcm_init(info->adpcms, m->vpar[3]); | ||
3440 | if (!info->adpcms) { | ||
3441 | printk(KERN_WARNING "isdn_tty: Couldn't malloc adpcm state\n"); | ||
3436 | PARSE_ERROR1; | 3442 | PARSE_ERROR1; |
3437 | } | 3443 | } |
3438 | if (m->vpar[3] < 5) { | 3444 | } |
3439 | info->adpcms = isdn_audio_adpcm_init(info->adpcms, m->vpar[3]); | ||
3440 | if (!info->adpcms) { | ||
3441 | printk(KERN_WARNING "isdn_tty: Couldn't malloc adpcm state\n"); | ||
3442 | PARSE_ERROR1; | ||
3443 | } | ||
3444 | } | ||
3445 | #ifdef ISDN_DEBUG_AT | 3445 | #ifdef ISDN_DEBUG_AT |
3446 | printk(KERN_DEBUG "AT: +VTX\n"); | 3446 | printk(KERN_DEBUG "AT: +VTX\n"); |
3447 | #endif | 3447 | #endif |
3448 | m->lastDLE = 0; | 3448 | m->lastDLE = 0; |
3449 | info->vonline |= 2; | 3449 | info->vonline |= 2; |
3450 | isdn_tty_modem_result(RESULT_CONNECT, info); | 3450 | isdn_tty_modem_result(RESULT_CONNECT, info); |
3451 | return 0; | 3451 | return 0; |
3452 | break; | ||
3453 | case 7: | ||
3454 | /* AT+VDD - DTMF detection */ | ||
3455 | switch (*p[0]) { | ||
3456 | case '?': | ||
3457 | p[0]++; | ||
3458 | sprintf(rs, "\r\n<%d>,<%d>", | ||
3459 | m->vpar[4], | ||
3460 | m->vpar[5]); | ||
3461 | isdn_tty_at_cout(rs, info); | ||
3452 | break; | 3462 | break; |
3453 | case 7: | 3463 | case '=': |
3454 | /* AT+VDD - DTMF detection */ | 3464 | p[0]++; |
3455 | switch (*p[0]) { | 3465 | if ((*p[0] >= '0') && (*p[0] <= '9')) { |
3456 | case '?': | 3466 | if (info->online != 1) |
3457 | p[0]++; | ||
3458 | sprintf(rs, "\r\n<%d>,<%d>", | ||
3459 | m->vpar[4], | ||
3460 | m->vpar[5]); | ||
3461 | isdn_tty_at_cout(rs, info); | ||
3462 | break; | ||
3463 | case '=': | ||
3464 | p[0]++; | ||
3465 | if ((*p[0]>='0') && (*p[0]<='9')) { | ||
3466 | if (info->online != 1) | ||
3467 | PARSE_ERROR1; | ||
3468 | par1 = isdn_getnum(p); | ||
3469 | if ((par1 < 0) || (par1 > 15)) | ||
3470 | PARSE_ERROR1; | ||
3471 | if (*p[0] != ',') | ||
3472 | PARSE_ERROR1; | ||
3473 | p[0]++; | ||
3474 | par2 = isdn_getnum(p); | ||
3475 | if ((par2 < 0) || (par2 > 255)) | ||
3476 | PARSE_ERROR1; | ||
3477 | m->vpar[4] = par1; | ||
3478 | m->vpar[5] = par2; | ||
3479 | cmd.driver = info->isdn_driver; | ||
3480 | cmd.command = ISDN_CMD_AUDIO; | ||
3481 | cmd.arg = info->isdn_channel + (ISDN_AUDIO_SETDD << 8); | ||
3482 | cmd.parm.num[0] = par1; | ||
3483 | cmd.parm.num[1] = par2; | ||
3484 | isdn_command(&cmd); | ||
3485 | break; | ||
3486 | } else | ||
3487 | if (*p[0] == '?') { | ||
3488 | p[0]++; | ||
3489 | isdn_tty_at_cout("\r\n<0-15>,<0-255>", | ||
3490 | info); | ||
3491 | break; | ||
3492 | } else | ||
3493 | PARSE_ERROR1; | 3467 | PARSE_ERROR1; |
3468 | par1 = isdn_getnum(p); | ||
3469 | if ((par1 < 0) || (par1 > 15)) | ||
3470 | PARSE_ERROR1; | ||
3471 | if (*p[0] != ',') | ||
3472 | PARSE_ERROR1; | ||
3473 | p[0]++; | ||
3474 | par2 = isdn_getnum(p); | ||
3475 | if ((par2 < 0) || (par2 > 255)) | ||
3476 | PARSE_ERROR1; | ||
3477 | m->vpar[4] = par1; | ||
3478 | m->vpar[5] = par2; | ||
3479 | cmd.driver = info->isdn_driver; | ||
3480 | cmd.command = ISDN_CMD_AUDIO; | ||
3481 | cmd.arg = info->isdn_channel + (ISDN_AUDIO_SETDD << 8); | ||
3482 | cmd.parm.num[0] = par1; | ||
3483 | cmd.parm.num[1] = par2; | ||
3484 | isdn_command(&cmd); | ||
3485 | break; | ||
3486 | } else | ||
3487 | if (*p[0] == '?') { | ||
3488 | p[0]++; | ||
3489 | isdn_tty_at_cout("\r\n<0-15>,<0-255>", | ||
3490 | info); | ||
3494 | break; | 3491 | break; |
3495 | default: | 3492 | } else |
3496 | PARSE_ERROR1; | 3493 | PARSE_ERROR1; |
3497 | } | ||
3498 | break; | 3494 | break; |
3499 | default: | 3495 | default: |
3500 | PARSE_ERROR1; | 3496 | PARSE_ERROR1; |
3497 | } | ||
3498 | break; | ||
3499 | default: | ||
3500 | PARSE_ERROR1; | ||
3501 | } | 3501 | } |
3502 | return 0; | 3502 | return 0; |
3503 | } | 3503 | } |
@@ -3507,7 +3507,7 @@ isdn_tty_cmd_PLUSV(char **p, modem_info * info) | |||
3507 | * Parse and perform an AT-command-line. | 3507 | * Parse and perform an AT-command-line. |
3508 | */ | 3508 | */ |
3509 | static void | 3509 | static void |
3510 | isdn_tty_parse_at(modem_info * info) | 3510 | isdn_tty_parse_at(modem_info *info) |
3511 | { | 3511 | { |
3512 | atemu *m = &info->emu; | 3512 | atemu *m = &info->emu; |
3513 | char *p; | 3513 | char *p; |
@@ -3518,188 +3518,188 @@ isdn_tty_parse_at(modem_info * info) | |||
3518 | #endif | 3518 | #endif |
3519 | for (p = &m->mdmcmd[2]; *p;) { | 3519 | for (p = &m->mdmcmd[2]; *p;) { |
3520 | switch (*p) { | 3520 | switch (*p) { |
3521 | case ' ': | 3521 | case ' ': |
3522 | p++; | 3522 | p++; |
3523 | break; | ||
3524 | case 'A': | ||
3525 | /* A - Accept incoming call */ | ||
3526 | p++; | ||
3527 | isdn_tty_cmd_ATA(info); | ||
3528 | return; | ||
3529 | break; | ||
3530 | case 'D': | ||
3531 | /* D - Dial */ | ||
3532 | if (info->msr & UART_MSR_DCD) | ||
3533 | PARSE_ERROR; | ||
3534 | if (info->msr & UART_MSR_RI) { | ||
3535 | isdn_tty_modem_result(RESULT_NO_CARRIER, info); | ||
3536 | return; | ||
3537 | } | ||
3538 | isdn_tty_getdial(++p, ds, sizeof ds); | ||
3539 | p += strlen(p); | ||
3540 | if (!strlen(m->msn)) | ||
3541 | isdn_tty_modem_result(RESULT_NO_MSN_EAZ, info); | ||
3542 | else if (strlen(ds)) | ||
3543 | isdn_tty_dial(ds, info, m); | ||
3544 | else | ||
3545 | PARSE_ERROR; | ||
3546 | return; | ||
3547 | case 'E': | ||
3548 | /* E - Turn Echo on/off */ | ||
3549 | p++; | ||
3550 | switch (isdn_getnum(&p)) { | ||
3551 | case 0: | ||
3552 | m->mdmreg[REG_ECHO] &= ~BIT_ECHO; | ||
3523 | break; | 3553 | break; |
3524 | case 'A': | 3554 | case 1: |
3525 | /* A - Accept incoming call */ | 3555 | m->mdmreg[REG_ECHO] |= BIT_ECHO; |
3556 | break; | ||
3557 | default: | ||
3558 | PARSE_ERROR; | ||
3559 | } | ||
3560 | break; | ||
3561 | case 'H': | ||
3562 | /* H - On/Off-hook */ | ||
3563 | p++; | ||
3564 | switch (*p) { | ||
3565 | case '0': | ||
3526 | p++; | 3566 | p++; |
3527 | isdn_tty_cmd_ATA(info); | 3567 | isdn_tty_on_hook(info); |
3528 | return; | ||
3529 | break; | 3568 | break; |
3530 | case 'D': | 3569 | case '1': |
3531 | /* D - Dial */ | ||
3532 | if (info->msr & UART_MSR_DCD) | ||
3533 | PARSE_ERROR; | ||
3534 | if (info->msr & UART_MSR_RI) { | ||
3535 | isdn_tty_modem_result(RESULT_NO_CARRIER, info); | ||
3536 | return; | ||
3537 | } | ||
3538 | isdn_tty_getdial(++p, ds, sizeof ds); | ||
3539 | p += strlen(p); | ||
3540 | if (!strlen(m->msn)) | ||
3541 | isdn_tty_modem_result(RESULT_NO_MSN_EAZ, info); | ||
3542 | else if (strlen(ds)) | ||
3543 | isdn_tty_dial(ds, info, m); | ||
3544 | else | ||
3545 | PARSE_ERROR; | ||
3546 | return; | ||
3547 | case 'E': | ||
3548 | /* E - Turn Echo on/off */ | ||
3549 | p++; | 3570 | p++; |
3550 | switch (isdn_getnum(&p)) { | 3571 | isdn_tty_off_hook(); |
3551 | case 0: | ||
3552 | m->mdmreg[REG_ECHO] &= ~BIT_ECHO; | ||
3553 | break; | ||
3554 | case 1: | ||
3555 | m->mdmreg[REG_ECHO] |= BIT_ECHO; | ||
3556 | break; | ||
3557 | default: | ||
3558 | PARSE_ERROR; | ||
3559 | } | ||
3560 | break; | 3572 | break; |
3561 | case 'H': | 3573 | default: |
3562 | /* H - On/Off-hook */ | 3574 | isdn_tty_on_hook(info); |
3575 | break; | ||
3576 | } | ||
3577 | break; | ||
3578 | case 'I': | ||
3579 | /* I - Information */ | ||
3580 | p++; | ||
3581 | isdn_tty_at_cout("\r\nLinux ISDN", info); | ||
3582 | switch (*p) { | ||
3583 | case '0': | ||
3584 | case '1': | ||
3563 | p++; | 3585 | p++; |
3564 | switch (*p) { | ||
3565 | case '0': | ||
3566 | p++; | ||
3567 | isdn_tty_on_hook(info); | ||
3568 | break; | ||
3569 | case '1': | ||
3570 | p++; | ||
3571 | isdn_tty_off_hook(); | ||
3572 | break; | ||
3573 | default: | ||
3574 | isdn_tty_on_hook(info); | ||
3575 | break; | ||
3576 | } | ||
3577 | break; | 3586 | break; |
3578 | case 'I': | 3587 | case '2': |
3579 | /* I - Information */ | ||
3580 | p++; | 3588 | p++; |
3581 | isdn_tty_at_cout("\r\nLinux ISDN", info); | 3589 | isdn_tty_report(info); |
3582 | switch (*p) { | ||
3583 | case '0': | ||
3584 | case '1': | ||
3585 | p++; | ||
3586 | break; | ||
3587 | case '2': | ||
3588 | p++; | ||
3589 | isdn_tty_report(info); | ||
3590 | break; | ||
3591 | case '3': | ||
3592 | p++; | ||
3593 | snprintf(ds, sizeof(ds), "\r\n%d", info->emu.charge); | ||
3594 | isdn_tty_at_cout(ds, info); | ||
3595 | break; | ||
3596 | default:; | ||
3597 | } | ||
3598 | break; | 3590 | break; |
3599 | #ifdef DUMMY_HAYES_AT | 3591 | case '3': |
3600 | case 'L': | ||
3601 | case 'M': | ||
3602 | /* only for be compilant with common scripts */ | ||
3603 | /* no function */ | ||
3604 | p++; | 3592 | p++; |
3605 | isdn_getnum(&p); | 3593 | snprintf(ds, sizeof(ds), "\r\n%d", info->emu.charge); |
3594 | isdn_tty_at_cout(ds, info); | ||
3606 | break; | 3595 | break; |
3596 | default:; | ||
3597 | } | ||
3598 | break; | ||
3599 | #ifdef DUMMY_HAYES_AT | ||
3600 | case 'L': | ||
3601 | case 'M': | ||
3602 | /* only for be compilant with common scripts */ | ||
3603 | /* no function */ | ||
3604 | p++; | ||
3605 | isdn_getnum(&p); | ||
3606 | break; | ||
3607 | #endif | 3607 | #endif |
3608 | case 'O': | 3608 | case 'O': |
3609 | /* O - Go online */ | 3609 | /* O - Go online */ |
3610 | p++; | 3610 | p++; |
3611 | if (info->msr & UART_MSR_DCD) | 3611 | if (info->msr & UART_MSR_DCD) |
3612 | /* if B-Channel is up */ | 3612 | /* if B-Channel is up */ |
3613 | isdn_tty_modem_result((m->mdmreg[REG_L2PROT] == ISDN_PROTO_L2_MODEM) ? RESULT_CONNECT:RESULT_CONNECT64000, info); | 3613 | isdn_tty_modem_result((m->mdmreg[REG_L2PROT] == ISDN_PROTO_L2_MODEM) ? RESULT_CONNECT : RESULT_CONNECT64000, info); |
3614 | else | 3614 | else |
3615 | isdn_tty_modem_result(RESULT_NO_CARRIER, info); | 3615 | isdn_tty_modem_result(RESULT_NO_CARRIER, info); |
3616 | return; | ||
3617 | case 'Q': | ||
3618 | /* Q - Turn Emulator messages on/off */ | ||
3619 | p++; | ||
3620 | switch (isdn_getnum(&p)) { | ||
3621 | case 0: | ||
3622 | m->mdmreg[REG_RESP] |= BIT_RESP; | ||
3623 | break; | ||
3624 | case 1: | ||
3625 | m->mdmreg[REG_RESP] &= ~BIT_RESP; | ||
3626 | break; | ||
3627 | default: | ||
3628 | PARSE_ERROR; | ||
3629 | } | ||
3630 | break; | ||
3631 | case 'S': | ||
3632 | /* S - Set/Get Register */ | ||
3633 | p++; | ||
3634 | if (isdn_tty_cmd_ATS(&p, info)) | ||
3616 | return; | 3635 | return; |
3617 | case 'Q': | 3636 | break; |
3618 | /* Q - Turn Emulator messages on/off */ | 3637 | case 'V': |
3619 | p++; | 3638 | /* V - Numeric or ASCII Emulator-messages */ |
3620 | switch (isdn_getnum(&p)) { | 3639 | p++; |
3621 | case 0: | 3640 | switch (isdn_getnum(&p)) { |
3622 | m->mdmreg[REG_RESP] |= BIT_RESP; | 3641 | case 0: |
3623 | break; | 3642 | m->mdmreg[REG_RESP] |= BIT_RESPNUM; |
3624 | case 1: | 3643 | break; |
3625 | m->mdmreg[REG_RESP] &= ~BIT_RESP; | 3644 | case 1: |
3626 | break; | 3645 | m->mdmreg[REG_RESP] &= ~BIT_RESPNUM; |
3627 | default: | ||
3628 | PARSE_ERROR; | ||
3629 | } | ||
3630 | break; | 3646 | break; |
3631 | case 'S': | 3647 | default: |
3632 | /* S - Set/Get Register */ | 3648 | PARSE_ERROR; |
3649 | } | ||
3650 | break; | ||
3651 | case 'Z': | ||
3652 | /* Z - Load Registers from Profile */ | ||
3653 | p++; | ||
3654 | if (info->msr & UART_MSR_DCD) { | ||
3655 | info->online = 0; | ||
3656 | isdn_tty_on_hook(info); | ||
3657 | } | ||
3658 | isdn_tty_modem_reset_regs(info, 1); | ||
3659 | break; | ||
3660 | case '+': | ||
3661 | p++; | ||
3662 | switch (*p) { | ||
3663 | #ifdef CONFIG_ISDN_AUDIO | ||
3664 | case 'F': | ||
3633 | p++; | 3665 | p++; |
3634 | if (isdn_tty_cmd_ATS(&p, info)) | 3666 | if (isdn_tty_cmd_PLUSF(&p, info)) |
3635 | return; | 3667 | return; |
3636 | break; | 3668 | break; |
3637 | case 'V': | 3669 | case 'V': |
3638 | /* V - Numeric or ASCII Emulator-messages */ | 3670 | if ((!(m->mdmreg[REG_SI1] & 1)) || |
3671 | (m->mdmreg[REG_L2PROT] == ISDN_PROTO_L2_MODEM)) | ||
3672 | PARSE_ERROR; | ||
3639 | p++; | 3673 | p++; |
3640 | switch (isdn_getnum(&p)) { | 3674 | if (isdn_tty_cmd_PLUSV(&p, info)) |
3641 | case 0: | 3675 | return; |
3642 | m->mdmreg[REG_RESP] |= BIT_RESPNUM; | ||
3643 | break; | ||
3644 | case 1: | ||
3645 | m->mdmreg[REG_RESP] &= ~BIT_RESPNUM; | ||
3646 | break; | ||
3647 | default: | ||
3648 | PARSE_ERROR; | ||
3649 | } | ||
3650 | break; | 3676 | break; |
3651 | case 'Z': | 3677 | #endif /* CONFIG_ISDN_AUDIO */ |
3652 | /* Z - Load Registers from Profile */ | 3678 | case 'S': /* SUSPEND */ |
3653 | p++; | 3679 | p++; |
3654 | if (info->msr & UART_MSR_DCD) { | 3680 | isdn_tty_get_msnstr(ds, &p); |
3655 | info->online = 0; | 3681 | isdn_tty_suspend(ds, info, m); |
3656 | isdn_tty_on_hook(info); | ||
3657 | } | ||
3658 | isdn_tty_modem_reset_regs(info, 1); | ||
3659 | break; | 3682 | break; |
3660 | case '+': | 3683 | case 'R': /* RESUME */ |
3661 | p++; | 3684 | p++; |
3662 | switch (*p) { | 3685 | isdn_tty_get_msnstr(ds, &p); |
3663 | #ifdef CONFIG_ISDN_AUDIO | 3686 | isdn_tty_resume(ds, info, m); |
3664 | case 'F': | ||
3665 | p++; | ||
3666 | if (isdn_tty_cmd_PLUSF(&p, info)) | ||
3667 | return; | ||
3668 | break; | ||
3669 | case 'V': | ||
3670 | if ((!(m->mdmreg[REG_SI1] & 1)) || | ||
3671 | (m->mdmreg[REG_L2PROT] == ISDN_PROTO_L2_MODEM)) | ||
3672 | PARSE_ERROR; | ||
3673 | p++; | ||
3674 | if (isdn_tty_cmd_PLUSV(&p, info)) | ||
3675 | return; | ||
3676 | break; | ||
3677 | #endif /* CONFIG_ISDN_AUDIO */ | ||
3678 | case 'S': /* SUSPEND */ | ||
3679 | p++; | ||
3680 | isdn_tty_get_msnstr(ds, &p); | ||
3681 | isdn_tty_suspend(ds, info, m); | ||
3682 | break; | ||
3683 | case 'R': /* RESUME */ | ||
3684 | p++; | ||
3685 | isdn_tty_get_msnstr(ds, &p); | ||
3686 | isdn_tty_resume(ds, info, m); | ||
3687 | break; | ||
3688 | case 'M': /* MESSAGE */ | ||
3689 | p++; | ||
3690 | isdn_tty_send_msg(info, m, p); | ||
3691 | break; | ||
3692 | default: | ||
3693 | PARSE_ERROR; | ||
3694 | } | ||
3695 | break; | 3687 | break; |
3696 | case '&': | 3688 | case 'M': /* MESSAGE */ |
3697 | p++; | 3689 | p++; |
3698 | if (isdn_tty_cmd_ATand(&p, info)) | 3690 | isdn_tty_send_msg(info, m, p); |
3699 | return; | ||
3700 | break; | 3691 | break; |
3701 | default: | 3692 | default: |
3702 | PARSE_ERROR; | 3693 | PARSE_ERROR; |
3694 | } | ||
3695 | break; | ||
3696 | case '&': | ||
3697 | p++; | ||
3698 | if (isdn_tty_cmd_ATand(&p, info)) | ||
3699 | return; | ||
3700 | break; | ||
3701 | default: | ||
3702 | PARSE_ERROR; | ||
3703 | } | 3703 | } |
3704 | } | 3704 | } |
3705 | #ifdef CONFIG_ISDN_AUDIO | 3705 | #ifdef CONFIG_ISDN_AUDIO |
@@ -3711,7 +3711,7 @@ isdn_tty_parse_at(modem_info * info) | |||
3711 | /* Need own toupper() because standard-toupper is not available | 3711 | /* Need own toupper() because standard-toupper is not available |
3712 | * within modules. | 3712 | * within modules. |
3713 | */ | 3713 | */ |
3714 | #define my_toupper(c) (((c>='a')&&(c<='z'))?(c&0xdf):c) | 3714 | #define my_toupper(c) (((c >= 'a') && (c <= 'z')) ? (c & 0xdf) : c) |
3715 | 3715 | ||
3716 | /* | 3716 | /* |
3717 | * Perform line-editing of AT-commands | 3717 | * Perform line-editing of AT-commands |
@@ -3722,7 +3722,7 @@ isdn_tty_parse_at(modem_info * info) | |||
3722 | * channel index to line (minor-device) | 3722 | * channel index to line (minor-device) |
3723 | */ | 3723 | */ |
3724 | static int | 3724 | static int |
3725 | isdn_tty_edit_at(const char *p, int count, modem_info * info) | 3725 | isdn_tty_edit_at(const char *p, int count, modem_info *info) |
3726 | { | 3726 | { |
3727 | atemu *m = &info->emu; | 3727 | atemu *m = &info->emu; |
3728 | int total = 0; | 3728 | int total = 0; |
@@ -3765,23 +3765,23 @@ isdn_tty_edit_at(const char *p, int count, modem_info * info) | |||
3765 | if (m->mdmcmdl < 255) { | 3765 | if (m->mdmcmdl < 255) { |
3766 | c = my_toupper(c); | 3766 | c = my_toupper(c); |
3767 | switch (m->mdmcmdl) { | 3767 | switch (m->mdmcmdl) { |
3768 | case 1: | 3768 | case 1: |
3769 | if (c == 'T') { | 3769 | if (c == 'T') { |
3770 | m->mdmcmd[m->mdmcmdl] = c; | 3770 | m->mdmcmd[m->mdmcmdl] = c; |
3771 | m->mdmcmd[++m->mdmcmdl] = 0; | 3771 | m->mdmcmd[++m->mdmcmdl] = 0; |
3772 | break; | ||
3773 | } else | ||
3774 | m->mdmcmdl = 0; | ||
3775 | /* Fall through, check for 'A' */ | ||
3776 | case 0: | ||
3777 | if (c == 'A') { | ||
3778 | m->mdmcmd[m->mdmcmdl] = c; | ||
3779 | m->mdmcmd[++m->mdmcmdl] = 0; | ||
3780 | } | ||
3781 | break; | 3772 | break; |
3782 | default: | 3773 | } else |
3774 | m->mdmcmdl = 0; | ||
3775 | /* Fall through, check for 'A' */ | ||
3776 | case 0: | ||
3777 | if (c == 'A') { | ||
3783 | m->mdmcmd[m->mdmcmdl] = c; | 3778 | m->mdmcmd[m->mdmcmdl] = c; |
3784 | m->mdmcmd[++m->mdmcmdl] = 0; | 3779 | m->mdmcmd[++m->mdmcmdl] = 0; |
3780 | } | ||
3781 | break; | ||
3782 | default: | ||
3783 | m->mdmcmd[m->mdmcmdl] = c; | ||
3784 | m->mdmcmd[++m->mdmcmdl] = 0; | ||
3785 | } | 3785 | } |
3786 | } | 3786 | } |
3787 | } | 3787 | } |