aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/isdn/gigaset/ev-layer.c478
1 files changed, 231 insertions, 247 deletions
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c
index 369927f90729..a9a397519bac 100644
--- a/drivers/isdn/gigaset/ev-layer.c
+++ b/drivers/isdn/gigaset/ev-layer.c
@@ -40,8 +40,8 @@
40 40
41/* Possible ASCII responses */ 41/* Possible ASCII responses */
42#define RSP_OK 0 42#define RSP_OK 0
43//#define RSP_BUSY 1 43#define RSP_BUSY 1
44//#define RSP_CONNECT 2 44#define RSP_CONNECT 2
45#define RSP_ZGCI 3 45#define RSP_ZGCI 3
46#define RSP_RING 4 46#define RSP_RING 4
47#define RSP_ZAOC 5 47#define RSP_ZAOC 5
@@ -68,7 +68,6 @@
68#define RSP_ZHLC (RSP_STR + STR_ZHLC) 68#define RSP_ZHLC (RSP_STR + STR_ZHLC)
69#define RSP_ERROR -1 /* ERROR */ 69#define RSP_ERROR -1 /* ERROR */
70#define RSP_WRONG_CID -2 /* unknown cid in cmd */ 70#define RSP_WRONG_CID -2 /* unknown cid in cmd */
71//#define RSP_EMPTY -3
72#define RSP_UNKNOWN -4 /* unknown response */ 71#define RSP_UNKNOWN -4 /* unknown response */
73#define RSP_FAIL -5 /* internal error */ 72#define RSP_FAIL -5 /* internal error */
74#define RSP_INVAL -6 /* invalid response */ 73#define RSP_INVAL -6 /* invalid response */
@@ -76,9 +75,9 @@
76#define RSP_NONE -19 75#define RSP_NONE -19
77#define RSP_STRING -20 76#define RSP_STRING -20
78#define RSP_NULL -21 77#define RSP_NULL -21
79//#define RSP_RETRYFAIL -22 78#define RSP_RETRYFAIL -22
80//#define RSP_RETRY -23 79#define RSP_RETRY -23
81//#define RSP_SKIP -24 80#define RSP_SKIP -24
82#define RSP_INIT -27 81#define RSP_INIT -27
83#define RSP_ANY -26 82#define RSP_ANY -26
84#define RSP_LAST -28 83#define RSP_LAST -28
@@ -158,229 +157,225 @@
158#define SEQ_UMMODE 11 157#define SEQ_UMMODE 11
159 158
160 159
161// 100: init, 200: dle0, 250:dle1, 300: get cid (dial), 350: "hup" (no cid), 400: hup, 500: reset, 600: dial, 700: ring 160/* 100: init, 200: dle0, 250:dle1, 300: get cid (dial), 350: "hup" (no cid),
161 * 400: hup, 500: reset, 600: dial, 700: ring */
162struct reply_t gigaset_tab_nocid[] = 162struct reply_t gigaset_tab_nocid[] =
163{ 163{
164 /* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout, action, command */ 164/* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout,
165 165 * action, command */
166 /* initialize device, set cid mode if possible */ 166
167 //{RSP_INIT, -1, -1,100, 900, 0, {ACT_TEST}}, 167/* initialize device, set cid mode if possible */
168 //{RSP_ERROR, 900,900, -1, 0, 0, {ACT_FAILINIT}}, 168{RSP_INIT, -1, -1, SEQ_INIT, 100, 1, {ACT_TIMEOUT} },
169 //{RSP_OK, 900,900, -1, 100, INIT_TIMEOUT, 169
170 // {ACT_TIMEOUT}}, 170{EV_TIMEOUT, 100, 100, -1, 101, 3, {0}, "Z\r"},
171 171{RSP_OK, 101, 103, -1, 120, 5, {ACT_GETSTRING},
172 {RSP_INIT, -1, -1,SEQ_INIT, 100, INIT_TIMEOUT, 172 "+GMR\r"},
173 {ACT_TIMEOUT}}, /* wait until device is ready */ 173
174 174{EV_TIMEOUT, 101, 101, -1, 102, 5, {0}, "Z\r"},
175 {EV_TIMEOUT, 100,100, -1, 101, 3, {0}, "Z\r"}, /* device in transparent mode? try to initialize it. */ 175{RSP_ERROR, 101, 101, -1, 102, 5, {0}, "Z\r"},
176 {RSP_OK, 101,103, -1, 120, 5, {ACT_GETSTRING}, "+GMR\r"}, /* get version */ 176
177 177{EV_TIMEOUT, 102, 102, -1, 108, 5, {ACT_SETDLE1},
178 {EV_TIMEOUT, 101,101, -1, 102, 5, {0}, "Z\r"}, /* timeout => try once again. */ 178 "^SDLE=0\r"},
179 {RSP_ERROR, 101,101, -1, 102, 5, {0}, "Z\r"}, /* error => try once again. */ 179{RSP_OK, 108, 108, -1, 104, -1},
180 180{RSP_ZDLE, 104, 104, 0, 103, 5, {0}, "Z\r"},
181 {EV_TIMEOUT, 102,102, -1, 108, 5, {ACT_SETDLE1}, "^SDLE=0\r"}, /* timeout => try again in DLE mode. */ 181{EV_TIMEOUT, 104, 104, -1, 0, 0, {ACT_FAILINIT} },
182 {RSP_OK, 108,108, -1, 104,-1}, 182{RSP_ERROR, 108, 108, -1, 0, 0, {ACT_FAILINIT} },
183 {RSP_ZDLE, 104,104, 0, 103, 5, {0}, "Z\r"}, 183
184 {EV_TIMEOUT, 104,104, -1, 0, 0, {ACT_FAILINIT}}, 184{EV_TIMEOUT, 108, 108, -1, 105, 2, {ACT_SETDLE0,
185 {RSP_ERROR, 108,108, -1, 0, 0, {ACT_FAILINIT}}, 185 ACT_HUPMODEM,
186 186 ACT_TIMEOUT} },
187 {EV_TIMEOUT, 108,108, -1, 105, 2, {ACT_SETDLE0, 187{EV_TIMEOUT, 105, 105, -1, 103, 5, {0}, "Z\r"},
188 ACT_HUPMODEM, 188
189 ACT_TIMEOUT}}, /* still timeout => connection in unimodem mode? */ 189{RSP_ERROR, 102, 102, -1, 107, 5, {0}, "^GETPRE\r"},
190 {EV_TIMEOUT, 105,105, -1, 103, 5, {0}, "Z\r"}, 190{RSP_OK, 107, 107, -1, 0, 0, {ACT_CONFIGMODE} },
191 191{RSP_ERROR, 107, 107, -1, 0, 0, {ACT_FAILINIT} },
192 {RSP_ERROR, 102,102, -1, 107, 5, {0}, "^GETPRE\r"}, /* ERROR on ATZ => maybe in config mode? */ 192{EV_TIMEOUT, 107, 107, -1, 0, 0, {ACT_FAILINIT} },
193 {RSP_OK, 107,107, -1, 0, 0, {ACT_CONFIGMODE}}, 193
194 {RSP_ERROR, 107,107, -1, 0, 0, {ACT_FAILINIT}}, 194{RSP_ERROR, 103, 103, -1, 0, 0, {ACT_FAILINIT} },
195 {EV_TIMEOUT, 107,107, -1, 0, 0, {ACT_FAILINIT}}, 195{EV_TIMEOUT, 103, 103, -1, 0, 0, {ACT_FAILINIT} },
196 196
197 {RSP_ERROR, 103,103, -1, 0, 0, {ACT_FAILINIT}}, 197{RSP_STRING, 120, 120, -1, 121, -1, {ACT_SETVER} },
198 {EV_TIMEOUT, 103,103, -1, 0, 0, {ACT_FAILINIT}}, 198
199 199{EV_TIMEOUT, 120, 121, -1, 0, 0, {ACT_FAILVER,
200 {RSP_STRING, 120,120, -1, 121,-1, {ACT_SETVER}}, 200 ACT_INIT} },
201 201{RSP_ERROR, 120, 121, -1, 0, 0, {ACT_FAILVER,
202 {EV_TIMEOUT, 120,121, -1, 0, 0, {ACT_FAILVER, ACT_INIT}}, 202 ACT_INIT} },
203 {RSP_ERROR, 120,121, -1, 0, 0, {ACT_FAILVER, ACT_INIT}}, 203{RSP_OK, 121, 121, -1, 0, 0, {ACT_GOTVER,
204 {RSP_OK, 121,121, -1, 0, 0, {ACT_GOTVER, ACT_INIT}}, 204 ACT_INIT} },
205 205
206 /* leave dle mode */ 206/* leave dle mode */
207 {RSP_INIT, 0, 0,SEQ_DLE0, 201, 5, {0}, "^SDLE=0\r"}, 207{RSP_INIT, 0, 0, SEQ_DLE0, 201, 5, {0}, "^SDLE=0\r"},
208 {RSP_OK, 201,201, -1, 202,-1}, 208{RSP_OK, 201, 201, -1, 202, -1},
209 {RSP_ZDLE, 202,202, 0, 0, 0, {ACT_DLE0}}, 209{RSP_ZDLE, 202, 202, 0, 0, 0, {ACT_DLE0} },
210 {RSP_NODEV, 200,249, -1, 0, 0, {ACT_FAKEDLE0}}, 210{RSP_NODEV, 200, 249, -1, 0, 0, {ACT_FAKEDLE0} },
211 {RSP_ERROR, 200,249, -1, 0, 0, {ACT_FAILDLE0}}, 211{RSP_ERROR, 200, 249, -1, 0, 0, {ACT_FAILDLE0} },
212 {EV_TIMEOUT, 200,249, -1, 0, 0, {ACT_FAILDLE0}}, 212{EV_TIMEOUT, 200, 249, -1, 0, 0, {ACT_FAILDLE0} },
213 213
214 /* enter dle mode */ 214/* enter dle mode */
215 {RSP_INIT, 0, 0,SEQ_DLE1, 251, 5, {0}, "^SDLE=1\r"}, 215{RSP_INIT, 0, 0, SEQ_DLE1, 251, 5, {0}, "^SDLE=1\r"},
216 {RSP_OK, 251,251, -1, 252,-1}, 216{RSP_OK, 251, 251, -1, 252, -1},
217 {RSP_ZDLE, 252,252, 1, 0, 0, {ACT_DLE1}}, 217{RSP_ZDLE, 252, 252, 1, 0, 0, {ACT_DLE1} },
218 {RSP_ERROR, 250,299, -1, 0, 0, {ACT_FAILDLE1}}, 218{RSP_ERROR, 250, 299, -1, 0, 0, {ACT_FAILDLE1} },
219 {EV_TIMEOUT, 250,299, -1, 0, 0, {ACT_FAILDLE1}}, 219{EV_TIMEOUT, 250, 299, -1, 0, 0, {ACT_FAILDLE1} },
220 220
221 /* incoming call */ 221/* incoming call */
222 {RSP_RING, -1, -1, -1, -1,-1, {ACT_RING}}, 222{RSP_RING, -1, -1, -1, -1, -1, {ACT_RING} },
223 223
224 /* get cid */ 224/* get cid */
225 //{RSP_INIT, 0, 0,300, 901, 0, {ACT_TEST}}, 225{RSP_INIT, 0, 0, SEQ_CID, 301, 5, {0}, "^SGCI?\r"},
226 //{RSP_ERROR, 901,901, -1, 0, 0, {ACT_FAILCID}}, 226{RSP_OK, 301, 301, -1, 302, -1},
227 //{RSP_OK, 901,901, -1, 301, 5, {0}, "^SGCI?\r"}, 227{RSP_ZGCI, 302, 302, -1, 0, 0, {ACT_CID} },
228 228{RSP_ERROR, 301, 349, -1, 0, 0, {ACT_FAILCID} },
229 {RSP_INIT, 0, 0,SEQ_CID, 301, 5, {0}, "^SGCI?\r"}, 229{EV_TIMEOUT, 301, 349, -1, 0, 0, {ACT_FAILCID} },
230 {RSP_OK, 301,301, -1, 302,-1}, 230
231 {RSP_ZGCI, 302,302, -1, 0, 0, {ACT_CID}}, 231/* enter cid mode */
232 {RSP_ERROR, 301,349, -1, 0, 0, {ACT_FAILCID}}, 232{RSP_INIT, 0, 0, SEQ_CIDMODE, 150, 5, {0}, "^SGCI=1\r"},
233 {EV_TIMEOUT, 301,349, -1, 0, 0, {ACT_FAILCID}}, 233{RSP_OK, 150, 150, -1, 0, 0, {ACT_CMODESET} },
234 234{RSP_ERROR, 150, 150, -1, 0, 0, {ACT_FAILCMODE} },
235 /* enter cid mode */ 235{EV_TIMEOUT, 150, 150, -1, 0, 0, {ACT_FAILCMODE} },
236 {RSP_INIT, 0, 0,SEQ_CIDMODE, 150, 5, {0}, "^SGCI=1\r"}, 236
237 {RSP_OK, 150,150, -1, 0, 0, {ACT_CMODESET}}, 237/* leave cid mode */
238 {RSP_ERROR, 150,150, -1, 0, 0, {ACT_FAILCMODE}}, 238{RSP_INIT, 0, 0, SEQ_UMMODE, 160, 5, {0}, "Z\r"},
239 {EV_TIMEOUT, 150,150, -1, 0, 0, {ACT_FAILCMODE}}, 239{RSP_OK, 160, 160, -1, 0, 0, {ACT_UMODESET} },
240 240{RSP_ERROR, 160, 160, -1, 0, 0, {ACT_FAILUMODE} },
241 /* leave cid mode */ 241{EV_TIMEOUT, 160, 160, -1, 0, 0, {ACT_FAILUMODE} },
242 //{RSP_INIT, 0, 0,SEQ_UMMODE, 160, 5, {0}, "^SGCI=0\r"}, 242
243 {RSP_INIT, 0, 0,SEQ_UMMODE, 160, 5, {0}, "Z\r"}, 243/* abort getting cid */
244 {RSP_OK, 160,160, -1, 0, 0, {ACT_UMODESET}}, 244{RSP_INIT, 0, 0, SEQ_NOCID, 0, 0, {ACT_ABORTCID} },
245 {RSP_ERROR, 160,160, -1, 0, 0, {ACT_FAILUMODE}}, 245
246 {EV_TIMEOUT, 160,160, -1, 0, 0, {ACT_FAILUMODE}}, 246/* reset */
247 247{RSP_INIT, 0, 0, SEQ_SHUTDOWN, 504, 5, {0}, "Z\r"},
248 /* abort getting cid */ 248{RSP_OK, 504, 504, -1, 0, 0, {ACT_SDOWN} },
249 {RSP_INIT, 0, 0,SEQ_NOCID, 0, 0, {ACT_ABORTCID}}, 249{RSP_ERROR, 501, 599, -1, 0, 0, {ACT_FAILSDOWN} },
250 250{EV_TIMEOUT, 501, 599, -1, 0, 0, {ACT_FAILSDOWN} },
251 /* reset */ 251{RSP_NODEV, 501, 599, -1, 0, 0, {ACT_FAKESDOWN} },
252 {RSP_INIT, 0, 0,SEQ_SHUTDOWN, 504, 5, {0}, "Z\r"}, 252
253 {RSP_OK, 504,504, -1, 0, 0, {ACT_SDOWN}}, 253{EV_PROC_CIDMODE, -1, -1, -1, -1, -1, {ACT_PROC_CIDMODE} },
254 {RSP_ERROR, 501,599, -1, 0, 0, {ACT_FAILSDOWN}}, 254{EV_IF_LOCK, -1, -1, -1, -1, -1, {ACT_IF_LOCK} },
255 {EV_TIMEOUT, 501,599, -1, 0, 0, {ACT_FAILSDOWN}}, 255{EV_IF_VER, -1, -1, -1, -1, -1, {ACT_IF_VER} },
256 {RSP_NODEV, 501,599, -1, 0, 0, {ACT_FAKESDOWN}}, 256{EV_START, -1, -1, -1, -1, -1, {ACT_START} },
257 257{EV_STOP, -1, -1, -1, -1, -1, {ACT_STOP} },
258 {EV_PROC_CIDMODE,-1, -1, -1, -1,-1, {ACT_PROC_CIDMODE}}, //FIXME 258{EV_SHUTDOWN, -1, -1, -1, -1, -1, {ACT_SHUTDOWN} },
259 {EV_IF_LOCK, -1, -1, -1, -1,-1, {ACT_IF_LOCK}}, //FIXME 259
260 {EV_IF_VER, -1, -1, -1, -1,-1, {ACT_IF_VER}}, //FIXME 260/* misc. */
261 {EV_START, -1, -1, -1, -1,-1, {ACT_START}}, //FIXME 261{RSP_ERROR, -1, -1, -1, -1, -1, {ACT_ERROR} },
262 {EV_STOP, -1, -1, -1, -1,-1, {ACT_STOP}}, //FIXME 262{RSP_ZCFGT, -1, -1, -1, -1, -1, {ACT_DEBUG} },
263 {EV_SHUTDOWN, -1, -1, -1, -1,-1, {ACT_SHUTDOWN}}, //FIXME 263{RSP_ZCFG, -1, -1, -1, -1, -1, {ACT_DEBUG} },
264 264{RSP_ZLOG, -1, -1, -1, -1, -1, {ACT_DEBUG} },
265 /* misc. */ 265{RSP_ZMWI, -1, -1, -1, -1, -1, {ACT_DEBUG} },
266 {RSP_ERROR, -1, -1, -1, -1, -1, {ACT_ERROR} }, 266{RSP_ZABINFO, -1, -1, -1, -1, -1, {ACT_DEBUG} },
267 {RSP_EMPTY, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME 267{RSP_ZSMLSTCHG, -1, -1, -1, -1, -1, {ACT_DEBUG} },
268 {RSP_ZCFGT, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME 268
269 {RSP_ZCFG, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME 269{RSP_ZCAU, -1, -1, -1, -1, -1, {ACT_ZCAU} },
270 {RSP_ZLOG, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME 270{RSP_NONE, -1, -1, -1, -1, -1, {ACT_DEBUG} },
271 {RSP_ZMWI, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME 271{RSP_ANY, -1, -1, -1, -1, -1, {ACT_WARN} },
272 {RSP_ZABINFO, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME 272{RSP_LAST}
273 {RSP_ZSMLSTCHG,-1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME
274
275 {RSP_ZCAU, -1, -1, -1, -1,-1, {ACT_ZCAU}},
276 {RSP_NONE, -1, -1, -1, -1,-1, {ACT_DEBUG}},
277 {RSP_ANY, -1, -1, -1, -1,-1, {ACT_WARN}},
278 {RSP_LAST}
279}; 273};
280 274
281// 600: start dialing, 650: dial in progress, 800: connection is up, 700: ring, 400: hup, 750: accepted icall 275/* 600: start dialing, 650: dial in progress, 800: connection is up, 700: ring,
276 * 400: hup, 750: accepted icall */
282struct reply_t gigaset_tab_cid[] = 277struct reply_t gigaset_tab_cid[] =
283{ 278{
284 /* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout, action, command */ 279/* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout,
285 280 * action, command */
286 /* dial */ 281
287 {EV_DIAL, -1, -1, -1, -1,-1, {ACT_DIAL}}, //FIXME 282/* dial */
288 {RSP_INIT, 0, 0,SEQ_DIAL, 601, 5, {ACT_CMD+AT_BC}}, 283{EV_DIAL, -1, -1, -1, -1, -1, {ACT_DIAL} },
289 {RSP_OK, 601,601, -1, 602, 5, {ACT_CMD+AT_HLC}}, 284{RSP_INIT, 0, 0, SEQ_DIAL, 601, 5, {ACT_CMD+AT_BC} },
290 {RSP_NULL, 602,602, -1, 603, 5, {ACT_CMD+AT_PROTO}}, 285{RSP_OK, 601, 601, -1, 602, 5, {ACT_CMD+AT_HLC} },
291 {RSP_OK, 602,602, -1, 603, 5, {ACT_CMD+AT_PROTO}}, 286{RSP_NULL, 602, 602, -1, 603, 5, {ACT_CMD+AT_PROTO} },
292 {RSP_OK, 603,603, -1, 604, 5, {ACT_CMD+AT_TYPE}}, 287{RSP_OK, 602, 602, -1, 603, 5, {ACT_CMD+AT_PROTO} },
293 {RSP_OK, 604,604, -1, 605, 5, {ACT_CMD+AT_MSN}}, 288{RSP_OK, 603, 603, -1, 604, 5, {ACT_CMD+AT_TYPE} },
294 {RSP_NULL, 605, 605, -1, 606, 5, {ACT_CMD+AT_CLIP} }, 289{RSP_OK, 604, 604, -1, 605, 5, {ACT_CMD+AT_MSN} },
295 {RSP_OK, 605, 605, -1, 606, 5, {ACT_CMD+AT_CLIP} }, 290{RSP_NULL, 605, 605, -1, 606, 5, {ACT_CMD+AT_CLIP} },
296 {RSP_NULL, 606, 606, -1, 607, 5, {ACT_CMD+AT_ISO} }, 291{RSP_OK, 605, 605, -1, 606, 5, {ACT_CMD+AT_CLIP} },
297 {RSP_OK, 606, 606, -1, 607, 5, {ACT_CMD+AT_ISO} }, 292{RSP_NULL, 606, 606, -1, 607, 5, {ACT_CMD+AT_ISO} },
298 {RSP_OK, 607, 607, -1, 608, 5, {0}, "+VLS=17\r"}, 293{RSP_OK, 606, 606, -1, 607, 5, {ACT_CMD+AT_ISO} },
299 {RSP_OK, 608, 608, -1, 609, -1}, 294{RSP_OK, 607, 607, -1, 608, 5, {0}, "+VLS=17\r"},
300 {RSP_ZSAU, 609, 609, ZSAU_PROCEEDING, 610, 5, {ACT_CMD+AT_DIAL} }, 295{RSP_OK, 608, 608, -1, 609, -1},
301 {RSP_OK, 610, 610, -1, 650, 0, {ACT_DIALING} }, 296{RSP_ZSAU, 609, 609, ZSAU_PROCEEDING, 610, 5, {ACT_CMD+AT_DIAL} },
302 297{RSP_OK, 610, 610, -1, 650, 0, {ACT_DIALING} },
303 {RSP_ERROR, 601, 610, -1, 0, 0, {ACT_ABORTDIAL} }, 298
304 {EV_TIMEOUT, 601, 610, -1, 0, 0, {ACT_ABORTDIAL} }, 299{RSP_ERROR, 601, 610, -1, 0, 0, {ACT_ABORTDIAL} },
305 300{EV_TIMEOUT, 601, 610, -1, 0, 0, {ACT_ABORTDIAL} },
306 /* optional dialing responses */ 301
307 {EV_BC_OPEN, 650,650, -1, 651,-1}, 302/* optional dialing responses */
308 {RSP_ZVLS, 609, 651, 17, -1, -1, {ACT_DEBUG} }, 303{EV_BC_OPEN, 650, 650, -1, 651, -1},
309 {RSP_ZCTP, 610, 651, -1, -1, -1, {ACT_DEBUG} }, 304{RSP_ZVLS, 609, 651, 17, -1, -1, {ACT_DEBUG} },
310 {RSP_ZCPN, 610, 651, -1, -1, -1, {ACT_DEBUG} }, 305{RSP_ZCTP, 610, 651, -1, -1, -1, {ACT_DEBUG} },
311 {RSP_ZSAU, 650,651,ZSAU_CALL_DELIVERED, -1,-1, {ACT_DEBUG}}, 306{RSP_ZCPN, 610, 651, -1, -1, -1, {ACT_DEBUG} },
312 307{RSP_ZSAU, 650, 651, ZSAU_CALL_DELIVERED, -1, -1, {ACT_DEBUG} },
313 /* connect */ 308
314 {RSP_ZSAU, 650,650,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}}, 309/* connect */
315 {RSP_ZSAU, 651,651,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT, 310{RSP_ZSAU, 650, 650, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT} },
316 ACT_NOTIFY_BC_UP}}, 311{RSP_ZSAU, 651, 651, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT,
317 {RSP_ZSAU, 750,750,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}}, 312 ACT_NOTIFY_BC_UP} },
318 {RSP_ZSAU, 751,751,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT, 313{RSP_ZSAU, 750, 750, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT} },
319 ACT_NOTIFY_BC_UP}}, 314{RSP_ZSAU, 751, 751, ZSAU_ACTIVE, 800, -1, {ACT_CONNECT,
320 {EV_BC_OPEN, 800,800, -1, 800,-1, {ACT_NOTIFY_BC_UP}}, 315 ACT_NOTIFY_BC_UP} },
321 316{EV_BC_OPEN, 800, 800, -1, 800, -1, {ACT_NOTIFY_BC_UP} },
322 /* remote hangup */ 317
323 {RSP_ZSAU, 650,651,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEREJECT}}, 318/* remote hangup */
324 {RSP_ZSAU, 750,751,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP}}, 319{RSP_ZSAU, 650, 651, ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEREJECT} },
325 {RSP_ZSAU, 800,800,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP}}, 320{RSP_ZSAU, 750, 751, ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP} },
326 321{RSP_ZSAU, 800, 800, ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP} },
327 /* hangup */ 322
328 {EV_HUP, -1, -1, -1, -1,-1, {ACT_HUP}}, //FIXME 323/* hangup */
329 {RSP_INIT, -1, -1,SEQ_HUP, 401, 5, {0}, "+VLS=0\r"}, /* hang up */ //-1,-1? 324{EV_HUP, -1, -1, -1, -1, -1, {ACT_HUP} },
330 {RSP_OK, 401,401, -1, 402, 5}, 325{RSP_INIT, -1, -1, SEQ_HUP, 401, 5, {0}, "+VLS=0\r"},
331 {RSP_ZVLS, 402,402, 0, 403, 5}, 326{RSP_OK, 401, 401, -1, 402, 5},
332 {RSP_ZSAU, 403, 403, ZSAU_DISCONNECT_REQ, -1, -1, {ACT_DEBUG} }, 327{RSP_ZVLS, 402, 402, 0, 403, 5},
333 {RSP_ZSAU, 403, 403, ZSAU_NULL, 0, 0, {ACT_DISCONNECT} }, 328{RSP_ZSAU, 403, 403, ZSAU_DISCONNECT_REQ, -1, -1, {ACT_DEBUG} },
334 {RSP_NODEV, 401, 403, -1, 0, 0, {ACT_FAKEHUP} }, 329{RSP_ZSAU, 403, 403, ZSAU_NULL, 0, 0, {ACT_DISCONNECT} },
335 {RSP_ERROR, 401,401, -1, 0, 0, {ACT_ABORTHUP}}, 330{RSP_NODEV, 401, 403, -1, 0, 0, {ACT_FAKEHUP} },
336 {EV_TIMEOUT, 401,403, -1, 0, 0, {ACT_ABORTHUP}}, 331{RSP_ERROR, 401, 401, -1, 0, 0, {ACT_ABORTHUP} },
337 332{EV_TIMEOUT, 401, 403, -1, 0, 0, {ACT_ABORTHUP} },
338 {EV_BC_CLOSED, 0, 0, -1, 0,-1, {ACT_NOTIFY_BC_DOWN}}, //FIXME new constate + timeout 333
339 334{EV_BC_CLOSED, 0, 0, -1, 0, -1, {ACT_NOTIFY_BC_DOWN} },
340 /* ring */ 335
341 {RSP_ZBC, 700,700, -1, -1,-1, {0}}, 336/* ring */
342 {RSP_ZHLC, 700,700, -1, -1,-1, {0}}, 337{RSP_ZBC, 700, 700, -1, -1, -1, {0} },
343 {RSP_NMBR, 700,700, -1, -1,-1, {0}}, 338{RSP_ZHLC, 700, 700, -1, -1, -1, {0} },
344 {RSP_ZCPN, 700,700, -1, -1,-1, {0}}, 339{RSP_NMBR, 700, 700, -1, -1, -1, {0} },
345 {RSP_ZCTP, 700,700, -1, -1,-1, {0}}, 340{RSP_ZCPN, 700, 700, -1, -1, -1, {0} },
346 {EV_TIMEOUT, 700,700, -1, 720,720, {ACT_ICALL}}, 341{RSP_ZCTP, 700, 700, -1, -1, -1, {0} },
347 {EV_BC_CLOSED,720,720, -1, 0,-1, {ACT_NOTIFY_BC_DOWN}}, 342{EV_TIMEOUT, 700, 700, -1, 720, 720, {ACT_ICALL} },
348 343{EV_BC_CLOSED, 720, 720, -1, 0, -1, {ACT_NOTIFY_BC_DOWN} },
349 /*accept icall*/ 344
350 {EV_ACCEPT, -1, -1, -1, -1,-1, {ACT_ACCEPT}}, //FIXME 345/*accept icall*/
351 {RSP_INIT, 720,720,SEQ_ACCEPT, 721, 5, {ACT_CMD+AT_PROTO}}, 346{EV_ACCEPT, -1, -1, -1, -1, -1, {ACT_ACCEPT} },
352 {RSP_OK, 721,721, -1, 722, 5, {ACT_CMD+AT_ISO}}, 347{RSP_INIT, 720, 720, SEQ_ACCEPT, 721, 5, {ACT_CMD+AT_PROTO} },
353 {RSP_OK, 722,722, -1, 723, 5, {0}, "+VLS=17\r"}, /* set "Endgeraetemodus" */ 348{RSP_OK, 721, 721, -1, 722, 5, {ACT_CMD+AT_ISO} },
354 {RSP_OK, 723,723, -1, 724, 5, {0}}, 349{RSP_OK, 722, 722, -1, 723, 5, {0}, "+VLS=17\r"},
355 {RSP_ZVLS, 724,724, 17, 750,50, {ACT_ACCEPTED}}, 350{RSP_OK, 723, 723, -1, 724, 5, {0} },
356 {RSP_ERROR, 721,729, -1, 0, 0, {ACT_ABORTACCEPT}}, 351{RSP_ZVLS, 724, 724, 17, 750, 50, {ACT_ACCEPTED} },
357 {EV_TIMEOUT, 721,729, -1, 0, 0, {ACT_ABORTACCEPT}}, 352{RSP_ERROR, 721, 729, -1, 0, 0, {ACT_ABORTACCEPT} },
358 {RSP_ZSAU, 700,729,ZSAU_NULL, 0, 0, {ACT_ABORTACCEPT}}, 353{EV_TIMEOUT, 721, 729, -1, 0, 0, {ACT_ABORTACCEPT} },
359 {RSP_ZSAU, 700,729,ZSAU_ACTIVE, 0, 0, {ACT_ABORTACCEPT}}, 354{RSP_ZSAU, 700, 729, ZSAU_NULL, 0, 0, {ACT_ABORTACCEPT} },
360 {RSP_ZSAU, 700,729,ZSAU_DISCONNECT_IND, 0, 0, {ACT_ABORTACCEPT}}, 355{RSP_ZSAU, 700, 729, ZSAU_ACTIVE, 0, 0, {ACT_ABORTACCEPT} },
361 356{RSP_ZSAU, 700, 729, ZSAU_DISCONNECT_IND, 0, 0, {ACT_ABORTACCEPT} },
362 {EV_BC_OPEN, 750,750, -1, 751,-1}, 357
363 {EV_TIMEOUT, 750,751, -1, 0, 0, {ACT_CONNTIMEOUT}}, 358{EV_BC_OPEN, 750, 750, -1, 751, -1},
364 359{EV_TIMEOUT, 750, 751, -1, 0, 0, {ACT_CONNTIMEOUT} },
365 /* B channel closed (general case) */ 360
366 {EV_BC_CLOSED, -1, -1, -1, -1,-1, {ACT_NOTIFY_BC_DOWN}}, //FIXME 361/* B channel closed (general case) */
367 362{EV_BC_CLOSED, -1, -1, -1, -1, -1, {ACT_NOTIFY_BC_DOWN} },
368 /* misc. */ 363
369 {RSP_ZCON, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME 364/* misc. */
370 {RSP_ZCCR, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME 365{RSP_ZCON, -1, -1, -1, -1, -1, {ACT_DEBUG} },
371 {RSP_ZAOC, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME 366{RSP_ZCCR, -1, -1, -1, -1, -1, {ACT_DEBUG} },
372 {RSP_ZCSTR, -1, -1, -1, -1,-1, {ACT_DEBUG}}, //FIXME 367{RSP_ZAOC, -1, -1, -1, -1, -1, {ACT_DEBUG} },
373 368{RSP_ZCSTR, -1, -1, -1, -1, -1, {ACT_DEBUG} },
374 {RSP_ZCAU, -1, -1, -1, -1,-1, {ACT_ZCAU}}, 369
375 {RSP_NONE, -1, -1, -1, -1,-1, {ACT_DEBUG}}, 370{RSP_ZCAU, -1, -1, -1, -1, -1, {ACT_ZCAU} },
376 {RSP_ANY, -1, -1, -1, -1,-1, {ACT_WARN}}, 371{RSP_NONE, -1, -1, -1, -1, -1, {ACT_DEBUG} },
377 {RSP_LAST} 372{RSP_ANY, -1, -1, -1, -1, -1, {ACT_WARN} },
373{RSP_LAST}
378}; 374};
379 375
380 376
381static const struct resp_type_t resp_type[] = 377static const struct resp_type_t resp_type[] =
382{ 378{
383 /*{"", RSP_EMPTY, RT_NOTHING},*/
384 {"OK", RSP_OK, RT_NOTHING}, 379 {"OK", RSP_OK, RT_NOTHING},
385 {"ERROR", RSP_ERROR, RT_NOTHING}, 380 {"ERROR", RSP_ERROR, RT_NOTHING},
386 {"ZSAU", RSP_ZSAU, RT_ZSAU}, 381 {"ZSAU", RSP_ZSAU, RT_ZSAU},
@@ -404,7 +399,7 @@ static const struct resp_type_t resp_type[] =
404 {"ZLOG", RSP_ZLOG, RT_NOTHING}, 399 {"ZLOG", RSP_ZLOG, RT_NOTHING},
405 {"ZABINFO", RSP_ZABINFO, RT_NOTHING}, 400 {"ZABINFO", RSP_ZABINFO, RT_NOTHING},
406 {"ZSMLSTCHG", RSP_ZSMLSTCHG, RT_NOTHING}, 401 {"ZSMLSTCHG", RSP_ZSMLSTCHG, RT_NOTHING},
407 {NULL,0,0} 402 {NULL, 0, 0}
408}; 403};
409 404
410/* 405/*
@@ -469,7 +464,6 @@ static int cid_of_response(char *s)
469 if (cid < 1 || cid > 65535) 464 if (cid < 1 || cid > 65535)
470 return -1; /* CID out of range */ 465 return -1; /* CID out of range */
471 return cid; 466 return cid;
472 //FIXME is ;<digit>+ at end of non-CID response really impossible?
473} 467}
474 468
475/** 469/**
@@ -613,7 +607,8 @@ void gigaset_handle_modem_response(struct cardstate *cs)
613 break; 607 break;
614 } 608 }
615 if (!strcmp(argv[curarg], "OUTGOING_CALL_PROCEEDING")) 609 if (!strcmp(argv[curarg], "OUTGOING_CALL_PROCEEDING"))
616 event->parameter = ZSAU_OUTGOING_CALL_PROCEEDING; 610 event->parameter =
611 ZSAU_OUTGOING_CALL_PROCEEDING;
617 else if (!strcmp(argv[curarg], "CALL_DELIVERED")) 612 else if (!strcmp(argv[curarg], "CALL_DELIVERED"))
618 event->parameter = ZSAU_CALL_DELIVERED; 613 event->parameter = ZSAU_CALL_DELIVERED;
619 else if (!strcmp(argv[curarg], "ACTIVE")) 614 else if (!strcmp(argv[curarg], "ACTIVE"))
@@ -896,7 +891,8 @@ static void bchannel_up(struct bc_state *bcs)
896 gigaset_isdn_connB(bcs); 891 gigaset_isdn_connB(bcs);
897} 892}
898 893
899static void start_dial(struct at_state_t *at_state, void *data, unsigned seq_index) 894static void start_dial(struct at_state_t *at_state, void *data,
895 unsigned seq_index)
900{ 896{
901 struct bc_state *bcs = at_state->bcs; 897 struct bc_state *bcs = at_state->bcs;
902 struct cardstate *cs = at_state->cs; 898 struct cardstate *cs = at_state->cs;
@@ -973,8 +969,6 @@ static void do_start(struct cardstate *cs)
973 969
974 cs->isdn_up = 1; 970 cs->isdn_up = 1;
975 gigaset_isdn_start(cs); 971 gigaset_isdn_start(cs);
976 // FIXME: not in locked mode
977 // FIXME 2: only after init sequence
978 972
979 cs->waiting = 0; 973 cs->waiting = 0;
980 wake_up(&cs->waitqueue); 974 wake_up(&cs->waitqueue);
@@ -1128,7 +1122,6 @@ static int do_lock(struct cardstate *cs)
1128 1122
1129 break; 1123 break;
1130 case MS_LOCKED: 1124 case MS_LOCKED:
1131 //retval = -EACCES;
1132 break; 1125 break;
1133 default: 1126 default:
1134 return -EBUSY; 1127 return -EBUSY;
@@ -1384,7 +1377,7 @@ static void do_action(int action, struct cardstate *cs,
1384 cs->cur_at_seq = SEQ_NONE; 1377 cs->cur_at_seq = SEQ_NONE;
1385 break; 1378 break;
1386 1379
1387 case ACT_ABORTACCEPT: /* hangup/error/timeout during ICALL processing */ 1380 case ACT_ABORTACCEPT: /* hangup/error/timeout during ICALL procssng */
1388 disconnect(p_at_state); 1381 disconnect(p_at_state);
1389 break; 1382 break;
1390 1383
@@ -1458,17 +1451,6 @@ static void do_action(int action, struct cardstate *cs,
1458 __func__, at_state->ConState); 1451 __func__, at_state->ConState);
1459 cs->cur_at_seq = SEQ_NONE; 1452 cs->cur_at_seq = SEQ_NONE;
1460 break; 1453 break;
1461#ifdef CONFIG_GIGASET_DEBUG
1462 case ACT_TEST:
1463 {
1464 static int count = 3; //2; //1;
1465 *p_genresp = 1;
1466 *p_resp_code = count ? RSP_ERROR : RSP_OK;
1467 if (count > 0)
1468 --count;
1469 }
1470 break;
1471#endif
1472 case ACT_DEBUG: 1454 case ACT_DEBUG:
1473 gig_dbg(DEBUG_ANY, "%s: resp_code %d in ConState %d", 1455 gig_dbg(DEBUG_ANY, "%s: resp_code %d in ConState %d",
1474 __func__, ev->type, at_state->ConState); 1456 __func__, ev->type, at_state->ConState);
@@ -1503,7 +1485,7 @@ static void do_action(int action, struct cardstate *cs,
1503 do_start(cs); 1485 do_start(cs);
1504 break; 1486 break;
1505 1487
1506 /* events from the interface */ // FIXME without ACT_xxxx? 1488 /* events from the interface */
1507 case ACT_IF_LOCK: 1489 case ACT_IF_LOCK:
1508 cs->cmd_result = ev->parameter ? do_lock(cs) : do_unlock(cs); 1490 cs->cmd_result = ev->parameter ? do_lock(cs) : do_unlock(cs);
1509 cs->waiting = 0; 1491 cs->waiting = 0;
@@ -1522,7 +1504,7 @@ static void do_action(int action, struct cardstate *cs,
1522 wake_up(&cs->waitqueue); 1504 wake_up(&cs->waitqueue);
1523 break; 1505 break;
1524 1506
1525 /* events from the proc file system */ // FIXME without ACT_xxxx? 1507 /* events from the proc file system */
1526 case ACT_PROC_CIDMODE: 1508 case ACT_PROC_CIDMODE:
1527 spin_lock_irqsave(&cs->lock, flags); 1509 spin_lock_irqsave(&cs->lock, flags);
1528 if (ev->parameter != cs->cidmode) { 1510 if (ev->parameter != cs->cidmode) {
@@ -1659,7 +1641,8 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
1659 for (curact = 0; curact < MAXACT; ++curact) { 1641 for (curact = 0; curact < MAXACT; ++curact) {
1660 /* The row tells us what we should do .. 1642 /* The row tells us what we should do ..
1661 */ 1643 */
1662 do_action(rep->action[curact], cs, bcs, &at_state, &p_command, &genresp, &resp_code, ev); 1644 do_action(rep->action[curact], cs, bcs, &at_state, &p_command,
1645 &genresp, &resp_code, ev);
1663 if (!at_state) 1646 if (!at_state)
1664 break; /* may be freed after disconnect */ 1647 break; /* may be freed after disconnect */
1665 } 1648 }
@@ -1671,13 +1654,14 @@ static void process_event(struct cardstate *cs, struct event_t *ev)
1671 1654
1672 if (genresp) { 1655 if (genresp) {
1673 spin_lock_irqsave(&cs->lock, flags); 1656 spin_lock_irqsave(&cs->lock, flags);
1674 at_state->timer_expires = 0; //FIXME 1657 at_state->timer_expires = 0;
1675 at_state->timer_active = 0; //FIXME 1658 at_state->timer_active = 0;
1676 spin_unlock_irqrestore(&cs->lock, flags); 1659 spin_unlock_irqrestore(&cs->lock, flags);
1677 gigaset_add_event(cs, at_state, resp_code, NULL, 0, NULL); 1660 gigaset_add_event(cs, at_state, resp_code,
1661 NULL, 0, NULL);
1678 } else { 1662 } else {
1679 /* Send command to modem if not NULL... */ 1663 /* Send command to modem if not NULL... */
1680 if (p_command/*rep->command*/) { 1664 if (p_command) {
1681 if (cs->connected) 1665 if (cs->connected)
1682 send_command(cs, p_command, 1666 send_command(cs, p_command,
1683 sendcid, cs->dle, 1667 sendcid, cs->dle,
@@ -1764,7 +1748,8 @@ static void process_command_flags(struct cardstate *cs)
1764 } 1748 }
1765 } 1749 }
1766 1750
1767 /* only switch back to unimodem mode, if no commands are pending and no channels are up */ 1751 /* only switch back to unimodem mode if no commands are pending and
1752 * no channels are up */
1768 spin_lock_irqsave(&cs->lock, flags); 1753 spin_lock_irqsave(&cs->lock, flags);
1769 if (cs->at_state.pending_commands == PC_UMMODE 1754 if (cs->at_state.pending_commands == PC_UMMODE
1770 && !cs->cidmode 1755 && !cs->cidmode
@@ -1823,9 +1808,8 @@ static void process_command_flags(struct cardstate *cs)
1823 1808
1824 if (cs->at_state.pending_commands & PC_INIT) { 1809 if (cs->at_state.pending_commands & PC_INIT) {
1825 cs->at_state.pending_commands &= ~PC_INIT; 1810 cs->at_state.pending_commands &= ~PC_INIT;
1826 cs->dle = 0; //FIXME 1811 cs->dle = 0;
1827 cs->inbuf->inputstate = INS_command; 1812 cs->inbuf->inputstate = INS_command;
1828 //FIXME reset card state (or -> LOCK0)?
1829 schedule_sequence(cs, &cs->at_state, SEQ_INIT); 1813 schedule_sequence(cs, &cs->at_state, SEQ_INIT);
1830 return; 1814 return;
1831 } 1815 }