diff options
author | Tilman Schmidt <tilman@imap.cc> | 2006-04-11 01:55:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-11 09:18:49 -0400 |
commit | 917f5085ddb3498033551e711fb22f48ddeb8378 (patch) | |
tree | ff67547a8f4cbf27e4a30b795635778d8e6cc79d /drivers/isdn/gigaset/ev-layer.c | |
parent | 08a53cdce62d37d918530bbbf726cc01b21dc3d1 (diff) |
[PATCH] isdn4linux: Siemens Gigaset drivers: code cleanup
With Hansjoerg Lipp <hjlipp@web.de>
Source code formatting cleanups for the Siemens Gigaset drivers, such as line
length, comments, removal of unused declarations, and typo corrections. It
does not introduce any functional changes.
Signed-off-by: Hansjoerg Lipp <hjlipp@web.de>
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Cc: Karsten Keil <kkeil@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/isdn/gigaset/ev-layer.c')
-rw-r--r-- | drivers/isdn/gigaset/ev-layer.c | 289 |
1 files changed, 138 insertions, 151 deletions
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c index fdcb80bb21c7..6c1000491231 100644 --- a/drivers/isdn/gigaset/ev-layer.c +++ b/drivers/isdn/gigaset/ev-layer.c | |||
@@ -11,82 +11,78 @@ | |||
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: ev-layer.c,v 1.4.2.18 2006/02/04 18:28:16 hjlipp Exp $ | ||
17 | * ===================================================================== | ||
18 | */ | 14 | */ |
19 | 15 | ||
20 | #include "gigaset.h" | 16 | #include "gigaset.h" |
21 | 17 | ||
22 | /* ========================================================== */ | 18 | /* ========================================================== */ |
23 | /* bit masks for pending commands */ | 19 | /* bit masks for pending commands */ |
24 | #define PC_INIT 0x004 | 20 | #define PC_DIAL 0x001 |
25 | #define PC_DLE0 0x008 | 21 | #define PC_HUP 0x002 |
26 | #define PC_DLE1 0x010 | 22 | #define PC_INIT 0x004 |
27 | #define PC_CID 0x080 | 23 | #define PC_DLE0 0x008 |
28 | #define PC_NOCID 0x100 | 24 | #define PC_DLE1 0x010 |
29 | #define PC_HUP 0x002 | 25 | #define PC_SHUTDOWN 0x020 |
30 | #define PC_DIAL 0x001 | 26 | #define PC_ACCEPT 0x040 |
31 | #define PC_ACCEPT 0x040 | 27 | #define PC_CID 0x080 |
32 | #define PC_SHUTDOWN 0x020 | 28 | #define PC_NOCID 0x100 |
33 | #define PC_CIDMODE 0x200 | 29 | #define PC_CIDMODE 0x200 |
34 | #define PC_UMMODE 0x400 | 30 | #define PC_UMMODE 0x400 |
35 | 31 | ||
36 | /* types of modem responses */ | 32 | /* types of modem responses */ |
37 | #define RT_NOTHING 0 | 33 | #define RT_NOTHING 0 |
38 | #define RT_ZSAU 1 | 34 | #define RT_ZSAU 1 |
39 | #define RT_RING 2 | 35 | #define RT_RING 2 |
40 | #define RT_NUMBER 3 | 36 | #define RT_NUMBER 3 |
41 | #define RT_STRING 4 | 37 | #define RT_STRING 4 |
42 | #define RT_HEX 5 | 38 | #define RT_HEX 5 |
43 | #define RT_ZCAU 6 | 39 | #define RT_ZCAU 6 |
44 | 40 | ||
45 | /* Possible ASCII responses */ | 41 | /* Possible ASCII responses */ |
46 | #define RSP_OK 0 | 42 | #define RSP_OK 0 |
47 | //#define RSP_BUSY 1 | 43 | //#define RSP_BUSY 1 |
48 | //#define RSP_CONNECT 2 | 44 | //#define RSP_CONNECT 2 |
49 | #define RSP_ZGCI 3 | 45 | #define RSP_ZGCI 3 |
50 | #define RSP_RING 4 | 46 | #define RSP_RING 4 |
51 | #define RSP_ZAOC 5 | 47 | #define RSP_ZAOC 5 |
52 | #define RSP_ZCSTR 6 | 48 | #define RSP_ZCSTR 6 |
53 | #define RSP_ZCFGT 7 | 49 | #define RSP_ZCFGT 7 |
54 | #define RSP_ZCFG 8 | 50 | #define RSP_ZCFG 8 |
55 | #define RSP_ZCCR 9 | 51 | #define RSP_ZCCR 9 |
56 | #define RSP_EMPTY 10 | 52 | #define RSP_EMPTY 10 |
57 | #define RSP_ZLOG 11 | 53 | #define RSP_ZLOG 11 |
58 | #define RSP_ZCAU 12 | 54 | #define RSP_ZCAU 12 |
59 | #define RSP_ZMWI 13 | 55 | #define RSP_ZMWI 13 |
60 | #define RSP_ZABINFO 14 | 56 | #define RSP_ZABINFO 14 |
61 | #define RSP_ZSMLSTCHG 15 | 57 | #define RSP_ZSMLSTCHG 15 |
62 | #define RSP_VAR 100 | 58 | #define RSP_VAR 100 |
63 | #define RSP_ZSAU (RSP_VAR + VAR_ZSAU) | 59 | #define RSP_ZSAU (RSP_VAR + VAR_ZSAU) |
64 | #define RSP_ZDLE (RSP_VAR + VAR_ZDLE) | 60 | #define RSP_ZDLE (RSP_VAR + VAR_ZDLE) |
65 | #define RSP_ZVLS (RSP_VAR + VAR_ZVLS) | 61 | #define RSP_ZVLS (RSP_VAR + VAR_ZVLS) |
66 | #define RSP_ZCTP (RSP_VAR + VAR_ZCTP) | 62 | #define RSP_ZCTP (RSP_VAR + VAR_ZCTP) |
67 | #define RSP_STR (RSP_VAR + VAR_NUM) | 63 | #define RSP_STR (RSP_VAR + VAR_NUM) |
68 | #define RSP_NMBR (RSP_STR + STR_NMBR) | 64 | #define RSP_NMBR (RSP_STR + STR_NMBR) |
69 | #define RSP_ZCPN (RSP_STR + STR_ZCPN) | 65 | #define RSP_ZCPN (RSP_STR + STR_ZCPN) |
70 | #define RSP_ZCON (RSP_STR + STR_ZCON) | 66 | #define RSP_ZCON (RSP_STR + STR_ZCON) |
71 | #define RSP_ZBC (RSP_STR + STR_ZBC) | 67 | #define RSP_ZBC (RSP_STR + STR_ZBC) |
72 | #define RSP_ZHLC (RSP_STR + STR_ZHLC) | 68 | #define RSP_ZHLC (RSP_STR + STR_ZHLC) |
73 | #define RSP_ERROR -1 /* ERROR */ | 69 | #define RSP_ERROR -1 /* ERROR */ |
74 | #define RSP_WRONG_CID -2 /* unknown cid in cmd */ | 70 | #define RSP_WRONG_CID -2 /* unknown cid in cmd */ |
75 | //#define RSP_EMPTY -3 | 71 | //#define RSP_EMPTY -3 |
76 | #define RSP_UNKNOWN -4 /* unknown response */ | 72 | #define RSP_UNKNOWN -4 /* unknown response */ |
77 | #define RSP_FAIL -5 /* internal error */ | 73 | #define RSP_FAIL -5 /* internal error */ |
78 | #define RSP_INVAL -6 /* invalid response */ | 74 | #define RSP_INVAL -6 /* invalid response */ |
79 | 75 | ||
80 | #define RSP_NONE -19 | 76 | #define RSP_NONE -19 |
81 | #define RSP_STRING -20 | 77 | #define RSP_STRING -20 |
82 | #define RSP_NULL -21 | 78 | #define RSP_NULL -21 |
83 | //#define RSP_RETRYFAIL -22 | 79 | //#define RSP_RETRYFAIL -22 |
84 | //#define RSP_RETRY -23 | 80 | //#define RSP_RETRY -23 |
85 | //#define RSP_SKIP -24 | 81 | //#define RSP_SKIP -24 |
86 | #define RSP_INIT -27 | 82 | #define RSP_INIT -27 |
87 | #define RSP_ANY -26 | 83 | #define RSP_ANY -26 |
88 | #define RSP_LAST -28 | 84 | #define RSP_LAST -28 |
89 | #define RSP_NODEV -9 | 85 | #define RSP_NODEV -9 |
90 | 86 | ||
91 | /* actions for process_response */ | 87 | /* actions for process_response */ |
92 | #define ACT_NOTHING 0 | 88 | #define ACT_NOTHING 0 |
@@ -112,7 +108,7 @@ | |||
112 | #define ACT_DISCONNECT 20 | 108 | #define ACT_DISCONNECT 20 |
113 | #define ACT_CONNECT 21 | 109 | #define ACT_CONNECT 21 |
114 | #define ACT_REMOTEREJECT 22 | 110 | #define ACT_REMOTEREJECT 22 |
115 | #define ACT_CONNTIMEOUT 23 | 111 | #define ACT_CONNTIMEOUT 23 |
116 | #define ACT_REMOTEHUP 24 | 112 | #define ACT_REMOTEHUP 24 |
117 | #define ACT_ABORTHUP 25 | 113 | #define ACT_ABORTHUP 25 |
118 | #define ACT_ICALL 26 | 114 | #define ACT_ICALL 26 |
@@ -127,40 +123,40 @@ | |||
127 | #define ACT_ERROR 35 | 123 | #define ACT_ERROR 35 |
128 | #define ACT_ABORTCID 36 | 124 | #define ACT_ABORTCID 36 |
129 | #define ACT_ZCAU 37 | 125 | #define ACT_ZCAU 37 |
130 | #define ACT_NOTIFY_BC_DOWN 38 | 126 | #define ACT_NOTIFY_BC_DOWN 38 |
131 | #define ACT_NOTIFY_BC_UP 39 | 127 | #define ACT_NOTIFY_BC_UP 39 |
132 | #define ACT_DIAL 40 | 128 | #define ACT_DIAL 40 |
133 | #define ACT_ACCEPT 41 | 129 | #define ACT_ACCEPT 41 |
134 | #define ACT_PROTO_L2 42 | 130 | #define ACT_PROTO_L2 42 |
135 | #define ACT_HUP 43 | 131 | #define ACT_HUP 43 |
136 | #define ACT_IF_LOCK 44 | 132 | #define ACT_IF_LOCK 44 |
137 | #define ACT_START 45 | 133 | #define ACT_START 45 |
138 | #define ACT_STOP 46 | 134 | #define ACT_STOP 46 |
139 | #define ACT_FAKEDLE0 47 | 135 | #define ACT_FAKEDLE0 47 |
140 | #define ACT_FAKEHUP 48 | 136 | #define ACT_FAKEHUP 48 |
141 | #define ACT_FAKESDOWN 49 | 137 | #define ACT_FAKESDOWN 49 |
142 | #define ACT_SHUTDOWN 50 | 138 | #define ACT_SHUTDOWN 50 |
143 | #define ACT_PROC_CIDMODE 51 | 139 | #define ACT_PROC_CIDMODE 51 |
144 | #define ACT_UMODESET 52 | 140 | #define ACT_UMODESET 52 |
145 | #define ACT_FAILUMODE 53 | 141 | #define ACT_FAILUMODE 53 |
146 | #define ACT_CMODESET 54 | 142 | #define ACT_CMODESET 54 |
147 | #define ACT_FAILCMODE 55 | 143 | #define ACT_FAILCMODE 55 |
148 | #define ACT_IF_VER 56 | 144 | #define ACT_IF_VER 56 |
149 | #define ACT_CMD 100 | 145 | #define ACT_CMD 100 |
150 | 146 | ||
151 | /* at command sequences */ | 147 | /* at command sequences */ |
152 | #define SEQ_NONE 0 | 148 | #define SEQ_NONE 0 |
153 | #define SEQ_INIT 100 | 149 | #define SEQ_INIT 100 |
154 | #define SEQ_DLE0 200 | 150 | #define SEQ_DLE0 200 |
155 | #define SEQ_DLE1 250 | 151 | #define SEQ_DLE1 250 |
156 | #define SEQ_CID 300 | 152 | #define SEQ_CID 300 |
157 | #define SEQ_NOCID 350 | 153 | #define SEQ_NOCID 350 |
158 | #define SEQ_HUP 400 | 154 | #define SEQ_HUP 400 |
159 | #define SEQ_DIAL 600 | 155 | #define SEQ_DIAL 600 |
160 | #define SEQ_ACCEPT 720 | 156 | #define SEQ_ACCEPT 720 |
161 | #define SEQ_SHUTDOWN 500 | 157 | #define SEQ_SHUTDOWN 500 |
162 | #define SEQ_CIDMODE 10 | 158 | #define SEQ_CIDMODE 10 |
163 | #define SEQ_UMMODE 11 | 159 | #define SEQ_UMMODE 11 |
164 | 160 | ||
165 | 161 | ||
166 | // 100: init, 200: dle0, 250:dle1, 300: get cid (dial), 350: "hup" (no cid), 400: hup, 500: reset, 600: dial, 700: ring | 162 | // 100: init, 200: dle0, 250:dle1, 300: get cid (dial), 350: "hup" (no cid), 400: hup, 500: reset, 600: dial, 700: ring |
@@ -393,7 +389,7 @@ struct reply_t gigaset_tab_cid_m10x[] = /* for M10x */ | |||
393 | 389 | ||
394 | 390 | ||
395 | #if 0 | 391 | #if 0 |
396 | static struct reply_t tab_nocid[]= /* no dle mode */ //FIXME aenderungen uebernehmen | 392 | static struct reply_t tab_nocid[]= /* no dle mode */ //FIXME |
397 | { | 393 | { |
398 | /* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout, action, command */ | 394 | /* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout, action, command */ |
399 | 395 | ||
@@ -401,7 +397,7 @@ static struct reply_t tab_nocid[]= /* no dle mode */ //FIXME aenderungen ueberne | |||
401 | {RSP_LAST,0,0,0,0,0,0} | 397 | {RSP_LAST,0,0,0,0,0,0} |
402 | }; | 398 | }; |
403 | 399 | ||
404 | static struct reply_t tab_cid[] = /* no dle mode */ //FIXME aenderungen uebernehmen | 400 | static struct reply_t tab_cid[] = /* no dle mode */ //FIXME |
405 | { | 401 | { |
406 | /* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout, action, command */ | 402 | /* resp_code, min_ConState, max_ConState, parameter, new_ConState, timeout, action, command */ |
407 | 403 | ||
@@ -412,30 +408,30 @@ static struct reply_t tab_cid[] = /* no dle mode */ //FIXME aenderungen ueberneh | |||
412 | 408 | ||
413 | static struct resp_type_t resp_type[]= | 409 | static struct resp_type_t resp_type[]= |
414 | { | 410 | { |
415 | /*{"", RSP_EMPTY, RT_NOTHING},*/ | 411 | /*{"", RSP_EMPTY, RT_NOTHING},*/ |
416 | {"OK", RSP_OK, RT_NOTHING}, | 412 | {"OK", RSP_OK, RT_NOTHING}, |
417 | {"ERROR", RSP_ERROR, RT_NOTHING}, | 413 | {"ERROR", RSP_ERROR, RT_NOTHING}, |
418 | {"ZSAU", RSP_ZSAU, RT_ZSAU}, | 414 | {"ZSAU", RSP_ZSAU, RT_ZSAU}, |
419 | {"ZCAU", RSP_ZCAU, RT_ZCAU}, | 415 | {"ZCAU", RSP_ZCAU, RT_ZCAU}, |
420 | {"RING", RSP_RING, RT_RING}, | 416 | {"RING", RSP_RING, RT_RING}, |
421 | {"ZGCI", RSP_ZGCI, RT_NUMBER}, | 417 | {"ZGCI", RSP_ZGCI, RT_NUMBER}, |
422 | {"ZVLS", RSP_ZVLS, RT_NUMBER}, | 418 | {"ZVLS", RSP_ZVLS, RT_NUMBER}, |
423 | {"ZCTP", RSP_ZCTP, RT_NUMBER}, | 419 | {"ZCTP", RSP_ZCTP, RT_NUMBER}, |
424 | {"ZDLE", RSP_ZDLE, RT_NUMBER}, | 420 | {"ZDLE", RSP_ZDLE, RT_NUMBER}, |
425 | {"ZCFGT", RSP_ZCFGT, RT_NUMBER}, | 421 | {"ZCFGT", RSP_ZCFGT, RT_NUMBER}, |
426 | {"ZCCR", RSP_ZCCR, RT_NUMBER}, | 422 | {"ZCCR", RSP_ZCCR, RT_NUMBER}, |
427 | {"ZMWI", RSP_ZMWI, RT_NUMBER}, | 423 | {"ZMWI", RSP_ZMWI, RT_NUMBER}, |
428 | {"ZHLC", RSP_ZHLC, RT_STRING}, | 424 | {"ZHLC", RSP_ZHLC, RT_STRING}, |
429 | {"ZBC", RSP_ZBC, RT_STRING}, | 425 | {"ZBC", RSP_ZBC, RT_STRING}, |
430 | {"NMBR", RSP_NMBR, RT_STRING}, | 426 | {"NMBR", RSP_NMBR, RT_STRING}, |
431 | {"ZCPN", RSP_ZCPN, RT_STRING}, | 427 | {"ZCPN", RSP_ZCPN, RT_STRING}, |
432 | {"ZCON", RSP_ZCON, RT_STRING}, | 428 | {"ZCON", RSP_ZCON, RT_STRING}, |
433 | {"ZAOC", RSP_ZAOC, RT_STRING}, | 429 | {"ZAOC", RSP_ZAOC, RT_STRING}, |
434 | {"ZCSTR", RSP_ZCSTR, RT_STRING}, | 430 | {"ZCSTR", RSP_ZCSTR, RT_STRING}, |
435 | {"ZCFG", RSP_ZCFG, RT_HEX}, | 431 | {"ZCFG", RSP_ZCFG, RT_HEX}, |
436 | {"ZLOG", RSP_ZLOG, RT_NOTHING}, | 432 | {"ZLOG", RSP_ZLOG, RT_NOTHING}, |
437 | {"ZABINFO", RSP_ZABINFO, RT_NOTHING}, | 433 | {"ZABINFO", RSP_ZABINFO, RT_NOTHING}, |
438 | {"ZSMLSTCHG", RSP_ZSMLSTCHG, RT_NOTHING}, | 434 | {"ZSMLSTCHG", RSP_ZSMLSTCHG, RT_NOTHING}, |
439 | {NULL,0,0} | 435 | {NULL,0,0} |
440 | }; | 436 | }; |
441 | 437 | ||
@@ -837,7 +833,8 @@ static void schedule_init(struct cardstate *cs, int state) | |||
837 | dbg(DEBUG_CMD, "Scheduling PC_INIT"); | 833 | dbg(DEBUG_CMD, "Scheduling PC_INIT"); |
838 | } | 834 | } |
839 | 835 | ||
840 | /* Add "AT" to a command, add the cid, dle encode it, send the result to the hardware. */ | 836 | /* Add "AT" to a command, add the cid, dle encode it, send the result to the |
837 | hardware. */ | ||
841 | static void send_command(struct cardstate *cs, const char *cmd, int cid, | 838 | static void send_command(struct cardstate *cs, const char *cmd, int cid, |
842 | int dle, gfp_t kmallocflags) | 839 | int dle, gfp_t kmallocflags) |
843 | { | 840 | { |
@@ -966,19 +963,13 @@ static void start_dial(struct at_state_t *at_state, void *data, int seq_index) | |||
966 | 963 | ||
967 | at_state->pending_commands |= PC_CID; | 964 | at_state->pending_commands |= PC_CID; |
968 | dbg(DEBUG_CMD, "Scheduling PC_CID"); | 965 | dbg(DEBUG_CMD, "Scheduling PC_CID"); |
969 | //#ifdef GIG_MAYINITONDIAL | 966 | atomic_set(&cs->commands_pending, 1); |
970 | // if (atomic_read(&cs->MState) == MS_UNKNOWN) { | ||
971 | // cs->at_state.pending_commands |= PC_INIT; | ||
972 | // dbg(DEBUG_CMD, "Scheduling PC_INIT"); | ||
973 | // } | ||
974 | //#endif | ||
975 | atomic_set(&cs->commands_pending, 1); //FIXME | ||
976 | return; | 967 | return; |
977 | 968 | ||
978 | error: | 969 | error: |
979 | at_state->pending_commands |= PC_NOCID; | 970 | at_state->pending_commands |= PC_NOCID; |
980 | dbg(DEBUG_CMD, "Scheduling PC_NOCID"); | 971 | dbg(DEBUG_CMD, "Scheduling PC_NOCID"); |
981 | atomic_set(&cs->commands_pending, 1); //FIXME | 972 | atomic_set(&cs->commands_pending, 1); |
982 | return; | 973 | return; |
983 | } | 974 | } |
984 | 975 | ||
@@ -992,12 +983,12 @@ static void start_accept(struct at_state_t *at_state) | |||
992 | if (retval == 0) { | 983 | if (retval == 0) { |
993 | at_state->pending_commands |= PC_ACCEPT; | 984 | at_state->pending_commands |= PC_ACCEPT; |
994 | dbg(DEBUG_CMD, "Scheduling PC_ACCEPT"); | 985 | dbg(DEBUG_CMD, "Scheduling PC_ACCEPT"); |
995 | atomic_set(&cs->commands_pending, 1); //FIXME | 986 | atomic_set(&cs->commands_pending, 1); |
996 | } else { | 987 | } else { |
997 | //FIXME | 988 | //FIXME |
998 | at_state->pending_commands |= PC_HUP; | 989 | at_state->pending_commands |= PC_HUP; |
999 | dbg(DEBUG_CMD, "Scheduling PC_HUP"); | 990 | dbg(DEBUG_CMD, "Scheduling PC_HUP"); |
1000 | atomic_set(&cs->commands_pending, 1); //FIXME | 991 | atomic_set(&cs->commands_pending, 1); |
1001 | } | 992 | } |
1002 | } | 993 | } |
1003 | 994 | ||
@@ -1037,9 +1028,8 @@ static void do_shutdown(struct cardstate *cs) | |||
1037 | if (atomic_read(&cs->mstate) == MS_READY) { | 1028 | if (atomic_read(&cs->mstate) == MS_READY) { |
1038 | atomic_set(&cs->mstate, MS_SHUTDOWN); | 1029 | atomic_set(&cs->mstate, MS_SHUTDOWN); |
1039 | cs->at_state.pending_commands |= PC_SHUTDOWN; | 1030 | cs->at_state.pending_commands |= PC_SHUTDOWN; |
1040 | atomic_set(&cs->commands_pending, 1); //FIXME | 1031 | atomic_set(&cs->commands_pending, 1); |
1041 | dbg(DEBUG_CMD, "Scheduling PC_SHUTDOWN"); //FIXME | 1032 | dbg(DEBUG_CMD, "Scheduling PC_SHUTDOWN"); |
1042 | //gigaset_schedule_event(cs); //FIXME | ||
1043 | } else | 1033 | } else |
1044 | finish_shutdown(cs); | 1034 | finish_shutdown(cs); |
1045 | } | 1035 | } |
@@ -1160,7 +1150,6 @@ static int do_lock(struct cardstate *cs) | |||
1160 | mode = atomic_read(&cs->mode); | 1150 | mode = atomic_read(&cs->mode); |
1161 | atomic_set(&cs->mstate, MS_LOCKED); | 1151 | atomic_set(&cs->mstate, MS_LOCKED); |
1162 | atomic_set(&cs->mode, M_UNKNOWN); | 1152 | atomic_set(&cs->mode, M_UNKNOWN); |
1163 | //FIXME reset card state / at states / bcs states | ||
1164 | 1153 | ||
1165 | return mode; | 1154 | return mode; |
1166 | } | 1155 | } |
@@ -1173,7 +1162,6 @@ static int do_unlock(struct cardstate *cs) | |||
1173 | atomic_set(&cs->mstate, MS_UNINITIALIZED); | 1162 | atomic_set(&cs->mstate, MS_UNINITIALIZED); |
1174 | atomic_set(&cs->mode, M_UNKNOWN); | 1163 | atomic_set(&cs->mode, M_UNKNOWN); |
1175 | gigaset_free_channels(cs); | 1164 | gigaset_free_channels(cs); |
1176 | //FIXME reset card state / at states / bcs states | ||
1177 | if (atomic_read(&cs->connected)) | 1165 | if (atomic_read(&cs->connected)) |
1178 | schedule_init(cs, MS_INIT); | 1166 | schedule_init(cs, MS_INIT); |
1179 | 1167 | ||
@@ -1203,7 +1191,6 @@ static void do_action(int action, struct cardstate *cs, | |||
1203 | at_state->waiting = 1; | 1191 | at_state->waiting = 1; |
1204 | break; | 1192 | break; |
1205 | case ACT_INIT: | 1193 | case ACT_INIT: |
1206 | //FIXME setup everything | ||
1207 | cs->at_state.pending_commands &= ~PC_INIT; | 1194 | cs->at_state.pending_commands &= ~PC_INIT; |
1208 | cs->cur_at_seq = SEQ_NONE; | 1195 | cs->cur_at_seq = SEQ_NONE; |
1209 | atomic_set(&cs->mode, M_UNIMODEM); | 1196 | atomic_set(&cs->mode, M_UNIMODEM); |
@@ -1213,7 +1200,7 @@ static void do_action(int action, struct cardstate *cs, | |||
1213 | break; | 1200 | break; |
1214 | } | 1201 | } |
1215 | cs->at_state.pending_commands |= PC_CIDMODE; | 1202 | cs->at_state.pending_commands |= PC_CIDMODE; |
1216 | atomic_set(&cs->commands_pending, 1); //FIXME | 1203 | atomic_set(&cs->commands_pending, 1); |
1217 | dbg(DEBUG_CMD, "Scheduling PC_CIDMODE"); | 1204 | dbg(DEBUG_CMD, "Scheduling PC_CIDMODE"); |
1218 | break; | 1205 | break; |
1219 | case ACT_FAILINIT: | 1206 | case ACT_FAILINIT: |
@@ -1428,7 +1415,8 @@ static void do_action(int action, struct cardstate *cs, | |||
1428 | at_state->pending_commands |= PC_HUP; | 1415 | at_state->pending_commands |= PC_HUP; |
1429 | atomic_set(&cs->commands_pending, 1); | 1416 | atomic_set(&cs->commands_pending, 1); |
1430 | break; | 1417 | break; |
1431 | case ACT_GETSTRING: /* warning: RING, ZDLE, ... are not handled properly any more */ | 1418 | case ACT_GETSTRING: /* warning: RING, ZDLE, ... |
1419 | are not handled properly any more */ | ||
1432 | at_state->getstring = 1; | 1420 | at_state->getstring = 1; |
1433 | break; | 1421 | break; |
1434 | case ACT_SETVER: | 1422 | case ACT_SETVER: |
@@ -1522,7 +1510,7 @@ static void do_action(int action, struct cardstate *cs, | |||
1522 | break; | 1510 | break; |
1523 | case ACT_HUP: | 1511 | case ACT_HUP: |
1524 | at_state->pending_commands |= PC_HUP; | 1512 | at_state->pending_commands |= PC_HUP; |
1525 | atomic_set(&cs->commands_pending, 1); //FIXME | 1513 | atomic_set(&cs->commands_pending, 1); |
1526 | dbg(DEBUG_CMD, "Scheduling PC_HUP"); | 1514 | dbg(DEBUG_CMD, "Scheduling PC_HUP"); |
1527 | break; | 1515 | break; |
1528 | 1516 | ||
@@ -1649,7 +1637,8 @@ static void process_event(struct cardstate *cs, struct event_t *ev) | |||
1649 | dbg(DEBUG_ANY, "stopped waiting"); | 1637 | dbg(DEBUG_ANY, "stopped waiting"); |
1650 | } | 1638 | } |
1651 | 1639 | ||
1652 | /* if the response belongs to a variable in at_state->int_var[VAR_XXXX] or at_state->str_var[STR_XXXX], set it */ | 1640 | /* if the response belongs to a variable in at_state->int_var[VAR_XXXX] |
1641 | or at_state->str_var[STR_XXXX], set it */ | ||
1653 | if (ev->type >= RSP_VAR && ev->type < RSP_VAR + VAR_NUM) { | 1642 | if (ev->type >= RSP_VAR && ev->type < RSP_VAR + VAR_NUM) { |
1654 | index = ev->type - RSP_VAR; | 1643 | index = ev->type - RSP_VAR; |
1655 | at_state->int_var[index] = ev->parameter; | 1644 | at_state->int_var[index] = ev->parameter; |
@@ -1657,13 +1646,15 @@ static void process_event(struct cardstate *cs, struct event_t *ev) | |||
1657 | index = ev->type - RSP_STR; | 1646 | index = ev->type - RSP_STR; |
1658 | kfree(at_state->str_var[index]); | 1647 | kfree(at_state->str_var[index]); |
1659 | at_state->str_var[index] = ev->ptr; | 1648 | at_state->str_var[index] = ev->ptr; |
1660 | ev->ptr = NULL; /* prevent process_events() from deallocating ptr */ | 1649 | ev->ptr = NULL; /* prevent process_events() from |
1650 | deallocating ptr */ | ||
1661 | } | 1651 | } |
1662 | 1652 | ||
1663 | if (ev->type == EV_TIMEOUT || ev->type == RSP_STRING) | 1653 | if (ev->type == EV_TIMEOUT || ev->type == RSP_STRING) |
1664 | at_state->getstring = 0; | 1654 | at_state->getstring = 0; |
1665 | 1655 | ||
1666 | /* Search row in dial array which matches modem response and current constate */ | 1656 | /* Search row in dial array which matches modem response and current |
1657 | constate */ | ||
1667 | for (;; rep++) { | 1658 | for (;; rep++) { |
1668 | rcode = rep->resp_code; | 1659 | rcode = rep->resp_code; |
1669 | /* dbg (DEBUG_ANY, "rcode %d", rcode); */ | 1660 | /* dbg (DEBUG_ANY, "rcode %d", rcode); */ |
@@ -1865,11 +1856,7 @@ static void process_command_flags(struct cardstate *cs) | |||
1865 | if (cs->at_state.pending_commands & PC_CIDMODE) { | 1856 | if (cs->at_state.pending_commands & PC_CIDMODE) { |
1866 | cs->at_state.pending_commands &= ~PC_CIDMODE; | 1857 | cs->at_state.pending_commands &= ~PC_CIDMODE; |
1867 | if (atomic_read(&cs->mode) == M_UNIMODEM) { | 1858 | if (atomic_read(&cs->mode) == M_UNIMODEM) { |
1868 | #if 0 | ||
1869 | cs->retry_count = 2; | ||
1870 | #else | ||
1871 | cs->retry_count = 1; | 1859 | cs->retry_count = 1; |
1872 | #endif | ||
1873 | schedule_sequence(cs, &cs->at_state, SEQ_CIDMODE); | 1860 | schedule_sequence(cs, &cs->at_state, SEQ_CIDMODE); |
1874 | return; | 1861 | return; |
1875 | } | 1862 | } |