コード例 #1
0
ファイル: isdn_ttyfax.c プロジェクト: 12019/kernel_zte_u880
int
isdn_tty_cmd_PLUSF_FAX(char **p, modem_info * info)
{
	if (TTY_IS_FCLASS2(info))
		return (isdn_tty_cmd_FCLASS2(p, info));
	else if (TTY_IS_FCLASS1(info))
		return (isdn_tty_cmd_FCLASS1(p, info));
	PARSE_ERROR1;
}
コード例 #2
0
ファイル: isdn_ttyfax.c プロジェクト: cilynx/dd-wrt
int
isdn_tty_cmd_PLUSF_FAX(char **p, modem_info * info)
{
	if (TTY_IS_FCLASS2(info))
		return (isdn_tty_cmd_FCLASS2(p, info));
#ifdef ISDN_TTY_FCLASS1
	else if (TTY_IS_FCLASS1(info))
		return (isdn_tty_cmd_FCLASS1(p, info));
#endif
	PARSE_ERROR1;
}
コード例 #3
0
ファイル: isdn_ttyfax.c プロジェクト: 12019/kernel_zte_u880
int
isdn_tty_fax_command(modem_info * info, isdn_ctrl * c)
{
	T30_s *f = info->fax;
	char rs[10];

	if (TTY_IS_FCLASS1(info))
		return (isdn_tty_fax_command1(info, c));

#ifdef ISDN_TTY_FAX_CMD_DEBUG
	printk(KERN_DEBUG "isdn_tty: Fax cmd %d on ttyI%d\n",
	       f->r_code, info->line);
#endif
	switch (f->r_code) {
		case ISDN_TTY_FAX_FCON:
			info->faxonline = 1;
			isdn_tty_fax_modem_result(2, info);	/* +FCON */
			return (0);
		case ISDN_TTY_FAX_FCON_I:
			info->faxonline = 16;
			isdn_tty_fax_modem_result(2, info);	/* +FCON */
			return (0);
		case ISDN_TTY_FAX_RID:
			if (info->faxonline & 1)
				isdn_tty_fax_modem_result(3, info);	/* +FCSI */
			if (info->faxonline & 16)
				isdn_tty_fax_modem_result(8, info);	/* +FTSI */
			return (0);
		case ISDN_TTY_FAX_DIS:
			isdn_tty_fax_modem_result(4, info);	/* +FDIS */
			return (0);
		case ISDN_TTY_FAX_HNG:
			if (f->phase == ISDN_FAX_PHASE_C) {
				if (f->direction == ISDN_TTY_FAX_CONN_IN) {
					sprintf(rs, "%c%c", DLE, ETX);
					isdn_tty_at_cout(rs, info);
				} else {
					sprintf(rs, "%c", 0x18);
					isdn_tty_at_cout(rs, info);
				}
				info->faxonline &= ~2;	/* leave data mode */
				info->online = 1;
			}
			f->phase = ISDN_FAX_PHASE_E;
			isdn_tty_fax_modem_result(5, info);	/* +FHNG */
			isdn_tty_fax_modem_result(0, info);	/* OK */
			return (0);
		case ISDN_TTY_FAX_DCS:
			isdn_tty_fax_modem_result(6, info);	/* +FDCS */
			isdn_tty_fax_modem_result(7, info);	/* CONNECT */
			f->phase = ISDN_FAX_PHASE_C;
			return (0);
		case ISDN_TTY_FAX_TRAIN_OK:
			isdn_tty_fax_modem_result(6, info);	/* +FDCS */
			isdn_tty_fax_modem_result(0, info);	/* OK */
			return (0);
		case ISDN_TTY_FAX_SENT:
			isdn_tty_fax_modem_result(0, info);	/* OK */
			return (0);
		case ISDN_TTY_FAX_CFR:
			isdn_tty_fax_modem_result(9, info);	/* +FCFR */
			return (0);
		case ISDN_TTY_FAX_ET:
			sprintf(rs, "%c%c", DLE, ETX);
			isdn_tty_at_cout(rs, info);
			isdn_tty_fax_modem_result(10, info);	/* +FPTS */
			isdn_tty_fax_modem_result(11, info);	/* +FET */
			isdn_tty_fax_modem_result(0, info);	/* OK */
			info->faxonline &= ~2;	/* leave data mode */
			info->online = 1;
			f->phase = ISDN_FAX_PHASE_D;
			return (0);
		case ISDN_TTY_FAX_PTS:
			isdn_tty_fax_modem_result(10, info);	/* +FPTS */
			if (f->direction == ISDN_TTY_FAX_CONN_OUT) {
				if (f->fet == 1)
					f->phase = ISDN_FAX_PHASE_B;
				if (f->fet == 0)
					isdn_tty_fax_modem_result(0, info);	/* OK */
			}
			return (0);
		case ISDN_TTY_FAX_EOP:
			info->faxonline &= ~2;	/* leave data mode */
			info->online = 1;
			f->phase = ISDN_FAX_PHASE_D;
			return (0);

	}
	return (-1);
}
コード例 #4
0
ファイル: communicate.c プロジェクト: marschap/isdn4k-utils
int
tty_write(unsigned char *buf, int len)
{
	int c;
	int total = 0;
/* TODO */
        while (1) {
/*
                c = MIN(count, info->xmit_size - info->xmit_count);
                if (info->isdn_driver >= 0)
                        c = MIN(c, dev->drv[info->isdn_driver]->maxbufsize);
                if (c <= 0)
                        break;
*/
#if 0
                if ((info->online > 1)
                    || (info->vonline & 3)
                        ) {
                        if (!info->vonline)
                                isdn_tty_check_esc(buf, m->mdmreg[REG_ESC], c,
                                                   &(m->pluscount),
                                                   &(m->lastplus),
                                                   from_user);
                        if (from_user)
                                copy_from_user(&(info->xmit_buf[info->xmit_count]), buf, c);
                        else
                                memcpy(&(info->xmit_buf[info->xmit_count]), buf, c);
                        if (info->vonline) {
                                int cc = isdn_tty_handleDLEdown(info, m, c);
                                if (info->vonline & 2) {
                                        if (!cc) {
                                                /* If DLE decoding results in zero-transmit, but
                                                 * c originally was non-zero, do a wakeup.
                                                 */
                                                if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
                                                 tty->ldisc.write_wakeup)
                                                        (tty->ldisc.write_wakeup) (tty);
                                                wake_up_interruptible(&tty->write_wait);
                                                info->msr |= UART_MSR_CTS;
                                                info->lsr |= UART_LSR_TEMT;
                                        }
                                        info->xmit_count += cc;
                                }
                                if ((info->vonline & 3) == 1) {
                                        /* Do NOT handle Ctrl-Q or Ctrl-S
                                         * when in full-duplex audio mode.
                                         */
                                        if (isdn_tty_end_vrx(buf, c, from_user)) {
                                                info->vonline &= ~1;
#ifdef ISDN_DEBUG_MODEM_VOICE
                                                printk(KERN_DEBUG
                                                       "got !^Q/^S, send DLE-ETX,VCON on ttyI%d\n",
                                                       info->line);
#endif
                                                isdn_tty_at_cout("\020\003\r\nVCON\r\n", info);
                                        }
                                }
                        } else

#if 0 /* def ISDN_TTY_FCLASS1 */
                        if (TTY_IS_FCLASS1(info)) {
                                int cc = isdn_tty_handleDLEdown(info, m, c);

                                if (info->vonline & 4) { /* ETX seen */
                                        isdn_ctrl c;

                                        c.command = ISDN_CMD_FAXCMD;
                                        c.driver = info->isdn_driver;
                                        c.arg = info->isdn_channel;
                                        c.parm.aux.cmd = ISDN_FAX_CLASS1_CTRL;
                                        c.parm.aux.subcmd = ETX;
                                        isdn_command(&c);
                                }
                                info->vonline = 0;
                                printk(KERN_DEBUG "fax dle cc/c %d/%d\n", cc,c);
                                info->xmit_count += cc;
                        } else
#endif

                                info->xmit_count += c;
                } else {
#endif
                        info.msr |= UART_MSR_CTS;
                        info.lsr |= UART_LSR_TEMT;
                        if (info.dialing) {
                                info.dialing = 0;
				logit(LOG_DEBUG, "Mhup in tty write");
/*
                                isdn_tty_modem_result(RESULT_NO_CARRIER, info);
                                isdn_tty_modem_hup(info, 1);
*/
                        } else {
                                tty_edit_at(buf, len);
				return(len);
			}
#if 0
                }
                buf += c;
                count -= c;
                total += c;
#endif
        }
#if 0
        atomic_dec(&info->xmit_lock);
        if ((info->xmit_count) || (skb_queue_len(&info->xmit_queue))) {
                if (m->mdmreg[REG_DXMT] & BIT_DXMT) {
                        isdn_tty_senddown(info);
                        isdn_tty_tint(info);
                }
                isdn_timer_ctrl(ISDN_TIMER_MODEMXMIT, 1);
        }
        if (from_user)
                up(&info->write_sem);
#endif
        return total;
}