patch-2.4.0-test6 linux/drivers/isdn/isdn_tty.c
Next file: linux/drivers/isdn/isdn_tty.h
Previous file: linux/drivers/isdn/isdn_ppp.h
Back to the patch index
Back to the overall index
- Lines: 492
- Date:
Tue Aug 8 15:03:57 2000
- Orig file:
v2.4.0-test5/linux/drivers/isdn/isdn_tty.c
- Orig date:
Thu Jul 27 17:38:00 2000
diff -u --recursive --new-file v2.4.0-test5/linux/drivers/isdn/isdn_tty.c linux/drivers/isdn/isdn_tty.c
@@ -1,4 +1,4 @@
-/* $Id: isdn_tty.c,v 1.84 2000/02/16 15:10:14 paul Exp $
+/* $Id: isdn_tty.c,v 1.93 2000/08/05 09:58:26 armin Exp $
* Linux ISDN subsystem, tty functions and AT-command emulator (linklevel).
*
@@ -19,334 +19,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Log: isdn_tty.c,v $
- * Revision 1.84 2000/02/16 15:10:14 paul
- * If a ttyI has no open FDs, don't connect incoming calls to it.
- * (Hangup on close of last FD is still to be done.)
- *
- * Revision 1.83 2000/02/16 14:59:33 paul
- * translated ISDN_MODEM_ANZREG to ISDN_MODEM_NUMREG for english speakers;
- * used defines for result codes;
- * fixed RING ... RUNG problem (no empty lines in between).
- *
- * Revision 1.82 2000/01/23 18:45:37 keil
- * Change EAZ mapping to forbit the use of cards (insert a "-" for the MSN)
- *
- * Revision 1.81 2000/01/20 19:55:33 keil
- * Add FAX Class 1 support
- *
- * Revision 1.80 1999/11/07 13:34:30 armin
- * Fixed AT command line editor
- *
- * Revision 1.79 1999/10/29 18:35:08 armin
- * Check number len in isdn_get_msnstr() to avoid buffer overflow.
- *
- * Revision 1.78 1999/10/28 23:03:51 armin
- * Bugfix: now freeing channel on modem_hup() even when
- * usage on ttyI has changed and error-report for
- * AT-commands on wrong channel-state.
- *
- * Revision 1.77 1999/10/26 21:13:14 armin
- * using define for checking phone number len in isdn_tty_getdial()
- *
- * Revision 1.76 1999/10/11 22:16:26 keil
- * Suspend/Resume is possible without explicit ID too
- *
- * Revision 1.75 1999/10/08 18:59:32 armin
- * Bugfix of too small MSN buffer and checking phone number
- * in isdn_tty_getdial()
- *
- * Revision 1.74 1999/09/04 06:20:04 keil
- * Changes from kernel set_current_state()
- *
- * Revision 1.73 1999/08/28 21:56:27 keil
- * misplaced #endif caused ttyI crash in 2.3.X
- *
- * Revision 1.72 1999/07/31 12:59:45 armin
- * Added tty fax capabilities.
- *
- * Revision 1.71 1999/07/27 10:34:34 armin
- * Fixed last change. Did not compile with AUDIO support off.
- *
- * Revision 1.70 1999/07/25 16:17:58 keil
- * Fix Suspend/Resume
- *
- * Revision 1.69 1999/07/25 12:56:15 armin
- * isdn_tty_at_cout() now queues the message if online and
- * data is in queue or flip buffer is full.
- * needed for fax connections.
- *
- * Revision 1.68 1999/07/11 17:51:51 armin
- * Bugfix, "-" was missing for AT&L settings.
- *
- * Revision 1.67 1999/07/11 17:14:12 armin
- * Added new layer 2 and 3 protocols for Fax and DSP functions.
- * Moved "Add CPN to RING message" to new register S23,
- * "Display message" is now correct on register S13 bit 7.
- * New audio command AT+VDD implemented (deactivate DTMF decoder and
- * activate possible existing hardware/DSP decoder).
- * Moved some tty defines to .h file.
- * Made whitespace possible in AT command line.
- * Some AT-emulator output bugfixes.
- * First Fax G3 implementations.
- *
- * Revision 1.66 1999/07/07 10:13:46 detabc
- * remove unused messages
- *
- * Revision 1.65 1999/07/04 21:01:59 werner
- * Added support for keypad and display (ported from 2.0)
- *
- * Revision 1.64 1999/07/01 08:30:00 keil
- * compatibility to 2.3 kernel
- *
- * Revision 1.63 1999/04/12 12:33:39 fritz
- * Changes from 2.0 tree.
- *
- * Revision 1.62 1999/03/02 12:04:48 armin
- * -added ISDN_STAT_ADDCH to increase supported channels after
- * register_isdn().
- * -ttyI now goes on-hook on ATZ when B-Ch is connected.
- * -added timer-function for register S7 (Wait for Carrier).
- * -analog modem (ISDN_PROTO_L2_MODEM) implementations.
- * -on L2_MODEM a string will be appended to the CONNECT-Message,
- * which is provided by the HL-Driver in parm.num in ISDN_STAT_BCONN.
- * -variable "dialing" used for ATA also, for interrupting call
- * establishment and register S7.
- *
- * Revision 1.61 1999/01/27 22:53:11 he
- * minor updates (spellings, jiffies wrap around in isdn_tty)
- *
- * Revision 1.60 1998/11/15 23:57:32 keil
- * changes for 2.1.127
- *
- * Revision 1.59 1998/08/20 13:50:15 keil
- * More support for hybrid modem (not working yet)
- *
- * Revision 1.58 1998/07/26 18:48:45 armin
- * Added silence detection in voice receive mode.
- *
- * Revision 1.57 1998/06/26 15:12:36 fritz
- * Added handling of STAT_ICALL with incomplete CPN.
- * Added AT&L for ttyI emulator.
- * Added more locking stuff in tty_write.
- *
- * Revision 1.56 1998/06/18 23:31:51 fritz
- * Replaced cli()/restore_flags() in isdn_tty_write() by locking.
- * Removed direct-senddown feature in isdn_tty_write because it will
- * never succeed with locking and is useless anyway.
- *
- * Revision 1.55 1998/06/17 19:50:55 he
- * merged with 2.1.10[34] (cosmetics and udelay() -> mdelay())
- * brute force fix to avoid Ugh's in isdn_tty_write()
- * cleaned up some dead code
- *
- *
- *
- * Revision 1.52 1998/03/19 13:18:21 keil
- * Start of a CAPI like interface for supplementary Service
- * first service: SUSPEND
- *
- *
- * Revision 1.49 1998/03/08 00:01:59 fritz
- * Bugfix: Lowlevel module usage and channel usage were not
- * reset on NO DCHANNEL.
- *
- * Revision 1.48 1998/03/07 12:28:15 tsbogend
- * fixed kernel unaligned traps on Linux/Alpha
- *
- * Revision 1.47 1998/02/22 19:44:14 fritz
- * Bugfixes and improvements regarding V.110, V.110 now running.
- *
- * Revision 1.46 1998/02/20 17:23:08 fritz
- * Changes for recent kernels.
- * Merged in contributions by Thomas Pfeiffer (V.110 T.70+ Extended FAX stuff)
- * Added symbolic constants for Modem-Registers.
- *
- * Revision 1.45 1998/01/31 22:07:49 keil
- * changes for newer kernels
- *
- * Revision 1.44 1998/01/31 19:30:02 calle
- * Merged changes from and for 2.1.82, not tested only compiled ...
- *
- * Revision 1.43 1997/10/09 21:29:04 fritz
- * New HL<->LL interface:
- * New BSENT callback with nr. of bytes included.
- * Sending without ACK.
- * New L1 error status (not yet in use).
- * Cleaned up obsolete structures.
- * Implemented Cisco-SLARP.
- * Changed local net-interface data to be dynamically allocated.
- * Removed old 2.0 compatibility stuff.
- *
- * Revision 1.42 1997/10/01 09:20:49 fritz
- * Removed old compatibility stuff for 2.0.X kernels.
- * From now on, this code is for 2.1.X ONLY!
- * Old stuff is still in the separate branch.
- *
- * Revision 1.41 1997/05/27 15:17:31 fritz
- * Added changes for recent 2.1.x kernels:
- * changed return type of isdn_close
- * queue_task_* -> queue_task
- * clear/set_bit -> test_and_... where apropriate.
- * changed type of hard_header_cache parameter.
- *
- * Revision 1.40 1997/03/24 22:55:27 fritz
- * Added debug code for status callbacks.
- *
- * Revision 1.39 1997/03/21 18:25:56 fritz
- * Corrected CTS handling.
- *
- * Revision 1.38 1997/03/07 12:13:35 fritz
- * Bugfix: Send audio in adpcm format was broken.
- * Bugfix: CTS handling was wrong.
- *
- * Revision 1.37 1997/03/07 01:37:34 fritz
- * Bugfix: Did not compile with CONFIG_ISDN_AUDIO disabled.
- * Bugfix: isdn_tty_tint() did not handle lowlevel errors correctly.
- * Bugfix: conversion was wrong when sending ulaw audio.
- * Added proper ifdef's for CONFIG_ISDN_AUDIO
- *
- * Revision 1.36 1997/03/04 21:41:55 fritz
- * Fix: Excessive stack usage of isdn_tty_senddown()
- * and isdn_tty_end_vrx() could lead to problems.
- *
- * Revision 1.35 1997/03/02 19:05:52 fritz
- * Bugfix: Avoid recursion.
- *
- * Revision 1.34 1997/03/02 14:29:22 fritz
- * More ttyI related cleanup.
- *
- * Revision 1.33 1997/02/28 02:32:45 fritz
- * Cleanup: Moved some tty related stuff from isdn_common.c
- * to isdn_tty.c
- * Bugfix: Bisync protocol did not behave like documented.
- *
- * Revision 1.32 1997/02/23 15:43:03 fritz
- * Small change in handling of incoming calls
- * documented in newest version of ttyI.4
- *
- * Revision 1.31 1997/02/21 13:05:57 fritz
- * Bugfix: Remote hangup did not set location-info on ttyI's
- *
- * Revision 1.30 1997/02/18 09:41:05 fritz
- * Added support for bitwise access to modem registers (ATSx.y=n, ATSx.y?).
- * Beautified output of AT&V.
- *
- * Revision 1.29 1997/02/16 12:11:51 fritz
- * Added S13,Bit4 option.
- *
- * Revision 1.28 1997/02/10 22:07:08 fritz
- * Added 2 modem registers for numbering plan and screening info.
- *
- * Revision 1.27 1997/02/10 21:31:14 fritz
- * Changed setup-interface (incoming and outgoing).
- *
- * Revision 1.26 1997/02/10 20:12:48 fritz
- * Changed interface for reporting incoming calls.
- *
- * Revision 1.25 1997/02/03 23:04:30 fritz
- * Reformatted according CodingStyle.
- * skb->free stuff replaced by macro.
- * Finished full-duplex audio.
- *
- * Revision 1.24 1997/01/14 01:32:42 fritz
- * Changed audio receive not to rely on skb->users and skb->lock.
- * Added ATI2 and related variables.
- * Started adding full-duplex audio capability.
- *
- * Revision 1.23 1996/10/22 23:14:02 fritz
- * Changes for compatibility to 2.0.X and 2.1.X kernels.
- *
- * Revision 1.22 1996/10/19 18:56:43 fritz
- * ATZ did not change the xmitbuf size.
- *
- * Revision 1.21 1996/06/24 17:40:28 fritz
- * Bugfix: Did not compile without CONFIG_ISDN_AUDIO
- *
- * Revision 1.20 1996/06/15 14:59:39 fritz
- * Fixed isdn_tty_tint() to handle partially sent
- * sk_buffs.
- *
- * Revision 1.19 1996/06/12 15:53:56 fritz
- * Bugfix: AT+VTX and AT+VRX could be executed without
- * having a connection.
- * Missing check for NULL tty in isdn_tty_flush_buffer().
- *
- * Revision 1.18 1996/06/07 11:17:33 tsbogend
- * added missing #ifdef CONFIG_ISDN_AUDIO to make compiling without
- * audio support possible
- *
- * Revision 1.17 1996/06/06 14:55:47 fritz
- * Changed to support DTMF decoding on audio playback also.
- * Bugfix: Added check for invalid info->isdn_driver in
- * isdn_tty_senddown().
- * Clear ncarrier flag on last close() of a tty.
- *
- * Revision 1.16 1996/06/05 02:24:12 fritz
- * Added DTMF decoder for audio mode.
- *
- * Revision 1.15 1996/06/03 20:35:01 fritz
- * Fixed typos.
- *
- * Revision 1.14 1996/06/03 20:12:19 fritz
- * Fixed typos.
- * Added call to write_wakeup via isdn_tty_flush_buffer()
- * in isdn_tty_modem_hup().
- *
- * Revision 1.13 1996/05/31 01:33:29 fritz
- * Changed buffering due to bad performance with mgetty.
- * Now sk_buff is delayed allocated in isdn_tty_senddown
- * using xmit_buff like in standard serial driver.
- * Fixed module locking.
- * Added DLE-DC4 handling in voice mode.
- *
- * Revision 1.12 1996/05/19 01:34:40 fritz
- * Bugfix: ATS returned error.
- * Register 20 made readonly.
- *
- * Revision 1.11 1996/05/18 01:37:03 fritz
- * Added spelling corrections and some minor changes
- * to stay in sync with kernel.
- *
- * Revision 1.10 1996/05/17 03:51:49 fritz
- * Changed DLE handling for audio receive.
- *
- * Revision 1.9 1996/05/11 21:52:07 fritz
- * Changed queue management to use sk_buffs.
- *
- * Revision 1.8 1996/05/10 08:49:43 fritz
- * Checkin before major changes of tty-code.
- *
- * Revision 1.7 1996/05/07 09:15:09 fritz
- * Reorganized and general cleanup.
- * Bugfixes:
- * - Audio-transmit working now.
- * - "NO CARRIER" now reported, when hanging up with DTR low.
- * - Corrected CTS handling.
- *
- * Revision 1.6 1996/05/02 03:59:25 fritz
- * Bugfixes:
- * - On dialout, layer-2 setup had been incomplete
- * when using new auto-layer2 feature.
- * - On hangup, "NO CARRIER" message sometimes missing.
- *
- * Revision 1.5 1996/04/30 21:05:25 fritz
- * Test commit
- *
- * Revision 1.4 1996/04/20 16:39:54 fritz
- * Changed all io to go through generic routines in isdn_common.c
- * Fixed a real ugly bug in modem-emulator: 'ATA' had been accepted
- * even when a call has been cancelled from the remote machine.
- *
- * Revision 1.3 1996/02/11 02:12:32 fritz
- * Bugfixes according to similar fixes in standard serial.c of kernel.
- *
- * Revision 1.2 1996/01/22 05:12:25 fritz
- * replaced my_atoi by simple_strtoul
- *
- * Revision 1.1 1996/01/09 04:13:18 fritz
- * Initial revision
- *
*/
#undef ISDN_TTY_STAT_DEBUG
@@ -394,7 +66,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.93 $";
/* isdn_tty_try_read() is called from within isdn_tty_rcv_skb()
@@ -1511,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;
@@ -1531,8 +1204,6 @@
|| (info->vonline & 3)
#endif
) {
- atemu *m = &info->emu;
-
#ifdef CONFIG_ISDN_AUDIO
if (!info->vonline)
#endif
@@ -1590,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
@@ -1612,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;
@@ -2485,7 +2163,7 @@
while (1) {
if ((q = strchr(p, ';')))
*q = '\0';
- if ((tmp = isdn_wildmat(cid, isdn_map_eaz2msn(p, di))) > ret)
+ if ((tmp = isdn_msncmp(cid, isdn_map_eaz2msn(p, di))) > ret)
ret = tmp;
#ifdef ISDN_DEBUG_MODEM_ICALL
printk(KERN_DEBUG "m_fi: lmsnX=%s mmsn=%s -> tmp=%d\n",
@@ -2504,7 +2182,7 @@
return ret;
} else {
int tmp;
- tmp = isdn_wildmat(cid, isdn_map_eaz2msn(emu->msn, di));
+ tmp = isdn_msncmp(cid, isdn_map_eaz2msn(emu->msn, di));
#ifdef ISDN_DEBUG_MODEM_ICALL
printk(KERN_DEBUG "m_fi: mmsn=%s -> tmp=%d\n",
isdn_map_eaz2msn(emu->msn, di), tmp);
@@ -2525,7 +2203,7 @@
* CID is longer.
*/
int
-isdn_tty_find_icall(int di, int ch, setup_parm setup)
+isdn_tty_find_icall(int di, int ch, setup_parm *setup)
{
char *eaz;
int i;
@@ -2536,18 +2214,18 @@
char *nr;
ulong flags;
- if (!setup.phone[0]) {
+ if (!setup->phone[0]) {
nr = "0";
printk(KERN_INFO "isdn_tty: Incoming call without OAD, assuming '0'\n");
} else
- nr = setup.phone;
- si1 = (int) setup.si1;
- si2 = (int) setup.si2;
- if (!setup.eazmsn[0]) {
+ nr = setup->phone;
+ si1 = (int) setup->si1;
+ si2 = (int) setup->si2;
+ if (!setup->eazmsn[0]) {
printk(KERN_WARNING "isdn_tty: Incoming call without CPN, assuming '0'\n");
eaz = "0";
} else
- eaz = setup.eazmsn;
+ eaz = setup->eazmsn;
#ifdef ISDN_DEBUG_MODEM_ICALL
printk(KERN_DEBUG "m_fi: eaz=%s si1=%d si2=%d\n", eaz, si1, si2);
#endif
@@ -2589,8 +2267,8 @@
strcpy(dev->num[idx], nr);
strcpy(info->emu.cpn, eaz);
info->emu.mdmreg[REG_SI1I] = si2bit[si1];
- info->emu.mdmreg[REG_PLAN] = setup.plan;
- info->emu.mdmreg[REG_SCREEN] = setup.screen;
+ info->emu.mdmreg[REG_PLAN] = setup->plan;
+ info->emu.mdmreg[REG_SCREEN] = setup->screen;
isdn_info_update();
restore_flags(flags);
printk(KERN_INFO "isdn_tty: call from %s, -> RING on ttyI%d\n", nr,
@@ -2697,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)
@@ -3155,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)