patch-2.2.15 linux/drivers/isdn/isdn_common.c
Next file: linux/drivers/isdn/isdn_common.h
Previous file: linux/drivers/isdn/hisax/teles3.c
Back to the patch index
Back to the overall index
- Lines: 283
- Date:
Fri Apr 21 12:46:12 2000
- Orig file:
v2.2.14/drivers/isdn/isdn_common.c
- Orig date:
Tue Jan 4 21:18:48 2000
diff -u --new-file --recursive --exclude-from ../../exclude v2.2.14/drivers/isdn/isdn_common.c linux/drivers/isdn/isdn_common.c
@@ -1,4 +1,4 @@
-/* $Id: isdn_common.c,v 1.93 1999/11/04 13:11:36 keil Exp $
+/* $Id: isdn_common.c,v 1.100 2000/03/03 16:37:11 kai Exp $
* Linux ISDN subsystem, common used functions (linklevel).
*
@@ -21,6 +21,42 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdn_common.c,v $
+ * Revision 1.100 2000/03/03 16:37:11 kai
+ * incorporated some cosmetic changes from the official kernel tree back
+ * into CVS
+ *
+ * Revision 1.99 2000/02/26 01:00:52 keil
+ * changes from 2.3.47
+ *
+ * Revision 1.98 2000/02/16 14:56:27 paul
+ * translated ISDN_MODEM_ANZREG to ISDN_MODEM_NUMREG for english speakers
+ *
+ * Revision 1.97 2000/01/23 18:45:37 keil
+ * Change EAZ mapping to forbit the use of cards (insert a "-" for the MSN)
+ *
+ * Revision 1.96 2000/01/20 19:55:33 keil
+ * Add FAX Class 1 support
+ *
+ * Revision 1.95 2000/01/09 20:43:13 detabc
+ * exand logical bind-group's for both call's (in and out).
+ * add first part of kernel-config-help for abc-extension.
+ *
+ * Revision 1.94 1999/11/20 22:14:13 detabc
+ * added channel dial-skip in case of external use
+ * (isdn phone or another isdn device) on the same NTBA.
+ * usefull with two or more card's connected the different NTBA's.
+ * global switchable in kernel-config and also per netinterface.
+ *
+ * add auto disable of netinterface's in case of:
+ * to many connection's in short time.
+ * config mistakes (wrong encapsulation, B2-protokoll or so on) on local
+ * or remote side.
+ * wrong password's or something else to a ISP (syncppp).
+ *
+ * possible encapsulations for this future are:
+ * ISDN_NET_ENCAP_SYNCPPP, ISDN_NET_ENCAP_UIHDLC, ISDN_NET_ENCAP_RAWIP,
+ * and ISDN_NET_ENCAP_CISCOHDLCK.
+ *
* Revision 1.93 1999/11/04 13:11:36 keil
* Reinit of v110 structs
*
@@ -416,7 +452,7 @@
isdn_dev *dev = (isdn_dev *) 0;
-static char *isdn_revision = "$Revision: 1.93 $";
+static char *isdn_revision = "$Revision: 1.100 $";
extern char *isdn_net_revision;
extern char *isdn_tty_revision;
@@ -438,6 +474,7 @@
static int isdn_writebuf_stub(int, int, const u_char *, int, int);
+static void set_global_features(void);
void
isdn_MOD_INC_USE_COUNT(void)
@@ -720,29 +757,33 @@
int
isdn_command(isdn_ctrl *cmd)
{
+ if (cmd->driver == -1) {
+ printk(KERN_WARNING "isdn_command command(%x) driver -1\n", cmd->command);
+ return(1);
+ }
if (cmd->command == ISDN_CMD_SETL2) {
- int idx = isdn_dc2minor(cmd->driver, cmd->arg & 255);
- unsigned long l2prot = (cmd->arg >> 8) & 255;
- unsigned long features = (dev->drv[cmd->driver]->interface->features
- >> ISDN_FEATURE_L2_SHIFT) &
- ISDN_FEATURE_L2_MASK;
- unsigned long l2_feature = (1 << l2prot);
-
- switch (l2prot) {
- case ISDN_PROTO_L2_V11096:
- case ISDN_PROTO_L2_V11019:
- case ISDN_PROTO_L2_V11038:
- /* If V.110 requested, but not supported by
- * HL-driver, set emulator-flag and change
- * Layer-2 to transparent
- */
- if (!(features & l2_feature)) {
- dev->v110emu[idx] = l2prot;
- cmd->arg = (cmd->arg & 255) |
- (ISDN_PROTO_L2_TRANS << 8);
- } else
- dev->v110emu[idx] = 0;
- }
+ int idx = isdn_dc2minor(cmd->driver, cmd->arg & 255);
+ unsigned long l2prot = (cmd->arg >> 8) & 255;
+ unsigned long features = (dev->drv[cmd->driver]->interface->features
+ >> ISDN_FEATURE_L2_SHIFT) &
+ ISDN_FEATURE_L2_MASK;
+ unsigned long l2_feature = (1 << l2prot);
+
+ switch (l2prot) {
+ case ISDN_PROTO_L2_V11096:
+ case ISDN_PROTO_L2_V11019:
+ case ISDN_PROTO_L2_V11038:
+ /* If V.110 requested, but not supported by
+ * HL-driver, set emulator-flag and change
+ * Layer-2 to transparent
+ */
+ if (!(features & l2_feature)) {
+ dev->v110emu[idx] = l2prot;
+ cmd->arg = (cmd->arg & 255) |
+ (ISDN_PROTO_L2_TRANS << 8);
+ } else
+ dev->v110emu[idx] = 0;
+ }
}
return dev->drv[cmd->driver]->interface->command(cmd);
}
@@ -822,6 +863,7 @@
for (i = 0; i < ISDN_MAX_CHANNELS; i++)
if (dev->drvmap[i] == di)
isdn_all_eaz(di, dev->chanmap[i]);
+ set_global_features();
break;
case ISDN_STAT_STOP:
dev->drv[di]->flags &= ~DRV_FLAG_RUNNING;
@@ -1079,6 +1121,7 @@
dev->drv[di] = NULL;
dev->drvid[di][0] = '\0';
isdn_info_update();
+ set_global_features();
restore_flags(flags);
return 0;
case ISDN_STAT_L1ERR:
@@ -1564,6 +1607,9 @@
* are serialized by means of a semaphore.
*/
switch (cmd) {
+ case IIOCNETDWRSET:
+ printk(KERN_INFO "INFO: ISDN_DW_ABC_EXTENSION not enabled\n");
+ return(-EINVAL);
case IIOCNETLCR:
printk(KERN_INFO "INFO: ISDN_ABC_LCR_SUPPORT not enabled\n");
return -ENODEV;
@@ -1756,15 +1802,15 @@
int i;
if ((ret = verify_area(VERIFY_WRITE, (void *) arg,
- (ISDN_MODEM_ANZREG + ISDN_MSNLEN + ISDN_LMSNLEN)
+ (ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN)
* ISDN_MAX_CHANNELS)))
return ret;
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
if (copy_to_user(p, dev->mdm.info[i].emu.profile,
- ISDN_MODEM_ANZREG))
+ ISDN_MODEM_NUMREG))
return -EFAULT;
- p += ISDN_MODEM_ANZREG;
+ p += ISDN_MODEM_NUMREG;
if (copy_to_user(p, dev->mdm.info[i].emu.pmsn, ISDN_MSNLEN))
return -EFAULT;
p += ISDN_MSNLEN;
@@ -1772,7 +1818,7 @@
return -EFAULT;
p += ISDN_LMSNLEN;
}
- return (ISDN_MODEM_ANZREG + ISDN_MSNLEN + ISDN_LMSNLEN) * ISDN_MAX_CHANNELS;
+ return (ISDN_MODEM_NUMREG + ISDN_MSNLEN + ISDN_LMSNLEN) * ISDN_MAX_CHANNELS;
} else
return -EINVAL;
break;
@@ -1783,15 +1829,15 @@
int i;
if ((ret = verify_area(VERIFY_READ, (void *) arg,
- (ISDN_MODEM_ANZREG + ISDN_MSNLEN)
+ (ISDN_MODEM_NUMREG + ISDN_MSNLEN)
* ISDN_MAX_CHANNELS)))
return ret;
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
if (copy_from_user(dev->mdm.info[i].emu.profile, p,
- ISDN_MODEM_ANZREG))
+ ISDN_MODEM_NUMREG))
return -EFAULT;
- p += ISDN_MODEM_ANZREG;
+ p += ISDN_MODEM_NUMREG;
if (copy_from_user(dev->mdm.info[i].emu.pmsn, p, ISDN_MSNLEN))
return -EFAULT;
p += ISDN_MSNLEN;
@@ -1855,7 +1901,7 @@
for (i = 0; i < 10; i++) {
sprintf(bname, "%s%s",
strlen(dev->drv[drvidx]->msn2eaz[i]) ?
- dev->drv[drvidx]->msn2eaz[i] : "-",
+ dev->drv[drvidx]->msn2eaz[i] : "_",
(i < 9) ? "," : "\0");
if (copy_to_user(p, bname, strlen(bname) + 1))
return -EFAULT;
@@ -2025,17 +2071,13 @@
static struct file_operations isdn_fops =
{
- isdn_lseek,
- isdn_read,
- isdn_write,
- NULL, /* isdn_readdir */
- isdn_poll, /* isdn_poll */
- isdn_ioctl, /* isdn_ioctl */
- NULL, /* isdn_mmap */
- isdn_open,
- NULL, /* flush */
- isdn_close,
- NULL /* fsync */
+ llseek: isdn_lseek,
+ read: isdn_read,
+ write: isdn_write,
+ poll: isdn_poll,
+ ioctl: isdn_ioctl,
+ open: isdn_open,
+ release: isdn_close,
};
char *
@@ -2061,7 +2103,7 @@
int
isdn_get_free_channel(int usage, int l2_proto, int l3_proto, int pre_dev
- ,int pre_chan)
+ ,int pre_chan, char *msn)
{
int i;
ulong flags;
@@ -2084,6 +2126,8 @@
if ((dev->usage[i] & ISDN_USAGE_EXCLUSIVE) &&
((pre_dev != d) || (pre_chan != dev->chanmap[i])))
continue;
+ if (!strcmp(isdn_map_eaz2msn(msn, d), "-"))
+ continue;
if (dev->usage[i] & ISDN_USAGE_DISABLED)
continue; /* usage not allowed */
if (dev->drv[d]->flags & DRV_FLAG_RUNNING) {
@@ -2374,6 +2418,19 @@
* Low-level-driver registration
*/
+static void
+set_global_features(void)
+{
+ int drvidx;
+
+ dev->global_features = 0;
+ for (drvidx = 0; drvidx < ISDN_MAX_DRIVERS; drvidx++) {
+ if (!dev->drv[drvidx])
+ continue;
+ if (dev->drv[drvidx]->interface)
+ dev->global_features |= dev->drv[drvidx]->interface->features;
+ }
+}
#ifdef CONFIG_ISDN_DIVERSION
extern isdn_divert_if *divert_if;
@@ -2487,6 +2544,7 @@
strcpy(dev->drvid[drvidx], i->id);
isdn_info_update();
dev->drivers++;
+ set_global_features();
restore_flags(flags);
return 1;
}
@@ -2517,6 +2575,7 @@
rev = "???";
return rev;
}
+
/*
* Allocate and initialize all data, register modem-devices
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)