diff options
Diffstat (limited to 'meta/recipes-connectivity/gsm/files/028_shell-phonebook-find-and-read-range-support.patch')
-rw-r--r-- | meta/recipes-connectivity/gsm/files/028_shell-phonebook-find-and-read-range-support.patch | 266 |
1 files changed, 0 insertions, 266 deletions
diff --git a/meta/recipes-connectivity/gsm/files/028_shell-phonebook-find-and-read-range-support.patch b/meta/recipes-connectivity/gsm/files/028_shell-phonebook-find-and-read-range-support.patch deleted file mode 100644 index a531fa81a8..0000000000 --- a/meta/recipes-connectivity/gsm/files/028_shell-phonebook-find-and-read-range-support.patch +++ /dev/null | |||
@@ -1,266 +0,0 @@ | |||
1 | From: Sean Chiang <sean_chiang@openmoko.com> | ||
2 | Subject: [PATCH] improvement for find and read phonebooks in shell | ||
3 | |||
4 | This patch improves the functions to find and read phonebooks in shell. | ||
5 | |||
6 | Besides prr and pf, I add two new commands pRr and pRf to retrieve the | ||
7 | phonebook. | ||
8 | |||
9 | Signed-off-by: Jim Huang <jserv@openmoko.org> | ||
10 | |||
11 | Upstream-Status: Inappropriate [not used] | ||
12 | |||
13 | Index: gsm/src/util/shell.c | ||
14 | =================================================================== | ||
15 | --- gsm.orig/src/util/shell.c 2007-09-17 23:57:51.000000000 +0800 | ||
16 | +++ gsm/src/util/shell.c 2007-09-17 23:59:04.000000000 +0800 | ||
17 | @@ -34,8 +34,6 @@ | ||
18 | #include <gsmd/usock.h> | ||
19 | #include <gsmd/ts0705.h> | ||
20 | |||
21 | -#include <common/linux_list.h> | ||
22 | - | ||
23 | #ifndef __GSMD__ | ||
24 | #define __GSMD__ | ||
25 | #include <gsmd/talloc.h> | ||
26 | @@ -43,9 +41,8 @@ | ||
27 | #endif | ||
28 | |||
29 | #define STDIN_BUF_SIZE 1024 | ||
30 | - | ||
31 | -static LLIST_HEAD(storage_list); | ||
32 | -static LLIST_HEAD(phonebook_list); | ||
33 | +static int nFIND = 0; | ||
34 | +static int nREADRG = 0; | ||
35 | |||
36 | /* this is the handler for receiving passthrough responses */ | ||
37 | static int pt_msghandler(struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh) | ||
38 | @@ -62,46 +59,23 @@ | ||
39 | struct gsmd_phonebook_storage *gpst; | ||
40 | char *payload; | ||
41 | char *fcomma, *lcomma, *ptr = NULL; | ||
42 | + int *num; | ||
43 | char buf[128]; | ||
44 | + int i; | ||
45 | |||
46 | switch (gmh->msg_subtype) { | ||
47 | -#if 0 | ||
48 | case GSMD_PHONEBOOK_FIND: | ||
49 | + num = (int *) ((char *)gmh + sizeof(*gmh)); | ||
50 | + printf("Records:%d\n", *num); | ||
51 | + | ||
52 | + nFIND = *num; | ||
53 | + break; | ||
54 | case GSMD_PHONEBOOK_READRG: | ||
55 | - payload = (char *)gmh + sizeof(*gmh); | ||
56 | + num = (int *) ((char *)gmh + sizeof(*gmh)); | ||
57 | + printf("Records:%d\n", *num); | ||
58 | |||
59 | - if (!strncmp(payload, "+CPBR", 5) || | ||
60 | - !strncmp(payload, "+CPBF", 5)) { | ||
61 | - gp = (struct gsmd_phonebook *) malloc(sizeof(struct gsmd_phonebook)); | ||
62 | - ptr = strchr(payload, ' '); | ||
63 | - gp->index = atoi(ptr+1); | ||
64 | - | ||
65 | - fcomma = strchr(payload, '"'); | ||
66 | - lcomma = strchr(fcomma+1, '"'); | ||
67 | - strncpy(gp->numb, fcomma + 1, (lcomma-fcomma-1)); | ||
68 | - gp->numb[(lcomma - fcomma) - 1] = '\0'; | ||
69 | - | ||
70 | - gp->type = atoi(lcomma + 2); | ||
71 | - | ||
72 | - ptr = strrchr(payload, ','); | ||
73 | - fcomma = ptr + 1; | ||
74 | - lcomma = strchr(fcomma + 1, '"'); | ||
75 | - strncpy(gp->text, fcomma + 1, (lcomma - fcomma - 1)); | ||
76 | - gp->text[(lcomma - fcomma) - 1] = '\0'; | ||
77 | - | ||
78 | - llist_add_tail(&gp->list, &phonebook_list); | ||
79 | - | ||
80 | -#if 0 | ||
81 | - llist_for_each_entry(gp, &phonebook_list, list) { | ||
82 | - printf("%d, %s, %d, %s\n", gp->index, gp->numb, gp->type, gp->text); | ||
83 | - } | ||
84 | -#endif | ||
85 | - printf("%d, %s, %d, %s\n", gp->index, gp->numb, gp->type, gp->text); | ||
86 | - } | ||
87 | - else | ||
88 | - printf("%s\n", payload); | ||
89 | + nREADRG = *num; | ||
90 | break; | ||
91 | -#endif | ||
92 | case GSMD_PHONEBOOK_READ: | ||
93 | gp = (struct gsmd_phonebook *) ((char *)gmh + sizeof(*gmh)); | ||
94 | if (gp->index) | ||
95 | @@ -115,48 +89,18 @@ | ||
96 | gps = (struct gsmd_phonebook_support *) ((char *)gmh + sizeof(*gmh)); | ||
97 | printf("(1-%d), %d, %d\n", gps->index, gps->nlength, gps->tlength); | ||
98 | break; | ||
99 | -#if 0 | ||
100 | - case GSMD_PHONEBOOK_LIST_STORAGE: | ||
101 | - payload = (char *)gmh + sizeof(*gmh); | ||
102 | |||
103 | - if (!strncmp(payload, "+CPBS", 5)) { | ||
104 | - char* delim = "(,"; | ||
105 | - struct gsmd_phonebook_storage *cur, *cur2; | ||
106 | - | ||
107 | - /* Remove previous record */ | ||
108 | - if (!llist_empty(&storage_list)) { | ||
109 | - llist_for_each_entry_safe(cur, cur2, | ||
110 | - &storage_list, list) { | ||
111 | - llist_del(&cur->list); | ||
112 | - talloc_free(cur); | ||
113 | - } | ||
114 | - } | ||
115 | - | ||
116 | - ptr = strpbrk(payload, delim); | ||
117 | - | ||
118 | - while ( ptr ) { | ||
119 | - gpst = (struct gsmd_phonebook_storage *) malloc(sizeof(struct gsmd_phonebook_storage)); | ||
120 | - strncpy(gpst->storage, ptr+2, 2); | ||
121 | - gpst->storage[2] = '\0'; | ||
122 | - | ||
123 | - ptr = strpbrk(ptr+2, delim); | ||
124 | - | ||
125 | - llist_add_tail(&gpst->list, &storage_list); | ||
126 | - } | ||
127 | + case GSMD_PHONEBOOK_LIST_STORAGE: | ||
128 | + gpst = (struct gsmd_phonebook_storage *)((char *)gmh + sizeof(*gmh)); | ||
129 | |||
130 | - if (llist_empty(&storage_list)) | ||
131 | - return 0; | ||
132 | + for (i = 0; i < gpst->num; i++) { | ||
133 | + printf("%s, ", gpst->mem[i].type); | ||
134 | + } | ||
135 | |||
136 | - llist_for_each_entry(cur, &storage_list, list) { | ||
137 | - printf("\n%s",cur->storage); | ||
138 | - } | ||
139 | + printf("\n"); | ||
140 | |||
141 | - printf("\n"); | ||
142 | - } | ||
143 | - else | ||
144 | - printf("%s\n", payload); | ||
145 | break; | ||
146 | -#endif | ||
147 | + | ||
148 | case GSMD_PHONEBOOK_WRITE: | ||
149 | case GSMD_PHONEBOOK_DELETE: | ||
150 | case GSMD_PHONEBOOK_SET_STORAGE: | ||
151 | @@ -164,6 +108,26 @@ | ||
152 | payload = (char *)gmh + sizeof(*gmh); | ||
153 | printf("%s\n", payload); | ||
154 | break; | ||
155 | + case GSMD_PHONEBOOK_RETRIEVE_READRG: | ||
156 | + gp = (struct gsmd_phonebook *) ((char *)gmh + sizeof(*gmh)); | ||
157 | + | ||
158 | + for (i=0; i<nREADRG; i++) { | ||
159 | + printf("%d,%s,%d,%s\n", gp->index, gp->numb, gp->type, gp->text); | ||
160 | + gp++; | ||
161 | + } | ||
162 | + | ||
163 | + nREADRG = 0; | ||
164 | + break; | ||
165 | + case GSMD_PHONEBOOK_RETRIEVE_FIND: | ||
166 | + gp = (struct gsmd_phonebook *) ((char *)gmh + sizeof(*gmh)); | ||
167 | + | ||
168 | + for (i = 0; i < nFIND; i++) { | ||
169 | + printf("%d,%s,%d,%s\n", gp->index, gp->numb, gp->type, gp->text); | ||
170 | + gp++; | ||
171 | + } | ||
172 | + | ||
173 | + nFIND = 0; | ||
174 | + break; | ||
175 | default: | ||
176 | return -EINVAL; | ||
177 | } | ||
178 | @@ -381,11 +345,13 @@ | ||
179 | "\tpd\tPB Delete (pb=index)\n" | ||
180 | "\tpr\tPB Read (pr=index)\n" | ||
181 | "\tprr\tPB Read Range (prr=index1,index2)\n" | ||
182 | - "\tpf\tPB Find (pff=indtext)\n" | ||
183 | + "\tpf\tPB Find (pf=indtext)\n" | ||
184 | "\tpw\tPB Write (pw=index,number,text)\n" | ||
185 | "\tps\tPB Support\n" | ||
186 | "\tpm\tPB Memory\n" | ||
187 | "\tpp\tPB Set Memory (pp=storage)\n" | ||
188 | + "\tpRr\tRetrieve Readrg Records\n" | ||
189 | + "\tpRf\tRetrieve Find Records\n" | ||
190 | "\tsd\tSMS Delete (sd=index,delflg)\n" | ||
191 | "\tsl\tSMS List (sl=stat)\n" | ||
192 | "\tsr\tSMS Read (sr=index)\n" | ||
193 | @@ -509,48 +475,21 @@ | ||
194 | printf("Delete Phonebook Entry\n"); | ||
195 | ptr = strchr(buf, '='); | ||
196 | lgsm_pb_del_entry(lgsmh, atoi(ptr+1)); | ||
197 | -#if 0 | ||
198 | } else if ( !strncmp(buf, "prr", 3)) { | ||
199 | printf("Read Phonebook Entries\n"); | ||
200 | struct lgsm_phonebook_readrg pb_readrg; | ||
201 | - struct gsmd_phonebook *gp_cur, *gp_cur2; | ||
202 | - | ||
203 | - /* Remove records */ | ||
204 | - if (!llist_empty(&phonebook_list)) { | ||
205 | - llist_for_each_entry_safe(gp_cur, | ||
206 | - gp_cur2, | ||
207 | - &phonebook_list, | ||
208 | - list) { | ||
209 | - llist_del(&gp_cur->list); | ||
210 | - talloc_free(gp_cur); | ||
211 | - } | ||
212 | - } | ||
213 | |||
214 | ptr = strchr(buf, '='); | ||
215 | pb_readrg.index1 = atoi(ptr+1); | ||
216 | ptr = strchr(buf, ','); | ||
217 | pb_readrg.index2 = atoi(ptr+1); | ||
218 | lgsm_pb_read_entries(lgsmh, &pb_readrg); | ||
219 | -#endif | ||
220 | } else if ( !strncmp(buf, "pr", 2)) { | ||
221 | ptr = strchr(buf, '='); | ||
222 | lgsm_pb_read_entry(lgsmh, atoi(ptr+1)); | ||
223 | -#if 0 | ||
224 | } else if ( !strncmp(buf, "pf", 2)) { | ||
225 | printf("Find Phonebook Entry\n"); | ||
226 | struct lgsm_phonebook_find pb_find; | ||
227 | - struct gsmd_phonebook *gp_cur, *gp_cur2; | ||
228 | - | ||
229 | - /* Remove records */ | ||
230 | - if (!llist_empty(&phonebook_list)) { | ||
231 | - llist_for_each_entry_safe(gp_cur, | ||
232 | - gp_cur2, | ||
233 | - &phonebook_list, | ||
234 | - list) { | ||
235 | - llist_del(&gp_cur->list); | ||
236 | - talloc_free(gp_cur); | ||
237 | - } | ||
238 | - } | ||
239 | |||
240 | ptr = strchr(buf, '='); | ||
241 | strncpy(pb_find.findtext, | ||
242 | @@ -559,7 +498,6 @@ | ||
243 | pb_find.findtext[strlen(ptr+1)] = '\0'; | ||
244 | |||
245 | lgsm_pb_find_entry(lgsmh, &pb_find); | ||
246 | -#endif | ||
247 | } else if ( !strncmp(buf, "pw", 2)) { | ||
248 | printf("Write Phonebook Entry\n"); | ||
249 | struct lgsm_phonebook pb; | ||
250 | @@ -591,6 +529,16 @@ | ||
251 | } else if ( !strncmp(buf, "ps", 2)) { | ||
252 | printf("Get Phonebook Support\n"); | ||
253 | lgsm_pb_get_support(lgsmh); | ||
254 | + } else if( !strncmp(buf, "pRr", 3) ) { | ||
255 | + printf("Retrieve Readrg Records\n"); | ||
256 | + | ||
257 | + if ( nREADRG ) | ||
258 | + lgsm_pb_retrieve_readrg(lgsmh, nREADRG); | ||
259 | + } else if( !strncmp(buf, "pRf", 3) ) { | ||
260 | + printf("Retrieve Find Records\n"); | ||
261 | + | ||
262 | + if ( nFIND ) | ||
263 | + lgsm_pb_retrieve_find(lgsmh, nFIND); | ||
264 | } else if ( !strncmp(buf, "sd", 2)) { | ||
265 | printf("Delete SMS\n"); | ||
266 | struct lgsm_sms_delete sms_del; | ||