]>
git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - drivers/isdn/i4l/isdn_ttyfax.c
1 /* $Id: isdn_ttyfax.c,v 1.1.2.2 2004/01/12 22:37:19 keil Exp $
3 * Linux ISDN subsystem, tty_fax AT-command emulator (linklevel).
5 * Copyright 1999 by Armin Schindler (mac@melware.de)
6 * Copyright 1999 by Ralf Spachmann (mel@melware.de)
7 * Copyright 1999 by Cytronics & Melware
9 * This software may be used and distributed according to the terms
10 * of the GNU General Public License, incorporated herein by reference.
14 #undef ISDN_TTY_FAX_STAT_DEBUG
15 #undef ISDN_TTY_FAX_CMD_DEBUG
17 #include <linux/isdn.h>
18 #include "isdn_common.h"
20 #include "isdn_ttyfax.h"
23 static char *isdn_tty_fax_revision
= "$Revision: 1.1.2.2 $";
25 #define PARSE_ERROR1 { isdn_tty_fax_modem_result(1, info); return 1; }
28 isdn_getrev(const char *revision
)
33 if ((p
= strchr(revision
, ':'))) {
43 * Fax Class 2 Modem results
48 isdn_tty_fax_modem_result(int code
, modem_info
*info
)
50 atemu
*m
= &info
->emu
;
57 {"OK", "ERROR", "+FCON", "+FCSI:", "+FDIS:",
58 "+FHNG:", "+FDCS:", "CONNECT", "+FTSI:",
59 "+FCFR", "+FPTS:", "+FET:"};
62 isdn_tty_at_cout("\r\n", info
);
63 isdn_tty_at_cout(msg
[code
], info
);
65 #ifdef ISDN_TTY_FAX_CMD_DEBUG
66 printk(KERN_DEBUG
"isdn_tty: Fax send %s on ttyI%d\n",
67 msg
[code
], info
->line
);
75 /* Append CPN, if enabled */
76 if ((m
->mdmreg
[REG_CPNFCON
] & BIT_CPNFCON
) &&
77 (!(dev
->usage
[info
->isdn_channel
] & ISDN_USAGE_OUTGOING
))) {
78 sprintf(rs
, "/%s", m
->cpn
);
79 isdn_tty_at_cout(rs
, info
);
83 if (f
->phase
== ISDN_FAX_PHASE_A
)
84 f
->phase
= ISDN_FAX_PHASE_B
;
88 sprintf(rs
, "\"%s\"", f
->r_id
);
89 isdn_tty_at_cout(rs
, info
);
93 rp
= &f
->r_resolution
;
94 for (i
= 0; i
< 8; i
++) {
95 sprintf(rss
, "%c%s", rp
[i
] + 48,
99 isdn_tty_at_cout(rs
, info
);
100 #ifdef ISDN_TTY_FAX_CMD_DEBUG
101 printk(KERN_DEBUG
"isdn_tty: Fax DIS=%s on ttyI%d\n",
106 sprintf(rs
, "%d", f
->code
);
107 isdn_tty_at_cout(rs
, info
);
112 rp
= &f
->r_resolution
;
113 for (i
= 0; i
< 8; i
++) {
114 sprintf(rss
, "%c%s", rp
[i
] + 48,
118 isdn_tty_at_cout(rs
, info
);
119 #ifdef ISDN_TTY_FAX_CMD_DEBUG
120 printk(KERN_DEBUG
"isdn_tty: Fax DCS=%s on ttyI%d\n",
124 case 7: /* CONNECT */
125 info
->faxonline
|= 2;
130 isdn_tty_at_cout("1", info
);
133 sprintf(rs
, "%d", f
->fet
);
134 isdn_tty_at_cout(rs
, info
);
138 isdn_tty_at_cout("\r\n", info
);
141 case 7: /* CONNECT */
143 if (info
->faxonline
& 1) {
144 sprintf(rs
, "%c", XON
);
145 isdn_tty_at_cout(rs
, info
);
152 isdn_tty_fax_command1(modem_info
*info
, isdn_ctrl
*c
)
155 {"OK", "CONNECT", "NO CARRIER", "ERROR", "FCERROR"};
157 #ifdef ISDN_TTY_FAX_CMD_DEBUG
158 printk(KERN_DEBUG
"isdn_tty: FCLASS1 cmd(%d)\n", c
->parm
.aux
.cmd
);
160 if (c
->parm
.aux
.cmd
< ISDN_FAX_CLASS1_QUERY
) {
163 isdn_tty_at_cout("\r\n", info
);
164 isdn_tty_at_cout(msg
[c
->parm
.aux
.cmd
], info
);
165 isdn_tty_at_cout("\r\n", info
);
167 switch (c
->parm
.aux
.cmd
) {
168 case ISDN_FAX_CLASS1_CONNECT
:
171 case ISDN_FAX_CLASS1_OK
:
172 case ISDN_FAX_CLASS1_FCERROR
:
173 case ISDN_FAX_CLASS1_ERROR
:
174 case ISDN_FAX_CLASS1_NOCARR
:
176 case ISDN_FAX_CLASS1_QUERY
:
177 isdn_tty_at_cout("\r\n", info
);
178 if (!c
->parm
.aux
.para
[0]) {
179 isdn_tty_at_cout(msg
[ISDN_FAX_CLASS1_ERROR
], info
);
180 isdn_tty_at_cout("\r\n", info
);
182 isdn_tty_at_cout(c
->parm
.aux
.para
, info
);
183 isdn_tty_at_cout("\r\nOK\r\n", info
);
191 isdn_tty_fax_command(modem_info
*info
, isdn_ctrl
*c
)
193 T30_s
*f
= info
->fax
;
196 if (TTY_IS_FCLASS1(info
))
197 return (isdn_tty_fax_command1(info
, c
));
199 #ifdef ISDN_TTY_FAX_CMD_DEBUG
200 printk(KERN_DEBUG
"isdn_tty: Fax cmd %d on ttyI%d\n",
201 f
->r_code
, info
->line
);
204 case ISDN_TTY_FAX_FCON
:
206 isdn_tty_fax_modem_result(2, info
); /* +FCON */
208 case ISDN_TTY_FAX_FCON_I
:
209 info
->faxonline
= 16;
210 isdn_tty_fax_modem_result(2, info
); /* +FCON */
212 case ISDN_TTY_FAX_RID
:
213 if (info
->faxonline
& 1)
214 isdn_tty_fax_modem_result(3, info
); /* +FCSI */
215 if (info
->faxonline
& 16)
216 isdn_tty_fax_modem_result(8, info
); /* +FTSI */
218 case ISDN_TTY_FAX_DIS
:
219 isdn_tty_fax_modem_result(4, info
); /* +FDIS */
221 case ISDN_TTY_FAX_HNG
:
222 if (f
->phase
== ISDN_FAX_PHASE_C
) {
223 if (f
->direction
== ISDN_TTY_FAX_CONN_IN
) {
224 sprintf(rs
, "%c%c", DLE
, ETX
);
225 isdn_tty_at_cout(rs
, info
);
227 sprintf(rs
, "%c", 0x18);
228 isdn_tty_at_cout(rs
, info
);
230 info
->faxonline
&= ~2; /* leave data mode */
233 f
->phase
= ISDN_FAX_PHASE_E
;
234 isdn_tty_fax_modem_result(5, info
); /* +FHNG */
235 isdn_tty_fax_modem_result(0, info
); /* OK */
237 case ISDN_TTY_FAX_DCS
:
238 isdn_tty_fax_modem_result(6, info
); /* +FDCS */
239 isdn_tty_fax_modem_result(7, info
); /* CONNECT */
240 f
->phase
= ISDN_FAX_PHASE_C
;
242 case ISDN_TTY_FAX_TRAIN_OK
:
243 isdn_tty_fax_modem_result(6, info
); /* +FDCS */
244 isdn_tty_fax_modem_result(0, info
); /* OK */
246 case ISDN_TTY_FAX_SENT
:
247 isdn_tty_fax_modem_result(0, info
); /* OK */
249 case ISDN_TTY_FAX_CFR
:
250 isdn_tty_fax_modem_result(9, info
); /* +FCFR */
252 case ISDN_TTY_FAX_ET
:
253 sprintf(rs
, "%c%c", DLE
, ETX
);
254 isdn_tty_at_cout(rs
, info
);
255 isdn_tty_fax_modem_result(10, info
); /* +FPTS */
256 isdn_tty_fax_modem_result(11, info
); /* +FET */
257 isdn_tty_fax_modem_result(0, info
); /* OK */
258 info
->faxonline
&= ~2; /* leave data mode */
260 f
->phase
= ISDN_FAX_PHASE_D
;
262 case ISDN_TTY_FAX_PTS
:
263 isdn_tty_fax_modem_result(10, info
); /* +FPTS */
264 if (f
->direction
== ISDN_TTY_FAX_CONN_OUT
) {
266 f
->phase
= ISDN_FAX_PHASE_B
;
268 isdn_tty_fax_modem_result(0, info
); /* OK */
271 case ISDN_TTY_FAX_EOP
:
272 info
->faxonline
&= ~2; /* leave data mode */
274 f
->phase
= ISDN_FAX_PHASE_D
;
283 isdn_tty_fax_bitorder(modem_info
*info
, struct sk_buff
*skb
)
291 if (!info
->fax
->bor
) {
292 for (i
= 0; i
< skb
->len
; i
++) {
295 LeftMask
= 0x80, RightMask
= 0x01;
296 LeftMask
> RightMask
;
297 LeftMask
>>= 1, RightMask
<<= 1
299 fBit
= (Data
& LeftMask
);
300 if (Data
& RightMask
)
316 * Parse AT+F.. FAX class 1 commands
320 isdn_tty_cmd_FCLASS1(char **p
, modem_info
*info
)
323 {"AE", "TS", "RS", "TM", "RM", "TH", "RH"};
328 for (c
.parm
.aux
.cmd
= 0; c
.parm
.aux
.cmd
< 7; c
.parm
.aux
.cmd
++)
329 if (!strncmp(p
[0], cmd
[c
.parm
.aux
.cmd
], 2))
332 #ifdef ISDN_TTY_FAX_CMD_DEBUG
333 printk(KERN_DEBUG
"isdn_tty_cmd_FCLASS1 (%s,%d)\n", p
[0], c
.parm
.aux
.cmd
);
335 if (c
.parm
.aux
.cmd
== 7)
342 c
.parm
.aux
.subcmd
= AT_QUERY
;
348 c
.parm
.aux
.subcmd
= AT_EQ_QUERY
;
350 par
= isdn_getnum(p
);
351 if ((par
< 0) || (par
> 255))
353 c
.parm
.aux
.subcmd
= AT_EQ_VALUE
;
354 c
.parm
.aux
.para
[0] = par
;
358 c
.parm
.aux
.subcmd
= AT_COMMAND
;
363 c
.command
= ISDN_CMD_FAXCMD
;
364 #ifdef ISDN_TTY_FAX_CMD_DEBUG
365 printk(KERN_DEBUG
"isdn_tty_cmd_FCLASS1 %d/%d/%d)\n",
366 c
.parm
.aux
.cmd
, c
.parm
.aux
.subcmd
, c
.parm
.aux
.para
[0]);
368 if (info
->isdn_driver
< 0) {
369 if ((c
.parm
.aux
.subcmd
== AT_EQ_VALUE
) ||
370 (c
.parm
.aux
.subcmd
== AT_COMMAND
)) {
373 spin_lock_irqsave(&dev
->lock
, flags
);
374 /* get a temporary connection to the first free fax driver */
375 i
= isdn_get_free_channel(ISDN_USAGE_FAX
, ISDN_PROTO_L2_FAX
,
376 ISDN_PROTO_L3_FCLASS1
, -1, -1, "00");
378 spin_unlock_irqrestore(&dev
->lock
, flags
);
381 info
->isdn_driver
= dev
->drvmap
[i
];
382 info
->isdn_channel
= dev
->chanmap
[i
];
384 dev
->m_idx
[i
] = info
->line
;
385 spin_unlock_irqrestore(&dev
->lock
, flags
);
386 c
.driver
= info
->isdn_driver
;
387 c
.arg
= info
->isdn_channel
;
389 spin_lock_irqsave(&dev
->lock
, flags
);
390 isdn_free_channel(info
->isdn_driver
, info
->isdn_channel
,
392 info
->isdn_driver
= -1;
393 info
->isdn_channel
= -1;
394 if (info
->drv_index
>= 0) {
395 dev
->m_idx
[info
->drv_index
] = -1;
396 info
->drv_index
= -1;
398 spin_unlock_irqrestore(&dev
->lock
, flags
);
400 c
.driver
= info
->isdn_driver
;
401 c
.arg
= info
->isdn_channel
;
408 * Parse AT+F.. FAX class 2 commands
412 isdn_tty_cmd_FCLASS2(char **p
, modem_info
*info
)
414 atemu
*m
= &info
->emu
;
415 T30_s
*f
= info
->fax
;
421 {1, 5, 2, 2, 3, 2, 0, 7};
423 /* FAA still unchanged */
424 if (!strncmp(p
[0], "AA", 2)) { /* TODO */
429 sprintf(rs
, "\r\n%d", 0);
430 isdn_tty_at_cout(rs
, info
);
434 par
= isdn_getnum(p
);
435 if ((par
< 0) || (par
> 255))
443 /* BADLIN=value - dummy 0=disable errorchk disabled, 1-255 nr. of lines for making page bad */
444 if (!strncmp(p
[0], "BADLIN", 6)) {
449 sprintf(rs
, "\r\n%d", f
->badlin
);
450 isdn_tty_at_cout(rs
, info
);
456 sprintf(rs
, "\r\n0-255");
457 isdn_tty_at_cout(rs
, info
);
459 par
= isdn_getnum(p
);
460 if ((par
< 0) || (par
> 255))
463 #ifdef ISDN_TTY_FAX_STAT_DEBUG
464 printk(KERN_DEBUG
"isdn_tty: Fax FBADLIN=%d\n", par
);
473 /* BADMUL=value - dummy 0=disable errorchk disabled (threshold multiplier) */
474 if (!strncmp(p
[0], "BADMUL", 6)) {
479 sprintf(rs
, "\r\n%d", f
->badmul
);
480 isdn_tty_at_cout(rs
, info
);
486 sprintf(rs
, "\r\n0-255");
487 isdn_tty_at_cout(rs
, info
);
489 par
= isdn_getnum(p
);
490 if ((par
< 0) || (par
> 255))
493 #ifdef ISDN_TTY_FAX_STAT_DEBUG
494 printk(KERN_DEBUG
"isdn_tty: Fax FBADMUL=%d\n", par
);
503 /* BOR=n - Phase C bit order, 0=direct, 1=reverse */
504 if (!strncmp(p
[0], "BOR", 3)) {
509 sprintf(rs
, "\r\n%d", f
->bor
);
510 isdn_tty_at_cout(rs
, info
);
516 sprintf(rs
, "\r\n0,1");
517 isdn_tty_at_cout(rs
, info
);
519 par
= isdn_getnum(p
);
520 if ((par
< 0) || (par
> 1))
523 #ifdef ISDN_TTY_FAX_STAT_DEBUG
524 printk(KERN_DEBUG
"isdn_tty: Fax FBOR=%d\n", par
);
533 /* NBC=n - No Best Capabilities */
534 if (!strncmp(p
[0], "NBC", 3)) {
539 sprintf(rs
, "\r\n%d", f
->nbc
);
540 isdn_tty_at_cout(rs
, info
);
546 sprintf(rs
, "\r\n0,1");
547 isdn_tty_at_cout(rs
, info
);
549 par
= isdn_getnum(p
);
550 if ((par
< 0) || (par
> 1))
553 #ifdef ISDN_TTY_FAX_STAT_DEBUG
554 printk(KERN_DEBUG
"isdn_tty: Fax FNBC=%d\n", par
);
563 /* BUF? - Readonly buffersize readout */
564 if (!strncmp(p
[0], "BUF?", 4)) {
566 #ifdef ISDN_TTY_FAX_STAT_DEBUG
567 printk(KERN_DEBUG
"isdn_tty: Fax FBUF? (%d) \n", (16 * m
->mdmreg
[REG_PSIZE
]));
570 sprintf(rs
, "\r\n %d ", (16 * m
->mdmreg
[REG_PSIZE
]));
571 isdn_tty_at_cout(rs
, info
);
574 /* CIG=string - local fax station id string for polling rx */
575 if (!strncmp(p
[0], "CIG", 3)) {
581 sprintf(rs
, "\r\n\"%s\"", f
->pollid
);
582 isdn_tty_at_cout(rs
, info
);
588 sprintf(rs
, "\r\n\"STRING\"");
589 isdn_tty_at_cout(rs
, info
);
593 for (i
= 0; (*p
[0]) && i
< (FAXIDLEN
- 1) && (*p
[0] != '"'); i
++) {
594 f
->pollid
[i
] = *p
[0]++;
598 for (r
= i
; r
< FAXIDLEN
; r
++) {
601 f
->pollid
[FAXIDLEN
- 1] = 0;
602 #ifdef ISDN_TTY_FAX_STAT_DEBUG
603 printk(KERN_DEBUG
"isdn_tty: Fax local poll ID rx \"%s\"\n", f
->pollid
);
612 /* CQ=n - copy qlty chk, 0= no chk, 1=only 1D chk, 2=1D+2D chk */
613 if (!strncmp(p
[0], "CQ", 2)) {
618 sprintf(rs
, "\r\n%d", f
->cq
);
619 isdn_tty_at_cout(rs
, info
);
625 sprintf(rs
, "\r\n0,1,2");
626 isdn_tty_at_cout(rs
, info
);
628 par
= isdn_getnum(p
);
629 if ((par
< 0) || (par
> 2))
632 #ifdef ISDN_TTY_FAX_STAT_DEBUG
633 printk(KERN_DEBUG
"isdn_tty: Fax FCQ=%d\n", par
);
642 /* CR=n - can receive? 0= no data rx or poll remote dev, 1=do receive data or poll remote dev */
643 if (!strncmp(p
[0], "CR", 2)) {
648 sprintf(rs
, "\r\n%d", f
->cr
); /* read actual value from struct and print */
649 isdn_tty_at_cout(rs
, info
);
655 sprintf(rs
, "\r\n0,1"); /* display online help */
656 isdn_tty_at_cout(rs
, info
);
658 par
= isdn_getnum(p
);
659 if ((par
< 0) || (par
> 1))
662 #ifdef ISDN_TTY_FAX_STAT_DEBUG
663 printk(KERN_DEBUG
"isdn_tty: Fax FCR=%d\n", par
);
672 /* CTCRTY=value - ECM retry count */
673 if (!strncmp(p
[0], "CTCRTY", 6)) {
678 sprintf(rs
, "\r\n%d", f
->ctcrty
);
679 isdn_tty_at_cout(rs
, info
);
685 sprintf(rs
, "\r\n0-255");
686 isdn_tty_at_cout(rs
, info
);
688 par
= isdn_getnum(p
);
689 if ((par
< 0) || (par
> 255))
692 #ifdef ISDN_TTY_FAX_STAT_DEBUG
693 printk(KERN_DEBUG
"isdn_tty: Fax FCTCRTY=%d\n", par
);
702 /* DCC=vr,br,wd,ln,df,ec,bf,st - DCE capabilities parms */
703 if (!strncmp(p
[0], "DCC", 3)) {
704 char *rp
= &f
->resolution
;
712 for (i
= 0; i
< 8; i
++) {
713 sprintf(rss
, "%c%s", rp
[i
] + 48,
717 isdn_tty_at_cout(rs
, info
);
722 isdn_tty_at_cout("\r\n(0,1),(0-5),(0-2),(0-2),(0-3),(0-2),(0),(0-7)", info
);
725 for (i
= 0; (((*p
[0] >= '0') && (*p
[0] <= '9')) || (*p
[0] == ',')) && (i
< 8); i
++) {
727 if ((*p
[0] - 48) > maxdccval
[i
]) {
737 #ifdef ISDN_TTY_FAX_STAT_DEBUG
738 printk(KERN_DEBUG
"isdn_tty: Fax FDCC capabilities DCE=%d,%d,%d,%d,%d,%d,%d,%d\n",
739 rp
[0], rp
[1], rp
[2], rp
[3], rp
[4], rp
[5], rp
[6], rp
[7]);
748 /* DIS=vr,br,wd,ln,df,ec,bf,st - current session parms */
749 if (!strncmp(p
[0], "DIS", 3)) {
750 char *rp
= &f
->resolution
;
758 for (i
= 0; i
< 8; i
++) {
759 sprintf(rss
, "%c%s", rp
[i
] + 48,
763 isdn_tty_at_cout(rs
, info
);
768 isdn_tty_at_cout("\r\n(0,1),(0-5),(0-2),(0-2),(0-3),(0-2),(0),(0-7)", info
);
771 for (i
= 0; (((*p
[0] >= '0') && (*p
[0] <= '9')) || (*p
[0] == ',')) && (i
< 8); i
++) {
773 if ((*p
[0] - 48) > maxdccval
[i
]) {
783 #ifdef ISDN_TTY_FAX_STAT_DEBUG
784 printk(KERN_DEBUG
"isdn_tty: Fax FDIS session parms=%d,%d,%d,%d,%d,%d,%d,%d\n",
785 rp
[0], rp
[1], rp
[2], rp
[3], rp
[4], rp
[5], rp
[6], rp
[7]);
794 /* DR - Receive Phase C data command, initiates document reception */
795 if (!strncmp(p
[0], "DR", 2)) {
797 if ((info
->faxonline
& 16) && /* incoming connection */
798 ((f
->phase
== ISDN_FAX_PHASE_B
) || (f
->phase
== ISDN_FAX_PHASE_D
))) {
799 #ifdef ISDN_TTY_FAX_STAT_DEBUG
800 printk(KERN_DEBUG
"isdn_tty: Fax FDR\n");
802 f
->code
= ISDN_TTY_FAX_DR
;
803 cmd
.driver
= info
->isdn_driver
;
804 cmd
.arg
= info
->isdn_channel
;
805 cmd
.command
= ISDN_CMD_FAXCMD
;
807 if (f
->phase
== ISDN_FAX_PHASE_B
) {
808 f
->phase
= ISDN_FAX_PHASE_C
;
809 } else if (f
->phase
== ISDN_FAX_PHASE_D
) {
811 case 0: /* next page will be received */
812 f
->phase
= ISDN_FAX_PHASE_C
;
813 isdn_tty_fax_modem_result(7, info
); /* CONNECT */
815 case 1: /* next doc will be received */
816 f
->phase
= ISDN_FAX_PHASE_B
;
818 case 2: /* fax session is terminating */
819 f
->phase
= ISDN_FAX_PHASE_E
;
830 /* DT=df,vr,wd,ln - TX phase C data command (release DCE to proceed with negotiation) */
831 if (!strncmp(p
[0], "DT", 2)) {
834 char *rp
= &f
->resolution
;
837 if (!(info
->faxonline
& 1)) /* not outgoing connection */
840 for (i
= 0; (((*p
[0] >= '0') && (*p
[0] <= '9')) || (*p
[0] == ',')) && (i
< 4); i
++) {
842 if ((*p
[0] - 48) > maxdccval
[val
[i
]]) {
845 rp
[val
[i
]] = *p
[0] - 48;
852 #ifdef ISDN_TTY_FAX_STAT_DEBUG
853 printk(KERN_DEBUG
"isdn_tty: Fax FDT tx data command parms=%d,%d,%d,%d\n",
854 rp
[4], rp
[0], rp
[2], rp
[3]);
856 if ((f
->phase
== ISDN_FAX_PHASE_B
) || (f
->phase
== ISDN_FAX_PHASE_D
)) {
857 f
->code
= ISDN_TTY_FAX_DT
;
858 cmd
.driver
= info
->isdn_driver
;
859 cmd
.arg
= info
->isdn_channel
;
860 cmd
.command
= ISDN_CMD_FAXCMD
;
862 if (f
->phase
== ISDN_FAX_PHASE_D
) {
863 f
->phase
= ISDN_FAX_PHASE_C
;
864 isdn_tty_fax_modem_result(7, info
); /* CONNECT */
871 /* ECM=n - Error mode control 0=disabled, 2=enabled, handled by DCE alone incl. buff of partial pages */
872 if (!strncmp(p
[0], "ECM", 3)) {
877 sprintf(rs
, "\r\n%d", f
->ecm
);
878 isdn_tty_at_cout(rs
, info
);
884 sprintf(rs
, "\r\n0,2");
885 isdn_tty_at_cout(rs
, info
);
887 par
= isdn_getnum(p
);
888 if ((par
!= 0) && (par
!= 2))
891 #ifdef ISDN_TTY_FAX_STAT_DEBUG
892 printk(KERN_DEBUG
"isdn_tty: Fax FECM=%d\n", par
);
901 /* ET=n - End of page or document */
902 if (!strncmp(p
[0], "ET=", 3)) {
906 sprintf(rs
, "\r\n0-2");
907 isdn_tty_at_cout(rs
, info
);
909 if ((f
->phase
!= ISDN_FAX_PHASE_D
) ||
910 (!(info
->faxonline
& 1)))
912 par
= isdn_getnum(p
);
913 if ((par
< 0) || (par
> 2))
916 f
->code
= ISDN_TTY_FAX_ET
;
917 cmd
.driver
= info
->isdn_driver
;
918 cmd
.arg
= info
->isdn_channel
;
919 cmd
.command
= ISDN_CMD_FAXCMD
;
921 #ifdef ISDN_TTY_FAX_STAT_DEBUG
922 printk(KERN_DEBUG
"isdn_tty: Fax FET=%d\n", par
);
929 if (!strncmp(p
[0], "K", 1)) {
931 if ((f
->phase
== ISDN_FAX_PHASE_IDLE
) || (f
->phase
== ISDN_FAX_PHASE_E
))
933 isdn_tty_modem_hup(info
, 1);
936 /* LID=string - local fax ID */
937 if (!strncmp(p
[0], "LID", 3)) {
943 sprintf(rs
, "\r\n\"%s\"", f
->id
);
944 isdn_tty_at_cout(rs
, info
);
950 sprintf(rs
, "\r\n\"STRING\"");
951 isdn_tty_at_cout(rs
, info
);
955 for (i
= 0; (*p
[0]) && i
< (FAXIDLEN
- 1) && (*p
[0] != '"'); i
++) {
960 for (r
= i
; r
< FAXIDLEN
; r
++) {
963 f
->id
[FAXIDLEN
- 1] = 0;
964 #ifdef ISDN_TTY_FAX_STAT_DEBUG
965 printk(KERN_DEBUG
"isdn_tty: Fax local ID \"%s\"\n", f
->id
);
975 /* MDL? - DCE Model */
976 if (!strncmp(p
[0], "MDL?", 4)) {
978 #ifdef ISDN_TTY_FAX_STAT_DEBUG
979 printk(KERN_DEBUG
"isdn_tty: FMDL?\n");
981 isdn_tty_at_cout("\r\nisdn4linux", info
);
984 /* MFR? - DCE Manufacturer */
985 if (!strncmp(p
[0], "MFR?", 4)) {
987 #ifdef ISDN_TTY_FAX_STAT_DEBUG
988 printk(KERN_DEBUG
"isdn_tty: FMFR?\n");
990 isdn_tty_at_cout("\r\nisdn4linux", info
);
993 /* MINSP=n - Minimum Speed for Phase C */
994 if (!strncmp(p
[0], "MINSP", 5)) {
999 sprintf(rs
, "\r\n%d", f
->minsp
);
1000 isdn_tty_at_cout(rs
, info
);
1006 sprintf(rs
, "\r\n0-5");
1007 isdn_tty_at_cout(rs
, info
);
1009 par
= isdn_getnum(p
);
1010 if ((par
< 0) || (par
> 5))
1013 #ifdef ISDN_TTY_FAX_STAT_DEBUG
1014 printk(KERN_DEBUG
"isdn_tty: Fax FMINSP=%d\n", par
);
1023 /* PHCTO=value - DTE phase C timeout */
1024 if (!strncmp(p
[0], "PHCTO", 5)) {
1029 sprintf(rs
, "\r\n%d", f
->phcto
);
1030 isdn_tty_at_cout(rs
, info
);
1036 sprintf(rs
, "\r\n0-255");
1037 isdn_tty_at_cout(rs
, info
);
1039 par
= isdn_getnum(p
);
1040 if ((par
< 0) || (par
> 255))
1043 #ifdef ISDN_TTY_FAX_STAT_DEBUG
1044 printk(KERN_DEBUG
"isdn_tty: Fax FPHCTO=%d\n", par
);
1054 /* REL=n - Phase C received EOL alignment */
1055 if (!strncmp(p
[0], "REL", 3)) {
1060 sprintf(rs
, "\r\n%d", f
->rel
);
1061 isdn_tty_at_cout(rs
, info
);
1067 sprintf(rs
, "\r\n0,1");
1068 isdn_tty_at_cout(rs
, info
);
1070 par
= isdn_getnum(p
);
1071 if ((par
< 0) || (par
> 1))
1074 #ifdef ISDN_TTY_FAX_STAT_DEBUG
1075 printk(KERN_DEBUG
"isdn_tty: Fax FREL=%d\n", par
);
1084 /* REV? - DCE Revision */
1085 if (!strncmp(p
[0], "REV?", 4)) {
1087 #ifdef ISDN_TTY_FAX_STAT_DEBUG
1088 printk(KERN_DEBUG
"isdn_tty: FREV?\n");
1090 strcpy(rss
, isdn_tty_fax_revision
);
1091 sprintf(rs
, "\r\nRev: %s", isdn_getrev(rss
));
1092 isdn_tty_at_cout(rs
, info
);
1096 /* Phase C Transmit Data Block Size */
1097 if (!strncmp(p
[0], "TBC=", 4)) { /* dummy, not used */
1099 #ifdef ISDN_TTY_FAX_STAT_DEBUG
1100 printk(KERN_DEBUG
"isdn_tty: Fax FTBC=%c\n", *p
[0]);
1111 printk(KERN_DEBUG
"isdn_tty: unknown token=>AT+F%s<\n", p
[0]);
1116 isdn_tty_cmd_PLUSF_FAX(char **p
, modem_info
*info
)
1118 if (TTY_IS_FCLASS2(info
))
1119 return (isdn_tty_cmd_FCLASS2(p
, info
));
1120 else if (TTY_IS_FCLASS1(info
))
1121 return (isdn_tty_cmd_FCLASS1(p
, info
));