diff options
Diffstat (limited to 'drivers/isdn/gigaset/i4l.c')
| -rw-r--r-- | drivers/isdn/gigaset/i4l.c | 231 |
1 files changed, 119 insertions, 112 deletions
diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c index 731a675f21b0..0815dbfb8291 100644 --- a/drivers/isdn/gigaset/i4l.c +++ b/drivers/isdn/gigaset/i4l.c | |||
| @@ -1,9 +1,9 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Stuff used by all variants of the driver | 2 | * Stuff used by all variants of the driver |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2001 by Stefan Eilers (Eilers.Stefan@epost.de), | 4 | * Copyright (c) 2001 by Stefan Eilers, |
| 5 | * Hansjoerg Lipp (hjlipp@web.de), | 5 | * Hansjoerg Lipp <hjlipp@web.de>, |
| 6 | * Tilman Schmidt (tilman@imap.cc). | 6 | * Tilman Schmidt <tilman@imap.cc>. |
| 7 | * | 7 | * |
| 8 | * ===================================================================== | 8 | * ===================================================================== |
| 9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
| @@ -11,15 +11,11 @@ | |||
| 11 | * published by the Free Software Foundation; either version 2 of | 11 | * published by the Free Software Foundation; either version 2 of |
| 12 | * the License, or (at your option) any later version. | 12 | * the License, or (at your option) any later version. |
| 13 | * ===================================================================== | 13 | * ===================================================================== |
| 14 | * ToDo: ... | ||
| 15 | * ===================================================================== | ||
| 16 | * Version: $Id: i4l.c,v 1.3.2.9 2006/02/04 18:28:16 hjlipp Exp $ | ||
| 17 | * ===================================================================== | ||
| 18 | */ | 14 | */ |
| 19 | 15 | ||
| 20 | #include "gigaset.h" | 16 | #include "gigaset.h" |
| 21 | 17 | ||
| 22 | /* == Handling of I4L IO ============================================================================*/ | 18 | /* == Handling of I4L IO =====================================================*/ |
| 23 | 19 | ||
| 24 | /* writebuf_from_LL | 20 | /* writebuf_from_LL |
| 25 | * called by LL to transmit data on an open channel | 21 | * called by LL to transmit data on an open channel |
| @@ -29,14 +25,16 @@ | |||
| 29 | * parameters: | 25 | * parameters: |
| 30 | * driverID driver ID as assigned by LL | 26 | * driverID driver ID as assigned by LL |
| 31 | * channel channel number | 27 | * channel channel number |
| 32 | * ack if != 0 LL wants to be notified on completion via statcallb(ISDN_STAT_BSENT) | 28 | * ack if != 0 LL wants to be notified on completion via |
| 29 | * statcallb(ISDN_STAT_BSENT) | ||
| 33 | * skb skb containing data to send | 30 | * skb skb containing data to send |
| 34 | * return value: | 31 | * return value: |
| 35 | * number of accepted bytes | 32 | * number of accepted bytes |
| 36 | * 0 if temporarily unable to accept data (out of buffer space) | 33 | * 0 if temporarily unable to accept data (out of buffer space) |
| 37 | * <0 on error (eg. -EINVAL) | 34 | * <0 on error (eg. -EINVAL) |
| 38 | */ | 35 | */ |
| 39 | static int writebuf_from_LL(int driverID, int channel, int ack, struct sk_buff *skb) | 36 | static int writebuf_from_LL(int driverID, int channel, int ack, |
| 37 | struct sk_buff *skb) | ||
| 40 | { | 38 | { |
| 41 | struct cardstate *cs; | 39 | struct cardstate *cs; |
| 42 | struct bc_state *bcs; | 40 | struct bc_state *bcs; |
| @@ -54,31 +52,28 @@ static int writebuf_from_LL(int driverID, int channel, int ack, struct sk_buff * | |||
| 54 | bcs = &cs->bcs[channel]; | 52 | bcs = &cs->bcs[channel]; |
| 55 | len = skb->len; | 53 | len = skb->len; |
| 56 | 54 | ||
| 57 | dbg(DEBUG_LLDATA, | 55 | gig_dbg(DEBUG_LLDATA, |
| 58 | "Receiving data from LL (id: %d, channel: %d, ack: %d, size: %d)", | 56 | "Receiving data from LL (id: %d, ch: %d, ack: %d, sz: %d)", |
| 59 | driverID, channel, ack, len); | 57 | driverID, channel, ack, len); |
| 60 | 58 | ||
| 61 | if (!len) { | 59 | if (!len) { |
| 62 | if (ack) | 60 | if (ack) |
| 63 | warn("not ACKing empty packet from LL"); | 61 | notice("%s: not ACKing empty packet", __func__); |
| 64 | return 0; | 62 | return 0; |
| 65 | } | 63 | } |
| 66 | if (len > MAX_BUF_SIZE) { | 64 | if (len > MAX_BUF_SIZE) { |
| 67 | err("%s: packet too large (%d bytes)", __func__, channel); | 65 | err("%s: packet too large (%d bytes)", __func__, len); |
| 68 | return -EINVAL; | 66 | return -EINVAL; |
| 69 | } | 67 | } |
| 70 | 68 | ||
| 71 | if (!atomic_read(&cs->connected)) | ||
| 72 | return -ENODEV; | ||
| 73 | |||
| 74 | skblen = ack ? len : 0; | 69 | skblen = ack ? len : 0; |
| 75 | skb->head[0] = skblen & 0xff; | 70 | skb->head[0] = skblen & 0xff; |
| 76 | skb->head[1] = skblen >> 8; | 71 | skb->head[1] = skblen >> 8; |
| 77 | dbg(DEBUG_MCMD, "skb: len=%u, skblen=%u: %02x %02x", len, skblen, | 72 | gig_dbg(DEBUG_MCMD, "skb: len=%u, skblen=%u: %02x %02x", |
| 78 | (unsigned) skb->head[0], (unsigned) skb->head[1]); | 73 | len, skblen, (unsigned) skb->head[0], (unsigned) skb->head[1]); |
| 79 | 74 | ||
| 80 | /* pass to device-specific module */ | 75 | /* pass to device-specific module */ |
| 81 | return cs->ops->send_skb(bcs, skb); | 76 | return cs->ops->send_skb(bcs, skb); //FIXME cs->ops->send_skb() must handle !cs->connected correctly |
| 82 | } | 77 | } |
| 83 | 78 | ||
| 84 | void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb) | 79 | void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb) |
| @@ -89,14 +84,14 @@ void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb) | |||
| 89 | ++bcs->trans_up; | 84 | ++bcs->trans_up; |
| 90 | 85 | ||
| 91 | if (skb->len) | 86 | if (skb->len) |
| 92 | warn("%s: skb->len==%d", __func__, skb->len); | 87 | dev_warn(bcs->cs->dev, "%s: skb->len==%d\n", |
| 88 | __func__, skb->len); | ||
| 93 | 89 | ||
| 94 | len = (unsigned char) skb->head[0] | | 90 | len = (unsigned char) skb->head[0] | |
| 95 | (unsigned) (unsigned char) skb->head[1] << 8; | 91 | (unsigned) (unsigned char) skb->head[1] << 8; |
| 96 | if (len) { | 92 | if (len) { |
| 97 | dbg(DEBUG_MCMD, | 93 | gig_dbg(DEBUG_MCMD, "ACKing to LL (id: %d, ch: %d, sz: %u)", |
| 98 | "Acknowledge sending to LL (id: %d, channel: %d size: %u)", | 94 | bcs->cs->myid, bcs->channel, len); |
| 99 | bcs->cs->myid, bcs->channel, len); | ||
| 100 | 95 | ||
| 101 | response.driver = bcs->cs->myid; | 96 | response.driver = bcs->cs->myid; |
| 102 | response.command = ISDN_STAT_BSENT; | 97 | response.command = ISDN_STAT_BSENT; |
| @@ -119,15 +114,12 @@ static int command_from_LL(isdn_ctrl *cntrl) | |||
| 119 | struct bc_state *bcs; | 114 | struct bc_state *bcs; |
| 120 | int retval = 0; | 115 | int retval = 0; |
| 121 | struct setup_parm *sp; | 116 | struct setup_parm *sp; |
| 117 | unsigned param; | ||
| 118 | unsigned long flags; | ||
| 122 | 119 | ||
| 123 | //dbg(DEBUG_ANY, "Gigaset_HW: Receiving command"); | ||
| 124 | gigaset_debugdrivers(); | 120 | gigaset_debugdrivers(); |
| 125 | 121 | ||
| 126 | /* Terminate this call if no device is present. Bt if the command is "ISDN_CMD_LOCK" or | 122 | if (!cs) { |
| 127 | * "ISDN_CMD_UNLOCK" then execute it due to the fact that they are device independent ! | ||
| 128 | */ | ||
| 129 | //FIXME "remove test for &connected" | ||
| 130 | if ((!cs || !atomic_read(&cs->connected))) { | ||
| 131 | warn("LL tried to access unknown device with nr. %d", | 123 | warn("LL tried to access unknown device with nr. %d", |
| 132 | cntrl->driver); | 124 | cntrl->driver); |
| 133 | return -ENODEV; | 125 | return -ENODEV; |
| @@ -135,29 +127,30 @@ static int command_from_LL(isdn_ctrl *cntrl) | |||
| 135 | 127 | ||
| 136 | switch (cntrl->command) { | 128 | switch (cntrl->command) { |
| 137 | case ISDN_CMD_IOCTL: | 129 | case ISDN_CMD_IOCTL: |
| 138 | 130 | gig_dbg(DEBUG_ANY, "ISDN_CMD_IOCTL (driver: %d, arg: %ld)", | |
| 139 | dbg(DEBUG_ANY, "ISDN_CMD_IOCTL (driver:%d,arg: %ld)", | 131 | cntrl->driver, cntrl->arg); |
| 140 | cntrl->driver, cntrl->arg); | ||
| 141 | 132 | ||
| 142 | warn("ISDN_CMD_IOCTL is not supported."); | 133 | warn("ISDN_CMD_IOCTL is not supported."); |
| 143 | return -EINVAL; | 134 | return -EINVAL; |
| 144 | 135 | ||
| 145 | case ISDN_CMD_DIAL: | 136 | case ISDN_CMD_DIAL: |
| 146 | dbg(DEBUG_ANY, "ISDN_CMD_DIAL (driver: %d, channel: %ld, " | 137 | gig_dbg(DEBUG_ANY, |
| 147 | "phone: %s,ownmsn: %s, si1: %d, si2: %d)", | 138 | "ISDN_CMD_DIAL (driver: %d, ch: %ld, " |
| 148 | cntrl->driver, cntrl->arg, | 139 | "phone: %s, ownmsn: %s, si1: %d, si2: %d)", |
| 149 | cntrl->parm.setup.phone, cntrl->parm.setup.eazmsn, | 140 | cntrl->driver, cntrl->arg, |
| 150 | cntrl->parm.setup.si1, cntrl->parm.setup.si2); | 141 | cntrl->parm.setup.phone, cntrl->parm.setup.eazmsn, |
| 142 | cntrl->parm.setup.si1, cntrl->parm.setup.si2); | ||
| 151 | 143 | ||
| 152 | if (cntrl->arg >= cs->channels) { | 144 | if (cntrl->arg >= cs->channels) { |
| 153 | err("invalid channel (%d)", (int) cntrl->arg); | 145 | err("ISDN_CMD_DIAL: invalid channel (%d)", |
| 146 | (int) cntrl->arg); | ||
| 154 | return -EINVAL; | 147 | return -EINVAL; |
| 155 | } | 148 | } |
| 156 | 149 | ||
| 157 | bcs = cs->bcs + cntrl->arg; | 150 | bcs = cs->bcs + cntrl->arg; |
| 158 | 151 | ||
| 159 | if (!gigaset_get_channel(bcs)) { | 152 | if (!gigaset_get_channel(bcs)) { |
| 160 | err("channel not free"); | 153 | err("ISDN_CMD_DIAL: channel not free"); |
| 161 | return -EBUSY; | 154 | return -EBUSY; |
| 162 | } | 155 | } |
| 163 | 156 | ||
| @@ -169,42 +162,46 @@ static int command_from_LL(isdn_ctrl *cntrl) | |||
| 169 | } | 162 | } |
| 170 | *sp = cntrl->parm.setup; | 163 | *sp = cntrl->parm.setup; |
| 171 | 164 | ||
| 172 | if (!gigaset_add_event(cs, &bcs->at_state, EV_DIAL, sp, | 165 | spin_lock_irqsave(&cs->lock, flags); |
| 173 | atomic_read(&bcs->at_state.seq_index), | 166 | param = bcs->at_state.seq_index; |
| 174 | NULL)) { | 167 | spin_unlock_irqrestore(&cs->lock, flags); |
| 168 | |||
| 169 | if (!gigaset_add_event(cs, &bcs->at_state, EV_DIAL, sp, param, | ||
| 170 | NULL)) { | ||
| 175 | //FIXME what should we do? | 171 | //FIXME what should we do? |
| 176 | kfree(sp); | 172 | kfree(sp); |
| 177 | gigaset_free_channel(bcs); | 173 | gigaset_free_channel(bcs); |
| 178 | return -ENOMEM; | 174 | return -ENOMEM; |
| 179 | } | 175 | } |
| 180 | 176 | ||
| 181 | dbg(DEBUG_CMD, "scheduling DIAL"); | 177 | gig_dbg(DEBUG_CMD, "scheduling DIAL"); |
| 182 | gigaset_schedule_event(cs); | 178 | gigaset_schedule_event(cs); |
| 183 | break; | 179 | break; |
| 184 | case ISDN_CMD_ACCEPTD: //FIXME | 180 | case ISDN_CMD_ACCEPTD: //FIXME |
| 185 | dbg(DEBUG_ANY, "ISDN_CMD_ACCEPTD"); | 181 | gig_dbg(DEBUG_ANY, "ISDN_CMD_ACCEPTD"); |
| 186 | 182 | ||
| 187 | if (cntrl->arg >= cs->channels) { | 183 | if (cntrl->arg >= cs->channels) { |
| 188 | err("invalid channel (%d)", (int) cntrl->arg); | 184 | err("ISDN_CMD_ACCEPTD: invalid channel (%d)", |
| 185 | (int) cntrl->arg); | ||
| 189 | return -EINVAL; | 186 | return -EINVAL; |
| 190 | } | 187 | } |
| 191 | 188 | ||
| 192 | if (!gigaset_add_event(cs, &cs->bcs[cntrl->arg].at_state, | 189 | if (!gigaset_add_event(cs, &cs->bcs[cntrl->arg].at_state, |
| 193 | EV_ACCEPT, NULL, 0, NULL)) { | 190 | EV_ACCEPT, NULL, 0, NULL)) { |
| 194 | //FIXME what should we do? | 191 | //FIXME what should we do? |
| 195 | return -ENOMEM; | 192 | return -ENOMEM; |
| 196 | } | 193 | } |
| 197 | 194 | ||
| 198 | dbg(DEBUG_CMD, "scheduling ACCEPT"); | 195 | gig_dbg(DEBUG_CMD, "scheduling ACCEPT"); |
| 199 | gigaset_schedule_event(cs); | 196 | gigaset_schedule_event(cs); |
| 200 | 197 | ||
| 201 | break; | 198 | break; |
| 202 | case ISDN_CMD_ACCEPTB: | 199 | case ISDN_CMD_ACCEPTB: |
| 203 | dbg(DEBUG_ANY, "ISDN_CMD_ACCEPTB"); | 200 | gig_dbg(DEBUG_ANY, "ISDN_CMD_ACCEPTB"); |
| 204 | break; | 201 | break; |
| 205 | case ISDN_CMD_HANGUP: | 202 | case ISDN_CMD_HANGUP: |
| 206 | dbg(DEBUG_ANY, | 203 | gig_dbg(DEBUG_ANY, "ISDN_CMD_HANGUP (ch: %d)", |
| 207 | "ISDN_CMD_HANGUP (channel: %d)", (int) cntrl->arg); | 204 | (int) cntrl->arg); |
| 208 | 205 | ||
| 209 | if (cntrl->arg >= cs->channels) { | 206 | if (cntrl->arg >= cs->channels) { |
| 210 | err("ISDN_CMD_HANGUP: invalid channel (%u)", | 207 | err("ISDN_CMD_HANGUP: invalid channel (%u)", |
| @@ -213,66 +210,68 @@ static int command_from_LL(isdn_ctrl *cntrl) | |||
| 213 | } | 210 | } |
| 214 | 211 | ||
| 215 | if (!gigaset_add_event(cs, &cs->bcs[cntrl->arg].at_state, | 212 | if (!gigaset_add_event(cs, &cs->bcs[cntrl->arg].at_state, |
| 216 | EV_HUP, NULL, 0, NULL)) { | 213 | EV_HUP, NULL, 0, NULL)) { |
| 217 | //FIXME what should we do? | 214 | //FIXME what should we do? |
| 218 | return -ENOMEM; | 215 | return -ENOMEM; |
| 219 | } | 216 | } |
| 220 | 217 | ||
| 221 | dbg(DEBUG_CMD, "scheduling HUP"); | 218 | gig_dbg(DEBUG_CMD, "scheduling HUP"); |
| 222 | gigaset_schedule_event(cs); | 219 | gigaset_schedule_event(cs); |
| 223 | 220 | ||
| 224 | break; | 221 | break; |
| 225 | case ISDN_CMD_CLREAZ: /* Do not signal incoming signals */ //FIXME | 222 | case ISDN_CMD_CLREAZ: /* Do not signal incoming signals */ //FIXME |
| 226 | dbg(DEBUG_ANY, "ISDN_CMD_CLREAZ"); | 223 | gig_dbg(DEBUG_ANY, "ISDN_CMD_CLREAZ"); |
| 227 | break; | 224 | break; |
| 228 | case ISDN_CMD_SETEAZ: /* Signal incoming calls for given MSN */ //FIXME | 225 | case ISDN_CMD_SETEAZ: /* Signal incoming calls for given MSN */ //FIXME |
| 229 | dbg(DEBUG_ANY, | 226 | gig_dbg(DEBUG_ANY, |
| 230 | "ISDN_CMD_SETEAZ (id:%d, channel: %ld, number: %s)", | 227 | "ISDN_CMD_SETEAZ (id: %d, ch: %ld, number: %s)", |
| 231 | cntrl->driver, cntrl->arg, cntrl->parm.num); | 228 | cntrl->driver, cntrl->arg, cntrl->parm.num); |
| 232 | break; | 229 | break; |
| 233 | case ISDN_CMD_SETL2: /* Set L2 to given protocol */ | 230 | case ISDN_CMD_SETL2: /* Set L2 to given protocol */ |
| 234 | dbg(DEBUG_ANY, "ISDN_CMD_SETL2 (Channel: %ld, Proto: %lx)", | 231 | gig_dbg(DEBUG_ANY, "ISDN_CMD_SETL2 (ch: %ld, proto: %lx)", |
| 235 | cntrl->arg & 0xff, (cntrl->arg >> 8)); | 232 | cntrl->arg & 0xff, (cntrl->arg >> 8)); |
| 236 | 233 | ||
| 237 | if ((cntrl->arg & 0xff) >= cs->channels) { | 234 | if ((cntrl->arg & 0xff) >= cs->channels) { |
| 238 | err("invalid channel (%u)", | 235 | err("ISDN_CMD_SETL2: invalid channel (%u)", |
| 239 | (unsigned) cntrl->arg & 0xff); | 236 | (unsigned) cntrl->arg & 0xff); |
| 240 | return -EINVAL; | 237 | return -EINVAL; |
| 241 | } | 238 | } |
| 242 | 239 | ||
| 243 | if (!gigaset_add_event(cs, &cs->bcs[cntrl->arg & 0xff].at_state, | 240 | if (!gigaset_add_event(cs, &cs->bcs[cntrl->arg & 0xff].at_state, |
| 244 | EV_PROTO_L2, NULL, cntrl->arg >> 8, | 241 | EV_PROTO_L2, NULL, cntrl->arg >> 8, |
| 245 | NULL)) { | 242 | NULL)) { |
| 246 | //FIXME what should we do? | 243 | //FIXME what should we do? |
| 247 | return -ENOMEM; | 244 | return -ENOMEM; |
| 248 | } | 245 | } |
| 249 | 246 | ||
| 250 | dbg(DEBUG_CMD, "scheduling PROTO_L2"); | 247 | gig_dbg(DEBUG_CMD, "scheduling PROTO_L2"); |
| 251 | gigaset_schedule_event(cs); | 248 | gigaset_schedule_event(cs); |
| 252 | break; | 249 | break; |
| 253 | case ISDN_CMD_SETL3: /* Set L3 to given protocol */ | 250 | case ISDN_CMD_SETL3: /* Set L3 to given protocol */ |
| 254 | dbg(DEBUG_ANY, "ISDN_CMD_SETL3 (Channel: %ld, Proto: %lx)", | 251 | gig_dbg(DEBUG_ANY, "ISDN_CMD_SETL3 (ch: %ld, proto: %lx)", |
| 255 | cntrl->arg & 0xff, (cntrl->arg >> 8)); | 252 | cntrl->arg & 0xff, (cntrl->arg >> 8)); |
| 256 | 253 | ||
| 257 | if ((cntrl->arg & 0xff) >= cs->channels) { | 254 | if ((cntrl->arg & 0xff) >= cs->channels) { |
| 258 | err("invalid channel (%u)", | 255 | err("ISDN_CMD_SETL3: invalid channel (%u)", |
| 259 | (unsigned) cntrl->arg & 0xff); | 256 | (unsigned) cntrl->arg & 0xff); |
| 260 | return -EINVAL; | 257 | return -EINVAL; |
| 261 | } | 258 | } |
| 262 | 259 | ||
| 263 | if (cntrl->arg >> 8 != ISDN_PROTO_L3_TRANS) { | 260 | if (cntrl->arg >> 8 != ISDN_PROTO_L3_TRANS) { |
| 264 | err("invalid protocol %lu", cntrl->arg >> 8); | 261 | err("ISDN_CMD_SETL3: invalid protocol %lu", |
| 262 | cntrl->arg >> 8); | ||
| 265 | return -EINVAL; | 263 | return -EINVAL; |
| 266 | } | 264 | } |
| 267 | 265 | ||
| 268 | break; | 266 | break; |
| 269 | case ISDN_CMD_PROCEED: | 267 | case ISDN_CMD_PROCEED: |
| 270 | dbg(DEBUG_ANY, "ISDN_CMD_PROCEED"); //FIXME | 268 | gig_dbg(DEBUG_ANY, "ISDN_CMD_PROCEED"); //FIXME |
| 271 | break; | 269 | break; |
| 272 | case ISDN_CMD_ALERT: | 270 | case ISDN_CMD_ALERT: |
| 273 | dbg(DEBUG_ANY, "ISDN_CMD_ALERT"); //FIXME | 271 | gig_dbg(DEBUG_ANY, "ISDN_CMD_ALERT"); //FIXME |
| 274 | if (cntrl->arg >= cs->channels) { | 272 | if (cntrl->arg >= cs->channels) { |
| 275 | err("invalid channel (%d)", (int) cntrl->arg); | 273 | err("ISDN_CMD_ALERT: invalid channel (%d)", |
| 274 | (int) cntrl->arg); | ||
| 276 | return -EINVAL; | 275 | return -EINVAL; |
| 277 | } | 276 | } |
| 278 | //bcs = cs->bcs + cntrl->arg; | 277 | //bcs = cs->bcs + cntrl->arg; |
| @@ -280,32 +279,31 @@ static int command_from_LL(isdn_ctrl *cntrl) | |||
| 280 | // FIXME | 279 | // FIXME |
| 281 | break; | 280 | break; |
| 282 | case ISDN_CMD_REDIR: | 281 | case ISDN_CMD_REDIR: |
| 283 | dbg(DEBUG_ANY, "ISDN_CMD_REDIR"); //FIXME | 282 | gig_dbg(DEBUG_ANY, "ISDN_CMD_REDIR"); //FIXME |
| 284 | break; | 283 | break; |
| 285 | case ISDN_CMD_PROT_IO: | 284 | case ISDN_CMD_PROT_IO: |
| 286 | dbg(DEBUG_ANY, "ISDN_CMD_PROT_IO"); | 285 | gig_dbg(DEBUG_ANY, "ISDN_CMD_PROT_IO"); |
| 287 | break; | 286 | break; |
| 288 | case ISDN_CMD_FAXCMD: | 287 | case ISDN_CMD_FAXCMD: |
| 289 | dbg(DEBUG_ANY, "ISDN_CMD_FAXCMD"); | 288 | gig_dbg(DEBUG_ANY, "ISDN_CMD_FAXCMD"); |
| 290 | break; | 289 | break; |
| 291 | case ISDN_CMD_GETL2: | 290 | case ISDN_CMD_GETL2: |
| 292 | dbg(DEBUG_ANY, "ISDN_CMD_GETL2"); | 291 | gig_dbg(DEBUG_ANY, "ISDN_CMD_GETL2"); |
| 293 | break; | 292 | break; |
| 294 | case ISDN_CMD_GETL3: | 293 | case ISDN_CMD_GETL3: |
| 295 | dbg(DEBUG_ANY, "ISDN_CMD_GETL3"); | 294 | gig_dbg(DEBUG_ANY, "ISDN_CMD_GETL3"); |
| 296 | break; | 295 | break; |
| 297 | case ISDN_CMD_GETEAZ: | 296 | case ISDN_CMD_GETEAZ: |
| 298 | dbg(DEBUG_ANY, "ISDN_CMD_GETEAZ"); | 297 | gig_dbg(DEBUG_ANY, "ISDN_CMD_GETEAZ"); |
| 299 | break; | 298 | break; |
| 300 | case ISDN_CMD_SETSIL: | 299 | case ISDN_CMD_SETSIL: |
| 301 | dbg(DEBUG_ANY, "ISDN_CMD_SETSIL"); | 300 | gig_dbg(DEBUG_ANY, "ISDN_CMD_SETSIL"); |
| 302 | break; | 301 | break; |
| 303 | case ISDN_CMD_GETSIL: | 302 | case ISDN_CMD_GETSIL: |
| 304 | dbg(DEBUG_ANY, "ISDN_CMD_GETSIL"); | 303 | gig_dbg(DEBUG_ANY, "ISDN_CMD_GETSIL"); |
| 305 | break; | 304 | break; |
| 306 | default: | 305 | default: |
| 307 | err("unknown command %d from LL", | 306 | err("unknown command %d from LL", cntrl->command); |
| 308 | cntrl->command); | ||
| 309 | return -EINVAL; | 307 | return -EINVAL; |
| 310 | } | 308 | } |
| 311 | 309 | ||
| @@ -350,7 +348,8 @@ int gigaset_isdn_setup_dial(struct at_state_t *at_state, void *data) | |||
| 350 | proto = 2; /* 0: Bitsynchron, 1: HDLC, 2: voice */ | 348 | proto = 2; /* 0: Bitsynchron, 1: HDLC, 2: voice */ |
| 351 | break; | 349 | break; |
| 352 | default: | 350 | default: |
| 353 | err("invalid protocol: %u", bcs->proto2); | 351 | dev_err(bcs->cs->dev, "%s: invalid L2 protocol: %u\n", |
| 352 | __func__, bcs->proto2); | ||
| 354 | return -EINVAL; | 353 | return -EINVAL; |
| 355 | } | 354 | } |
| 356 | 355 | ||
| @@ -378,7 +377,7 @@ int gigaset_isdn_setup_dial(struct at_state_t *at_state, void *data) | |||
| 378 | bcs->commands[i] = NULL; | 377 | bcs->commands[i] = NULL; |
| 379 | if (length[i] && | 378 | if (length[i] && |
| 380 | !(bcs->commands[i] = kmalloc(length[i], GFP_ATOMIC))) { | 379 | !(bcs->commands[i] = kmalloc(length[i], GFP_ATOMIC))) { |
| 381 | err("out of memory"); | 380 | dev_err(bcs->cs->dev, "out of memory\n"); |
| 382 | return -ENOMEM; | 381 | return -ENOMEM; |
| 383 | } | 382 | } |
| 384 | } | 383 | } |
| @@ -396,10 +395,14 @@ int gigaset_isdn_setup_dial(struct at_state_t *at_state, void *data) | |||
| 396 | } | 395 | } |
| 397 | 396 | ||
| 398 | if (bcs->commands[AT_MSN]) | 397 | if (bcs->commands[AT_MSN]) |
| 399 | snprintf(bcs->commands[AT_MSN], length[AT_MSN], "^SMSN=%s\r", sp->eazmsn); | 398 | snprintf(bcs->commands[AT_MSN], length[AT_MSN], |
| 400 | snprintf(bcs->commands[AT_BC ], length[AT_BC ], "^SBC=%s\r", bc); | 399 | "^SMSN=%s\r", sp->eazmsn); |
| 401 | snprintf(bcs->commands[AT_PROTO], length[AT_PROTO], "^SBPR=%u\r", proto); | 400 | snprintf(bcs->commands[AT_BC ], length[AT_BC ], |
| 402 | snprintf(bcs->commands[AT_ISO ], length[AT_ISO ], "^SISO=%u\r", (unsigned)bcs->channel + 1); | 401 | "^SBC=%s\r", bc); |
| 402 | snprintf(bcs->commands[AT_PROTO], length[AT_PROTO], | ||
| 403 | "^SBPR=%u\r", proto); | ||
| 404 | snprintf(bcs->commands[AT_ISO ], length[AT_ISO ], | ||
| 405 | "^SISO=%u\r", (unsigned)bcs->channel + 1); | ||
| 403 | 406 | ||
| 404 | return 0; | 407 | return 0; |
| 405 | } | 408 | } |
| @@ -419,7 +422,8 @@ int gigaset_isdn_setup_accept(struct at_state_t *at_state) | |||
| 419 | proto = 2; /* 0: Bitsynchron, 1: HDLC, 2: voice */ | 422 | proto = 2; /* 0: Bitsynchron, 1: HDLC, 2: voice */ |
| 420 | break; | 423 | break; |
| 421 | default: | 424 | default: |
| 422 | err("invalid protocol: %u", bcs->proto2); | 425 | dev_err(at_state->cs->dev, "%s: invalid protocol: %u\n", |
| 426 | __func__, bcs->proto2); | ||
| 423 | return -EINVAL; | 427 | return -EINVAL; |
| 424 | } | 428 | } |
| 425 | 429 | ||
| @@ -436,13 +440,15 @@ int gigaset_isdn_setup_accept(struct at_state_t *at_state) | |||
| 436 | bcs->commands[i] = NULL; | 440 | bcs->commands[i] = NULL; |
| 437 | if (length[i] && | 441 | if (length[i] && |
| 438 | !(bcs->commands[i] = kmalloc(length[i], GFP_ATOMIC))) { | 442 | !(bcs->commands[i] = kmalloc(length[i], GFP_ATOMIC))) { |
| 439 | err("out of memory"); | 443 | dev_err(at_state->cs->dev, "out of memory\n"); |
| 440 | return -ENOMEM; | 444 | return -ENOMEM; |
| 441 | } | 445 | } |
| 442 | } | 446 | } |
| 443 | 447 | ||
| 444 | snprintf(bcs->commands[AT_PROTO], length[AT_PROTO], "^SBPR=%u\r", proto); | 448 | snprintf(bcs->commands[AT_PROTO], length[AT_PROTO], |
| 445 | snprintf(bcs->commands[AT_ISO ], length[AT_ISO ], "^SISO=%u\r", (unsigned) bcs->channel + 1); | 449 | "^SBPR=%u\r", proto); |
| 450 | snprintf(bcs->commands[AT_ISO ], length[AT_ISO ], | ||
| 451 | "^SISO=%u\r", (unsigned) bcs->channel + 1); | ||
| 446 | 452 | ||
| 447 | return 0; | 453 | return 0; |
| 448 | } | 454 | } |
| @@ -473,7 +479,7 @@ int gigaset_isdn_icall(struct at_state_t *at_state) | |||
| 473 | response.parm.setup.si1 = 1; | 479 | response.parm.setup.si1 = 1; |
| 474 | response.parm.setup.si2 = 2; | 480 | response.parm.setup.si2 = 2; |
| 475 | } else { | 481 | } else { |
| 476 | warn("RING ignored - unsupported BC %s", | 482 | dev_warn(cs->dev, "RING ignored - unsupported BC %s\n", |
| 477 | at_state->str_var[STR_ZBC]); | 483 | at_state->str_var[STR_ZBC]); |
| 478 | return ICALL_IGNORE; | 484 | return ICALL_IGNORE; |
| 479 | } | 485 | } |
| @@ -491,18 +497,17 @@ int gigaset_isdn_icall(struct at_state_t *at_state) | |||
| 491 | response.parm.setup.eazmsn[0] = 0; | 497 | response.parm.setup.eazmsn[0] = 0; |
| 492 | 498 | ||
| 493 | if (!bcs) { | 499 | if (!bcs) { |
| 494 | notice("no channel for incoming call"); | 500 | dev_notice(cs->dev, "no channel for incoming call\n"); |
| 495 | dbg(DEBUG_CMD, "Sending ICALLW"); | ||
| 496 | response.command = ISDN_STAT_ICALLW; | 501 | response.command = ISDN_STAT_ICALLW; |
| 497 | response.arg = 0; //FIXME | 502 | response.arg = 0; //FIXME |
| 498 | } else { | 503 | } else { |
| 499 | dbg(DEBUG_CMD, "Sending ICALL"); | 504 | gig_dbg(DEBUG_CMD, "Sending ICALL"); |
| 500 | response.command = ISDN_STAT_ICALL; | 505 | response.command = ISDN_STAT_ICALL; |
| 501 | response.arg = bcs->channel; //FIXME | 506 | response.arg = bcs->channel; //FIXME |
| 502 | } | 507 | } |
| 503 | response.driver = cs->myid; | 508 | response.driver = cs->myid; |
| 504 | retval = cs->iif.statcallb(&response); | 509 | retval = cs->iif.statcallb(&response); |
| 505 | dbg(DEBUG_CMD, "Response: %d", retval); | 510 | gig_dbg(DEBUG_CMD, "Response: %d", retval); |
| 506 | switch (retval) { | 511 | switch (retval) { |
| 507 | case 0: /* no takers */ | 512 | case 0: /* no takers */ |
| 508 | return ICALL_IGNORE; | 513 | return ICALL_IGNORE; |
| @@ -512,7 +517,8 @@ int gigaset_isdn_icall(struct at_state_t *at_state) | |||
| 512 | case 2: /* reject */ | 517 | case 2: /* reject */ |
| 513 | return ICALL_REJECT; | 518 | return ICALL_REJECT; |
| 514 | case 3: /* incomplete */ | 519 | case 3: /* incomplete */ |
| 515 | warn("LL requested unsupported feature: Incomplete Number"); | 520 | dev_warn(cs->dev, |
| 521 | "LL requested unsupported feature: Incomplete Number\n"); | ||
| 516 | return ICALL_IGNORE; | 522 | return ICALL_IGNORE; |
| 517 | case 4: /* proceeding */ | 523 | case 4: /* proceeding */ |
| 518 | /* Gigaset will send ALERTING anyway. | 524 | /* Gigaset will send ALERTING anyway. |
| @@ -520,10 +526,11 @@ int gigaset_isdn_icall(struct at_state_t *at_state) | |||
| 520 | */ | 526 | */ |
| 521 | return ICALL_ACCEPT; | 527 | return ICALL_ACCEPT; |
| 522 | case 5: /* deflect */ | 528 | case 5: /* deflect */ |
| 523 | warn("LL requested unsupported feature: Call Deflection"); | 529 | dev_warn(cs->dev, |
| 530 | "LL requested unsupported feature: Call Deflection\n"); | ||
| 524 | return ICALL_IGNORE; | 531 | return ICALL_IGNORE; |
| 525 | default: | 532 | default: |
| 526 | err("LL error %d on ICALL", retval); | 533 | dev_err(cs->dev, "LL error %d on ICALL\n", retval); |
| 527 | return ICALL_IGNORE; | 534 | return ICALL_IGNORE; |
| 528 | } | 535 | } |
| 529 | } | 536 | } |
| @@ -533,7 +540,7 @@ int gigaset_register_to_LL(struct cardstate *cs, const char *isdnid) | |||
| 533 | { | 540 | { |
| 534 | isdn_if *iif = &cs->iif; | 541 | isdn_if *iif = &cs->iif; |
| 535 | 542 | ||
| 536 | dbg(DEBUG_ANY, "Register driver capabilities to LL"); | 543 | gig_dbg(DEBUG_ANY, "Register driver capabilities to LL"); |
| 537 | 544 | ||
| 538 | //iif->id[sizeof(iif->id) - 1]=0; | 545 | //iif->id[sizeof(iif->id) - 1]=0; |
| 539 | //strncpy(iif->id, isdnid, sizeof(iif->id) - 1); | 546 | //strncpy(iif->id, isdnid, sizeof(iif->id) - 1); |
| @@ -542,26 +549,26 @@ int gigaset_register_to_LL(struct cardstate *cs, const char *isdnid) | |||
| 542 | return -ENOMEM; //FIXME EINVAL/...?? | 549 | return -ENOMEM; //FIXME EINVAL/...?? |
| 543 | 550 | ||
| 544 | iif->owner = THIS_MODULE; | 551 | iif->owner = THIS_MODULE; |
| 545 | iif->channels = cs->channels; /* I am supporting just one channel *//* I was supporting...*/ | 552 | iif->channels = cs->channels; |
| 546 | iif->maxbufsize = MAX_BUF_SIZE; | 553 | iif->maxbufsize = MAX_BUF_SIZE; |
| 547 | iif->features = ISDN_FEATURE_L2_TRANS | /* Our device is very advanced, therefore */ | 554 | iif->features = ISDN_FEATURE_L2_TRANS | |
| 548 | ISDN_FEATURE_L2_HDLC | | 555 | ISDN_FEATURE_L2_HDLC | |
| 549 | #ifdef GIG_X75 | 556 | #ifdef GIG_X75 |
| 550 | ISDN_FEATURE_L2_X75I | | 557 | ISDN_FEATURE_L2_X75I | |
| 551 | #endif | 558 | #endif |
| 552 | ISDN_FEATURE_L3_TRANS | | 559 | ISDN_FEATURE_L3_TRANS | |
| 553 | ISDN_FEATURE_P_EURO; | 560 | ISDN_FEATURE_P_EURO; |
| 554 | iif->hl_hdrlen = HW_HDR_LEN; /* Area for storing ack */ | 561 | iif->hl_hdrlen = HW_HDR_LEN; /* Area for storing ack */ |
| 555 | iif->command = command_from_LL; | 562 | iif->command = command_from_LL; |
| 556 | iif->writebuf_skb = writebuf_from_LL; | 563 | iif->writebuf_skb = writebuf_from_LL; |
| 557 | iif->writecmd = NULL; /* Don't support isdnctrl */ | 564 | iif->writecmd = NULL; /* Don't support isdnctrl */ |
| 558 | iif->readstat = NULL; /* Don't support isdnctrl */ | 565 | iif->readstat = NULL; /* Don't support isdnctrl */ |
| 559 | iif->rcvcallb_skb = NULL; /* Will be set by LL */ | 566 | iif->rcvcallb_skb = NULL; /* Will be set by LL */ |
| 560 | iif->statcallb = NULL; /* Will be set by LL */ | 567 | iif->statcallb = NULL; /* Will be set by LL */ |
| 561 | 568 | ||
| 562 | if (!register_isdn(iif)) | 569 | if (!register_isdn(iif)) |
| 563 | return 0; | 570 | return 0; |
| 564 | 571 | ||
| 565 | cs->myid = iif->channels; /* Set my device id */ | 572 | cs->myid = iif->channels; /* Set my device id */ |
| 566 | return 1; | 573 | return 1; |
| 567 | } | 574 | } |
