patch-2.2.19 linux/drivers/isdn/isdn_tty.c
Next file: linux/drivers/isdn/isdn_tty.h
Previous file: linux/drivers/isdn/isdn_ppp.c
Back to the patch index
Back to the overall index
- Lines: 173
- Date:
Sun Mar 25 11:37:33 2001
- Orig file:
v2.2.18/drivers/isdn/isdn_tty.c
- Orig date:
Sun Mar 25 11:28:24 2001
diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.18/drivers/isdn/isdn_tty.c linux/drivers/isdn/isdn_tty.c
@@ -1,4 +1,4 @@
-/* $Id: isdn_tty.c,v 1.93 2000/08/05 09:58:26 armin Exp $
+/* $Id: isdn_tty.c,v 1.94 2000/11/25 17:00:59 kai Exp $
* Linux ISDN subsystem, tty functions and AT-command emulator (linklevel).
*
@@ -53,14 +53,20 @@
#define MODEM_PARANOIA_CHECK
#define MODEM_DO_RESTART
+#ifdef CONFIG_DEVFS_FS
+static char *isdn_ttyname_ttyI = "isdn/ttyI%d";
+static char *isdn_ttyname_cui = "isdn/cui%d";
+#else
static char *isdn_ttyname_ttyI = "ttyI";
static char *isdn_ttyname_cui = "cui";
+#endif
+
static int bit2si[8] =
{1, 5, 7, 7, 7, 7, 7, 7};
static int si2bit[8] =
{4, 1, 4, 4, 4, 4, 4, 4};
-char *isdn_tty_revision = "$Revision: 1.84 $";
+char *isdn_tty_revision = "$Revision: 1.94 $";
/* isdn_tty_try_read() is called from within isdn_tty_rcv_skb()
@@ -1177,6 +1183,7 @@
int c;
int total = 0;
modem_info *info = (modem_info *) tty->driver_data;
+ atemu *m = &info->emu;
if (isdn_tty_paranoia_check(info, tty->device, "isdn_tty_write"))
return 0;
@@ -1197,8 +1204,6 @@
|| (info->vonline & 3)
#endif
) {
- atemu *m = &info->emu;
-
#ifdef CONFIG_ISDN_AUDIO
if (!info->vonline)
#endif
@@ -1256,7 +1261,9 @@
isdn_command(&c);
}
info->vonline = 0;
- printk(KERN_DEBUG "fax dle cc/c %d/%d\n", cc,c);
+#ifdef ISDN_DEBUG_MODEM_VOICE
+ printk(KERN_DEBUG "fax dle cc/c %d/%d\n", cc, c);
+#endif
info->xmit_count += cc;
} else
#endif
@@ -1278,9 +1285,14 @@
count -= c;
total += c;
}
- if ((info->xmit_count) || (skb_queue_len(&info->xmit_queue)))
- isdn_timer_ctrl(ISDN_TIMER_MODEMXMIT, 1);
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);
return total;
@@ -1621,8 +1633,7 @@
static int
isdn_tty_block_til_ready(struct tty_struct *tty, struct file *filp, modem_info * info)
{
- struct wait_queue wait =
- {current, NULL};
+ DECLARE_WAITQUEUE(wait, NULL);
int do_clocal = 0;
unsigned long flags;
int retval;
@@ -1700,7 +1711,7 @@
restore_flags(flags);
info->blocked_open++;
while (1) {
- current->state = TASK_INTERRUPTIBLE;
+ set_current_state(TASK_INTERRUPTIBLE);
if (tty_hung_up_p(filp) ||
!(info->flags & ISDN_ASYNC_INITIALIZED)) {
#ifdef MODEM_DO_RESTART
@@ -1873,7 +1884,7 @@
*/
timeout = jiffies + HZ;
while (!(info->lsr & UART_LSR_TEMT)) {
- current->state = TASK_INTERRUPTIBLE;
+ set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(20);
if (time_after(jiffies,timeout))
break;
@@ -1889,7 +1900,7 @@
info->ncarrier = 0;
tty->closing = 0;
if (info->blocked_open) {
- current->state = TASK_INTERRUPTIBLE;
+ set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(50);
wake_up_interruptible(&info->open_wait);
}
@@ -2091,7 +2102,7 @@
return -3;
}
#endif
- info->write_sem = MUTEX;
+ init_MUTEX(&info->write_sem);
sprintf(info->last_cause, "0000");
sprintf(info->last_num, "none");
info->last_dir = 0;
@@ -2108,8 +2119,8 @@
info->blocked_open = 0;
info->callout_termios = m->cua_modem.init_termios;
info->normal_termios = m->tty_modem.init_termios;
- info->open_wait = 0;
- info->close_wait = 0;
+ init_waitqueue_head(&info->open_wait);
+ init_waitqueue_head(&info->close_wait);
info->isdn_driver = -1;
info->isdn_channel = -1;
info->drv_index = -1;
@@ -2364,11 +2375,21 @@
#ifdef ISDN_TTY_STAT_DEBUG
printk(KERN_DEBUG "tty_STAT_BCONN ttyI%d\n", info->line);
#endif
+ /* Wake up any processes waiting
+ * for incoming call of this device when
+ * DCD follow the state of incoming carrier
+ */
+ if (info->blocked_open &&
+ (info->emu.mdmreg[REG_DCD] & BIT_DCD)) {
+ wake_up_interruptible(&info->open_wait);
+ }
+
/* Schedule CONNECT-Message to any tty
* waiting for it and
* set DCD-bit of its modem-status.
*/
- if (TTY_IS_ACTIVE(info)) {
+ if (TTY_IS_ACTIVE(info) ||
+ (info->blocked_open && (info->emu.mdmreg[REG_DCD] & BIT_DCD))) {
info->msr |= UART_MSR_DCD;
info->emu.charge = 0;
if (info->dialing & 0xf)
@@ -2609,7 +2630,7 @@
if ((jiffies - *lastplus) < PLUSWAIT2)
*pluscount = 0;
}
- if ((*pluscount == 3) && (count = 1))
+ if ((*pluscount == 3) && (count == 1))
isdn_timer_ctrl(ISDN_TIMER_MODEMPLUS, 1);
if (*pluscount > 3)
*pluscount = 1;
@@ -2822,8 +2843,8 @@
int limit = ISDN_MSNLEN - 1;
while (((*p[0] >= '0' && *p[0] <= '9') ||
- /* Why a comma ??? */
- (*p[0] == ',')) &&
+ /* Why a comma ??? */
+ (*p[0] == ',') || (*p[0] == ':')) &&
(limit--))
*n++ = *p[0]++;
*n = '\0';
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)