diff options
18 files changed, 2 insertions, 2353 deletions
diff --git a/meta/conf/multilib.conf b/meta/conf/multilib.conf index 92a78134fb..bb21815d0f 100644 --- a/meta/conf/multilib.conf +++ b/meta/conf/multilib.conf | |||
@@ -297,7 +297,6 @@ BBCLASSEXTEND_append_pn-libgnomekbd = " ${MULTILIBS}" | |||
297 | BBCLASSEXTEND_append_pn-libgnome-keyring = " ${MULTILIBS}" | 297 | BBCLASSEXTEND_append_pn-libgnome-keyring = " ${MULTILIBS}" |
298 | BBCLASSEXTEND_append_pn-libgpg-error = " ${MULTILIBS}" | 298 | BBCLASSEXTEND_append_pn-libgpg-error = " ${MULTILIBS}" |
299 | BBCLASSEXTEND_append_pn-libgsf = " ${MULTILIBS}" | 299 | BBCLASSEXTEND_append_pn-libgsf = " ${MULTILIBS}" |
300 | BBCLASSEXTEND_append_pn-libgsmd = " ${MULTILIBS}" | ||
301 | BBCLASSEXTEND_append_pn-libgtkstylus = " ${MULTILIBS}" | 300 | BBCLASSEXTEND_append_pn-libgtkstylus = " ${MULTILIBS}" |
302 | BBCLASSEXTEND_append_pn-libical = " ${MULTILIBS}" | 301 | BBCLASSEXTEND_append_pn-libical = " ${MULTILIBS}" |
303 | BBCLASSEXTEND_append_pn-libice = " ${MULTILIBS}" | 302 | BBCLASSEXTEND_append_pn-libice = " ${MULTILIBS}" |
diff --git a/meta/recipes-connectivity/gsm/files/0001-Introduce-ports.patch b/meta/recipes-connectivity/gsm/files/0001-Introduce-ports.patch deleted file mode 100644 index 2a954d6d8b..0000000000 --- a/meta/recipes-connectivity/gsm/files/0001-Introduce-ports.patch +++ /dev/null | |||
@@ -1,712 +0,0 @@ | |||
1 | Upstream-Status: Inappropriate [not used] | ||
2 | |||
3 | From 516d67c679101d1503dbd4c0613bcd6ff1b604e4 Mon Sep 17 00:00:00 2001 | ||
4 | From: Andrzej Zaborowski <balrog@zabor.org> | ||
5 | Date: Wed, 19 Sep 2007 14:03:28 +0200 | ||
6 | Subject: [PATCH] Introduce ports. | ||
7 | |||
8 | --- | ||
9 | include/gsmd/atcmd.h | 2 +- | ||
10 | include/gsmd/gsmd.h | 7 +- | ||
11 | include/gsmd/uart.h | 28 ++++++ | ||
12 | include/gsmd/vendorplugin.h | 4 +- | ||
13 | src/gsmd/Makefile.am | 2 +- | ||
14 | src/gsmd/atcmd.c | 177 +++++++++++++++++--------------------- | ||
15 | src/gsmd/gsmd.c | 64 ++------------ | ||
16 | src/gsmd/uart.c | 202 +++++++++++++++++++++++++++++++++++++++++++ | ||
17 | 8 files changed, 328 insertions(+), 158 deletions(-) | ||
18 | create mode 100644 include/gsmd/uart.h | ||
19 | create mode 100644 src/gsmd/uart.c | ||
20 | |||
21 | diff --git a/include/gsmd/atcmd.h b/include/gsmd/atcmd.h | ||
22 | index 0d6c62a..a1af6a0 100644 | ||
23 | --- a/include/gsmd/atcmd.h | ||
24 | +++ b/include/gsmd/atcmd.h | ||
25 | @@ -9,7 +9,7 @@ typedef int atcmd_cb_t(struct gsmd_atcmd *cmd, void *ctx, char *resp); | ||
26 | |||
27 | extern struct gsmd_atcmd *atcmd_fill(const char *cmd, int rlen, atcmd_cb_t *cb, void *ctx, u_int16_t id); | ||
28 | extern int atcmd_submit(struct gsmd *g, struct gsmd_atcmd *cmd); | ||
29 | -extern int atcmd_init(struct gsmd *g, int sockfd); | ||
30 | +extern int atcmd_init(struct gsmd *g, struct gsmd_port *port); | ||
31 | extern void atcmd_drain(int fd); | ||
32 | |||
33 | #endif /* __GSMD__ */ | ||
34 | diff --git a/include/gsmd/gsmd.h b/include/gsmd/gsmd.h | ||
35 | index ed334f1..4afdf66 100644 | ||
36 | --- a/include/gsmd/gsmd.h | ||
37 | +++ b/include/gsmd/gsmd.h | ||
38 | @@ -10,6 +10,7 @@ | ||
39 | #include <gsmd/machineplugin.h> | ||
40 | #include <gsmd/vendorplugin.h> | ||
41 | #include <gsmd/select.h> | ||
42 | +#include <gsmd/uart.h> | ||
43 | #include <gsmd/state.h> | ||
44 | |||
45 | void *gsmd_tallocs; | ||
46 | @@ -52,6 +53,7 @@ enum llparse_state { | ||
47 | #define MLPARSE_BUF_SIZE 65535 | ||
48 | |||
49 | struct llparser { | ||
50 | + struct gsmd_port *port; | ||
51 | enum llparse_state state; | ||
52 | unsigned int len; | ||
53 | unsigned int flags; | ||
54 | @@ -70,7 +72,7 @@ struct gsmd; | ||
55 | struct gsmd { | ||
56 | unsigned int flags; | ||
57 | int interpreter_ready; | ||
58 | - struct gsmd_fd gfd_uart; | ||
59 | + struct gsmd_uart uart; | ||
60 | struct gsmd_fd gfd_sock; | ||
61 | struct llparser llp; | ||
62 | struct llist_head users; | ||
63 | @@ -81,9 +83,10 @@ struct gsmd { | ||
64 | struct gsmd_device_state dev_state; | ||
65 | |||
66 | struct llist_head operators; /* cached list of operator names */ | ||
67 | - unsigned char *mlbuf; /* ml_parse buffer */ | ||
68 | + char *mlbuf; /* ml_parse buffer */ | ||
69 | unsigned int mlbuf_len; | ||
70 | int mlunsolicited; | ||
71 | + int clear_to_send; | ||
72 | }; | ||
73 | |||
74 | struct gsmd_user { | ||
75 | diff --git a/include/gsmd/uart.h b/include/gsmd/uart.h | ||
76 | new file mode 100644 | ||
77 | index 0000000..a006fa7 | ||
78 | --- /dev/null | ||
79 | +++ b/include/gsmd/uart.h | ||
80 | @@ -0,0 +1,28 @@ | ||
81 | +#ifndef __GSMD_UART_H | ||
82 | +#define __GSMD_UART_H | ||
83 | + | ||
84 | +#ifdef __GSMD__ | ||
85 | + | ||
86 | +struct gsmd_port { | ||
87 | + int (*write)(struct gsmd_port *port, const char data[], int len); | ||
88 | + int (*set_break)(struct gsmd_port *port, int state); | ||
89 | + /* more parameters here */ | ||
90 | + int (*newdata_cb)(void *opaque, const char data[], int len); | ||
91 | + void *newdata_opaque; | ||
92 | +}; | ||
93 | + | ||
94 | +struct gsmd_uart { | ||
95 | + struct gsmd_port port; | ||
96 | + struct gsmd_fd gfd; | ||
97 | + char txfifo[2048]; | ||
98 | + int tx_start; | ||
99 | + int tx_len; | ||
100 | +}; | ||
101 | + | ||
102 | +extern int set_baudrate(int fd, int baudrate, int hwflow); | ||
103 | +extern void uart_drain(int fd); | ||
104 | +extern int uart_init(struct gsmd_uart *uart, int sockfd); | ||
105 | + | ||
106 | +#endif /* __GSMD__ */ | ||
107 | + | ||
108 | +#endif | ||
109 | diff --git a/include/gsmd/vendorplugin.h b/include/gsmd/vendorplugin.h | ||
110 | index 1911fef..1c82790 100644 | ||
111 | --- a/include/gsmd/vendorplugin.h | ||
112 | +++ b/include/gsmd/vendorplugin.h | ||
113 | @@ -11,8 +11,8 @@ struct gsmd_unsolicit; | ||
114 | |||
115 | struct gsmd_vendor_plugin { | ||
116 | struct llist_head list; | ||
117 | - unsigned char *name; | ||
118 | - unsigned char *ext_chars; | ||
119 | + char *name; | ||
120 | + char *ext_chars; | ||
121 | unsigned int num_unsolicit; | ||
122 | const struct gsmd_unsolicit *unsolicit; | ||
123 | int (*detect)(struct gsmd *g); | ||
124 | diff --git a/src/gsmd/Makefile.am b/src/gsmd/Makefile.am | ||
125 | index 9ac45ee..110b757 100644 | ||
126 | --- a/src/gsmd/Makefile.am | ||
127 | +++ b/src/gsmd/Makefile.am | ||
128 | @@ -13,7 +13,7 @@ sbin_PROGRAMS = gsmd | ||
129 | gsmd_CFLAGS = -D PLUGINDIR=\"$(plugindir)\" | ||
130 | gsmd_SOURCES = gsmd.c atcmd.c select.c machine.c vendor.c unsolicited.c log.c \ | ||
131 | usock.c talloc.c timer.c operator_cache.c ext_response.c \ | ||
132 | - sms_cb.c sms_pdu.c | ||
133 | + sms_cb.c sms_pdu.c uart.c | ||
134 | gsmd_LDADD = -ldl | ||
135 | gsmd_LDFLAGS = -Wl,--export-dynamic | ||
136 | |||
137 | diff --git a/src/gsmd/atcmd.c b/src/gsmd/atcmd.c | ||
138 | index 2ef6a10..27dfa41 100644 | ||
139 | --- a/src/gsmd/atcmd.c | ||
140 | +++ b/src/gsmd/atcmd.c | ||
141 | @@ -159,7 +159,8 @@ static int llparse_byte(struct llparser *llp, char byte) | ||
142 | return ret; | ||
143 | } | ||
144 | |||
145 | -static int llparse_string(struct llparser *llp, char *buf, unsigned int len) | ||
146 | +static int llparse_string(struct llparser *llp, const char *buf, | ||
147 | + unsigned int len) | ||
148 | { | ||
149 | while (len--) { | ||
150 | int rc = llparse_byte(llp, *(buf++)); | ||
151 | @@ -187,6 +188,55 @@ static int llparse_init(struct llparser *llp) | ||
152 | return 0; | ||
153 | } | ||
154 | |||
155 | +/* See if we can now send more commands to the port */ | ||
156 | +static void atcmd_wake_queue(struct gsmd *g) | ||
157 | +{ | ||
158 | + int len, rc; | ||
159 | + char *cr; | ||
160 | + | ||
161 | + /* write pending commands to UART */ | ||
162 | + while (g->interpreter_ready && g->clear_to_send) { | ||
163 | + struct gsmd_atcmd *pos, *pos2; | ||
164 | + llist_for_each_entry_safe(pos, pos2, &g->pending_atcmds, list) { | ||
165 | + cr = strchr(pos->cur, '\n'); | ||
166 | + if (cr) | ||
167 | + len = cr - pos->cur; | ||
168 | + else | ||
169 | + len = pos->buflen; | ||
170 | + rc = g->llp.port->write(g->llp.port, pos->cur, len); | ||
171 | + if (rc == 0) { | ||
172 | + gsmd_log(GSMD_ERROR, | ||
173 | + "write returns 0, aborting\n"); | ||
174 | + break; | ||
175 | + } | ||
176 | + if (cr && rc == len) | ||
177 | + rc ++; /* Skip the \n */ | ||
178 | + pos->buflen -= rc; | ||
179 | + pos->cur += rc; | ||
180 | + g->llp.port->write(g->llp.port, "\r", 1); | ||
181 | + | ||
182 | + if (!pos->buflen) { | ||
183 | + /* success: remove from global list of | ||
184 | + * to-be-sent atcmds */ | ||
185 | + llist_del(&pos->list); | ||
186 | + /* append to global list of executing atcmds */ | ||
187 | + llist_add_tail(&pos->list, &g->busy_atcmds); | ||
188 | + | ||
189 | + /* we only send one cmd at the moment */ | ||
190 | + g->clear_to_send = 0; | ||
191 | + break; | ||
192 | + } else { | ||
193 | + /* The write was short or the atcmd has more | ||
194 | + * lines to send after a "> ". */ | ||
195 | + if (rc < len) | ||
196 | + break; | ||
197 | + g->clear_to_send = 0; | ||
198 | + break; | ||
199 | + } | ||
200 | + } | ||
201 | + } | ||
202 | +} | ||
203 | + | ||
204 | /* mid-level parser */ | ||
205 | |||
206 | static int parse_final_result(const char *res) | ||
207 | @@ -216,6 +266,7 @@ static int ml_parse(const char *buf, int len, void *ctx) | ||
208 | g->interpreter_ready = 1; | ||
209 | gsmd_initsettings(g); | ||
210 | gmsd_alive_start(g); | ||
211 | + atcmd_wake_queue(g); | ||
212 | return 0; | ||
213 | } | ||
214 | |||
215 | @@ -316,6 +367,7 @@ static int ml_parse(const char *buf, int len, void *ctx) | ||
216 | } else { | ||
217 | DEBUGP("Calling cmd->cb()\n"); | ||
218 | cmd->resp = g->mlbuf; | ||
219 | + g->mlbuf[g->mlbuf_len] = 0; | ||
220 | rc = cmd->cb(cmd, cmd->ctx, cmd->resp); | ||
221 | DEBUGP("Clearing mlbuf\n"); | ||
222 | } | ||
223 | @@ -370,12 +422,15 @@ static int ml_parse(const char *buf, int len, void *ctx) | ||
224 | if (g->mlbuf_len) | ||
225 | g->mlbuf[g->mlbuf_len ++] = '\n'; | ||
226 | DEBUGP("Appending buf to mlbuf\n"); | ||
227 | - if (len > MLPARSE_BUF_SIZE - g->mlbuf_len) | ||
228 | + if (len > MLPARSE_BUF_SIZE - g->mlbuf_len) { | ||
229 | len = MLPARSE_BUF_SIZE - g->mlbuf_len; | ||
230 | + gsmd_log(GSMD_NOTICE, "g->mlbuf overrun\n"); | ||
231 | + } | ||
232 | memcpy(g->mlbuf + g->mlbuf_len, buf, len); | ||
233 | g->mlbuf_len += len; | ||
234 | |||
235 | if (g->mlunsolicited) { | ||
236 | + g->mlbuf[g->mlbuf_len] = 0; | ||
237 | rc = unsolicited_parse(g, g->mlbuf, g->mlbuf_len, | ||
238 | strchr(g->mlbuf, ':') + 1); | ||
239 | if (rc == -EAGAIN) { | ||
240 | @@ -422,8 +477,11 @@ final_cb: | ||
241 | |||
242 | /* if we're finished with current commands, but still have pending | ||
243 | * commands: we want to WRITE again */ | ||
244 | - if (llist_empty(&g->busy_atcmds) && !llist_empty(&g->pending_atcmds)) | ||
245 | - g->gfd_uart.when |= GSMD_FD_WRITE; | ||
246 | + if (llist_empty(&g->busy_atcmds)) { | ||
247 | + g->clear_to_send = 1; | ||
248 | + if (!llist_empty(&g->pending_atcmds)) | ||
249 | + atcmd_wake_queue(g); | ||
250 | + } | ||
251 | |||
252 | return rc; | ||
253 | } | ||
254 | @@ -433,85 +491,23 @@ static int atcmd_prompt(void *data) | ||
255 | { | ||
256 | struct gsmd *g = data; | ||
257 | |||
258 | - g->gfd_uart.when |= GSMD_FD_WRITE; | ||
259 | + g->clear_to_send = 1; | ||
260 | + atcmd_wake_queue(g); | ||
261 | } | ||
262 | |||
263 | /* callback to be called if [virtual] UART has some data for us */ | ||
264 | -static int atcmd_select_cb(int fd, unsigned int what, void *data) | ||
265 | +static int atcmd_newdata_cb(void *opaque, const char data[], int len) | ||
266 | { | ||
267 | - int len, rc; | ||
268 | - static char rxbuf[1024]; | ||
269 | - struct gsmd *g = data; | ||
270 | - char *cr; | ||
271 | - | ||
272 | - if (what & GSMD_FD_READ) { | ||
273 | - memset(rxbuf, 0, sizeof(rxbuf)); | ||
274 | - while ((len = read(fd, rxbuf, sizeof(rxbuf)))) { | ||
275 | - if (len < 0) { | ||
276 | - if (errno == EAGAIN) | ||
277 | - return 0; | ||
278 | - gsmd_log(GSMD_NOTICE, "ERROR reading from fd %u: %d (%s)\n", fd, len, | ||
279 | - strerror(errno)); | ||
280 | - return len; | ||
281 | - } | ||
282 | - rc = llparse_string(&g->llp, rxbuf, len); | ||
283 | - if (rc < 0) { | ||
284 | - gsmd_log(GSMD_ERROR, "ERROR during llparse_string: %d\n", rc); | ||
285 | - return rc; | ||
286 | - } | ||
287 | - } | ||
288 | - } | ||
289 | - | ||
290 | - /* write pending commands to UART */ | ||
291 | - if ((what & GSMD_FD_WRITE) && g->interpreter_ready) { | ||
292 | - struct gsmd_atcmd *pos, *pos2; | ||
293 | - llist_for_each_entry_safe(pos, pos2, &g->pending_atcmds, list) { | ||
294 | - cr = strchr(pos->cur, '\n'); | ||
295 | - if (cr) | ||
296 | - len = cr - pos->cur; | ||
297 | - else | ||
298 | - len = pos->buflen - 1; /* assuming zero-terminated strings */ | ||
299 | - rc = write(fd, pos->cur, len); | ||
300 | - if (rc == 0) { | ||
301 | - gsmd_log(GSMD_ERROR, "write returns 0, aborting\n"); | ||
302 | - break; | ||
303 | - } else if (rc < 0) { | ||
304 | - gsmd_log(GSMD_ERROR, "error during write to fd %d: %d\n", | ||
305 | - fd, rc); | ||
306 | - return rc; | ||
307 | - } | ||
308 | - if (!cr || rc == len) | ||
309 | - rc ++; /* Skip the \n or \0 */ | ||
310 | - pos->buflen -= rc; | ||
311 | - pos->cur += rc; | ||
312 | - write(fd, "\r", 1); | ||
313 | - | ||
314 | - if (!pos->buflen) { | ||
315 | - /* success: remove from global list of | ||
316 | - * to-be-sent atcmds */ | ||
317 | - llist_del(&pos->list); | ||
318 | - /* append to global list of executing atcmds */ | ||
319 | - llist_add_tail(&pos->list, &g->busy_atcmds); | ||
320 | - | ||
321 | - /* we only send one cmd at the moment */ | ||
322 | - break; | ||
323 | - } else { | ||
324 | - /* The write was short or the atcmd has more | ||
325 | - * lines to send after a "> ". */ | ||
326 | - if (rc < len) | ||
327 | - return 0; | ||
328 | - break; | ||
329 | - } | ||
330 | - } | ||
331 | + struct gsmd *g = opaque; | ||
332 | + int rc; | ||
333 | |||
334 | - /* Either pending_atcmds is empty or a command has to wait */ | ||
335 | - g->gfd_uart.when &= ~GSMD_FD_WRITE; | ||
336 | - } | ||
337 | + rc = llparse_string(&g->llp, data, len); | ||
338 | + if (rc < 0) | ||
339 | + gsmd_log(GSMD_ERROR, "ERROR during llparse_string: %d\n", rc); | ||
340 | |||
341 | - return 0; | ||
342 | + return rc; | ||
343 | } | ||
344 | |||
345 | - | ||
346 | struct gsmd_atcmd *atcmd_fill(const char *cmd, int rlen, | ||
347 | atcmd_cb_t cb, void *ctx, u_int16_t id) | ||
348 | { | ||
349 | @@ -544,36 +540,18 @@ int atcmd_submit(struct gsmd *g, struct gsmd_atcmd *cmd) | ||
350 | { | ||
351 | DEBUGP("submitting command `%s'\n", cmd->buf); | ||
352 | |||
353 | - if (llist_empty(&g->pending_atcmds)) | ||
354 | - g->gfd_uart.when |= GSMD_FD_WRITE; | ||
355 | + llist_empty(&g->pending_atcmds); | ||
356 | llist_add_tail(&cmd->list, &g->pending_atcmds); | ||
357 | + atcmd_wake_queue(g); | ||
358 | |||
359 | return 0; | ||
360 | } | ||
361 | |||
362 | -void atcmd_drain(int fd) | ||
363 | -{ | ||
364 | - int rc; | ||
365 | - struct termios t; | ||
366 | - rc = tcflush(fd, TCIOFLUSH); | ||
367 | - rc = tcgetattr(fd, &t); | ||
368 | - DEBUGP("c_iflag = 0x%08x, c_oflag = 0x%08x, c_cflag = 0x%08x, c_lflag = 0x%08x\n", | ||
369 | - t.c_iflag, t.c_oflag, t.c_cflag, t.c_lflag); | ||
370 | - t.c_iflag = t.c_oflag = 0; | ||
371 | - cfmakeraw(&t); | ||
372 | - rc = tcsetattr(fd, TCSANOW, &t); | ||
373 | -} | ||
374 | - | ||
375 | /* init atcmd parser */ | ||
376 | -int atcmd_init(struct gsmd *g, int sockfd) | ||
377 | +int atcmd_init(struct gsmd *g, struct gsmd_port *port) | ||
378 | { | ||
379 | __atcmd_ctx = talloc_named_const(gsmd_tallocs, 1, "atcmds"); | ||
380 | |||
381 | - g->gfd_uart.fd = sockfd; | ||
382 | - g->gfd_uart.when = GSMD_FD_READ; | ||
383 | - g->gfd_uart.data = g; | ||
384 | - g->gfd_uart.cb = &atcmd_select_cb; | ||
385 | - | ||
386 | INIT_LLIST_HEAD(&g->pending_atcmds); | ||
387 | INIT_LLIST_HEAD(&g->busy_atcmds); | ||
388 | |||
389 | @@ -581,7 +559,9 @@ int atcmd_init(struct gsmd *g, int sockfd) | ||
390 | |||
391 | g->mlbuf_len = 0; | ||
392 | g->mlunsolicited = 0; | ||
393 | + g->clear_to_send = 1; | ||
394 | |||
395 | + g->llp.port = port; | ||
396 | g->llp.cur = g->llp.buf; | ||
397 | g->llp.len = sizeof(g->llp.buf); | ||
398 | g->llp.cb = &ml_parse; | ||
399 | @@ -589,5 +569,8 @@ int atcmd_init(struct gsmd *g, int sockfd) | ||
400 | g->llp.ctx = g; | ||
401 | g->llp.flags = LGSM_ATCMD_F_EXTENDED; | ||
402 | |||
403 | - return gsmd_register_fd(&g->gfd_uart); | ||
404 | + port->newdata_opaque = g; | ||
405 | + port->newdata_cb = atcmd_newdata_cb; | ||
406 | + | ||
407 | + return 0; | ||
408 | } | ||
409 | diff --git a/src/gsmd/gsmd.c b/src/gsmd/gsmd.c | ||
410 | index 51b4f2c..846bd17 100644 | ||
411 | --- a/src/gsmd/gsmd.c | ||
412 | +++ b/src/gsmd/gsmd.c | ||
413 | @@ -26,7 +26,6 @@ | ||
414 | #include <string.h> | ||
415 | #include <errno.h> | ||
416 | #include <fcntl.h> | ||
417 | -#include <termios.h> | ||
418 | #include <signal.h> | ||
419 | |||
420 | #define _GNU_SOURCE | ||
421 | @@ -247,56 +246,6 @@ int gsmd_initsettings(struct gsmd *gsmd) | ||
422 | return atcmd_submit(gsmd, cmd); | ||
423 | } | ||
424 | |||
425 | -struct bdrt { | ||
426 | - int bps; | ||
427 | - u_int32_t b; | ||
428 | -}; | ||
429 | - | ||
430 | -static struct bdrt bdrts[] = { | ||
431 | - { 0, B0 }, | ||
432 | - { 9600, B9600 }, | ||
433 | - { 19200, B19200 }, | ||
434 | - { 38400, B38400 }, | ||
435 | - { 57600, B57600 }, | ||
436 | - { 115200, B115200 }, | ||
437 | - { 230400, B230400 }, | ||
438 | - { 460800, B460800 }, | ||
439 | - { 921600, B921600 }, | ||
440 | -}; | ||
441 | - | ||
442 | -static int set_baudrate(int fd, int baudrate, int hwflow) | ||
443 | -{ | ||
444 | - int i; | ||
445 | - u_int32_t bd = 0; | ||
446 | - struct termios ti; | ||
447 | - | ||
448 | - for (i = 0; i < ARRAY_SIZE(bdrts); i++) { | ||
449 | - if (bdrts[i].bps == baudrate) | ||
450 | - bd = bdrts[i].b; | ||
451 | - } | ||
452 | - if (bd == 0) | ||
453 | - return -EINVAL; | ||
454 | - | ||
455 | - i = tcgetattr(fd, &ti); | ||
456 | - if (i < 0) | ||
457 | - return i; | ||
458 | - | ||
459 | - i = cfsetispeed(&ti, B0); | ||
460 | - if (i < 0) | ||
461 | - return i; | ||
462 | - | ||
463 | - i = cfsetospeed(&ti, bd); | ||
464 | - if (i < 0) | ||
465 | - return i; | ||
466 | - | ||
467 | - if (hwflow) | ||
468 | - ti.c_cflag |= CRTSCTS; | ||
469 | - else | ||
470 | - ti.c_cflag &= ~CRTSCTS; | ||
471 | - | ||
472 | - return tcsetattr(fd, 0, &ti); | ||
473 | -} | ||
474 | - | ||
475 | static int gsmd_initialize(struct gsmd *g) | ||
476 | { | ||
477 | INIT_LLIST_HEAD(&g->users); | ||
478 | @@ -478,14 +427,19 @@ int main(int argc, char **argv) | ||
479 | if (wait >= 0) | ||
480 | g.interpreter_ready = !wait; | ||
481 | |||
482 | - if (atcmd_init(&g, fd) < 0) { | ||
483 | + if (uart_init(&g.uart, fd) < 0) { | ||
484 | fprintf(stderr, "can't initialize UART device\n"); | ||
485 | exit(1); | ||
486 | } | ||
487 | |||
488 | - write(fd, "\r", 1); | ||
489 | - sleep(1); | ||
490 | - atcmd_drain(fd); | ||
491 | + if (atcmd_init(&g, &g.uart.port) < 0) { | ||
492 | + fprintf(stderr, "can't initialize AT parser\n"); | ||
493 | + exit(1); | ||
494 | + } | ||
495 | + write(fd, "\r", 1); | ||
496 | + sleep(1); | ||
497 | + | ||
498 | + uart_drain(fd); | ||
499 | |||
500 | if (usock_init(&g) < 0) { | ||
501 | fprintf(stderr, "can't open unix socket\n"); | ||
502 | diff --git a/src/gsmd/uart.c b/src/gsmd/uart.c | ||
503 | new file mode 100644 | ||
504 | index 0000000..22a4a5c | ||
505 | --- /dev/null | ||
506 | +++ b/src/gsmd/uart.c | ||
507 | @@ -0,0 +1,202 @@ | ||
508 | +/* Wrapper for the physical UART in a struct gsmd_port abstraction. | ||
509 | + * | ||
510 | + * Copyright (C) 2007 OpenMoko, Inc. | ||
511 | + * Written by Andrzej Zaborowski <andrew@openedhand.com> | ||
512 | + * | ||
513 | + * This program is free software; you can redistribute it and/or | ||
514 | + * modify it under the terms of the GNU General Public License as | ||
515 | + * published by the Free Software Foundation; either version 2 of | ||
516 | + * the License, or (at your option) any later version. | ||
517 | + * | ||
518 | + * This program is distributed in the hope that it will be useful, | ||
519 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
520 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
521 | + * GNU General Public License for more details. | ||
522 | + * | ||
523 | + * You should have received a copy of the GNU General Public License | ||
524 | + * along with this program; if not, write to the Free Software | ||
525 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
526 | + * MA 02111-1307 USA | ||
527 | + */ | ||
528 | + | ||
529 | +#include <string.h> | ||
530 | +#include <fcntl.h> | ||
531 | +#include <termios.h> | ||
532 | +#include <unistd.h> | ||
533 | +#include <errno.h> | ||
534 | + | ||
535 | +#include "gsmd.h" | ||
536 | + | ||
537 | +#include <gsmd/gsmd.h> | ||
538 | + | ||
539 | +void uart_drain(int fd) | ||
540 | +{ | ||
541 | + int rc; | ||
542 | + struct termios t; | ||
543 | + rc = tcflush(fd, TCIOFLUSH); | ||
544 | + rc = tcgetattr(fd, &t); | ||
545 | + DEBUGP( | ||
546 | + "c_iflag = 0x%08x, c_oflag = 0x%08x, " | ||
547 | + "c_cflag = 0x%08x, c_lflag = 0x%08x\n", | ||
548 | + t.c_iflag, t.c_oflag, t.c_cflag, t.c_lflag); | ||
549 | + t.c_iflag = t.c_oflag = 0; | ||
550 | + cfmakeraw(&t); | ||
551 | + rc = tcsetattr(fd, TCSANOW, &t); | ||
552 | +} | ||
553 | + | ||
554 | +struct bdrt { | ||
555 | + int bps; | ||
556 | + u_int32_t b; | ||
557 | +}; | ||
558 | + | ||
559 | +static struct bdrt bdrts[] = { | ||
560 | + { 0, B0 }, | ||
561 | + { 9600, B9600 }, | ||
562 | + { 19200, B19200 }, | ||
563 | + { 38400, B38400 }, | ||
564 | + { 57600, B57600 }, | ||
565 | + { 115200, B115200 }, | ||
566 | + { 230400, B230400 }, | ||
567 | + { 460800, B460800 }, | ||
568 | + { 921600, B921600 }, | ||
569 | +}; | ||
570 | + | ||
571 | +int set_baudrate(int fd, int baudrate, int hwflow) | ||
572 | +{ | ||
573 | + int i; | ||
574 | + u_int32_t bd = 0; | ||
575 | + struct termios ti; | ||
576 | + | ||
577 | + for (i = 0; i < ARRAY_SIZE(bdrts); i++) { | ||
578 | + if (bdrts[i].bps == baudrate) | ||
579 | + bd = bdrts[i].b; | ||
580 | + } | ||
581 | + if (bd == 0) | ||
582 | + return -EINVAL; | ||
583 | + | ||
584 | + i = tcgetattr(fd, &ti); | ||
585 | + if (i < 0) | ||
586 | + return i; | ||
587 | + | ||
588 | + i = cfsetispeed(&ti, B0); | ||
589 | + if (i < 0) | ||
590 | + return i; | ||
591 | + | ||
592 | + i = cfsetospeed(&ti, bd); | ||
593 | + if (i < 0) | ||
594 | + return i; | ||
595 | + | ||
596 | + if (hwflow) | ||
597 | + ti.c_cflag |= CRTSCTS; | ||
598 | + else | ||
599 | + ti.c_cflag &= ~CRTSCTS; | ||
600 | + | ||
601 | + return tcsetattr(fd, 0, &ti); | ||
602 | +} | ||
603 | + | ||
604 | +static int uart_select_cb(int fd, unsigned int what, void *data) | ||
605 | +{ | ||
606 | + struct gsmd_uart *uart = (struct gsmd_uart *) data; | ||
607 | + static char rxbuf[2048]; | ||
608 | + int rc, len; | ||
609 | + | ||
610 | + if ((what & GSMD_FD_READ) && uart->port.newdata_cb) { | ||
611 | + while ((len = read(fd, rxbuf, sizeof(rxbuf)))) { | ||
612 | + if (len < 0) { | ||
613 | + if (errno == EAGAIN || errno == EINTR) | ||
614 | + return 0; | ||
615 | + gsmd_log(GSMD_NOTICE, "ERROR reading from " | ||
616 | + "fd %u: %d (%s)\n", fd, errno, | ||
617 | + strerror(errno)); | ||
618 | + return -errno; | ||
619 | + } | ||
620 | + | ||
621 | + rc = uart->port.newdata_cb( | ||
622 | + uart->port.newdata_opaque, | ||
623 | + rxbuf, | ||
624 | + len); | ||
625 | + if (rc < 0) | ||
626 | + return rc; | ||
627 | + } | ||
628 | + } | ||
629 | + | ||
630 | + /* Write pending data to UART. */ | ||
631 | + if ((what & GSMD_FD_WRITE) && uart->tx_len) { | ||
632 | + while (uart->tx_start + uart->tx_len >= sizeof(uart->txfifo)) { | ||
633 | + len = sizeof(uart->txfifo) - uart->tx_start; | ||
634 | + rc = write(fd, &uart->txfifo[uart->tx_start], len); | ||
635 | + if (rc < 0 && errno != EINTR) { | ||
636 | + if (errno == EAGAIN) | ||
637 | + return 0; | ||
638 | + gsmd_log(GSMD_NOTICE, "ERROR writing " | ||
639 | + "fd %u: %d (%s)\n", fd, errno, | ||
640 | + strerror(errno)); | ||
641 | + return -errno; | ||
642 | + } | ||
643 | + | ||
644 | + if (rc > 0) { | ||
645 | + uart->tx_start += rc; | ||
646 | + uart->tx_len -= rc; | ||
647 | + } | ||
648 | + } | ||
649 | + uart->tx_start &= sizeof(uart->txfifo) - 1; | ||
650 | + | ||
651 | + while (uart->tx_len) { | ||
652 | + rc = write(fd, &uart->txfifo[uart->tx_start], | ||
653 | + uart->tx_len); | ||
654 | + if (rc < 0 && errno != EINTR) { | ||
655 | + if (errno == EAGAIN) | ||
656 | + return 0; | ||
657 | + gsmd_log(GSMD_NOTICE, "ERROR writing " | ||
658 | + "fd %u: %d (%s)\n", fd, errno, | ||
659 | + strerror(errno)); | ||
660 | + return -errno; | ||
661 | + } | ||
662 | + | ||
663 | + if (rc > 0) { | ||
664 | + uart->tx_start += rc; | ||
665 | + uart->tx_len -= rc; | ||
666 | + } | ||
667 | + } | ||
668 | + | ||
669 | + /* If we reached here, there's no more data for the moment. */ | ||
670 | + uart->gfd.when &= ~GSMD_FD_WRITE; | ||
671 | + } | ||
672 | + | ||
673 | + return 0; | ||
674 | +} | ||
675 | + | ||
676 | +static int uart_write(struct gsmd_port *port, const char data[], int len) | ||
677 | +{ | ||
678 | + struct gsmd_uart *uart = (struct gsmd_uart *) port; | ||
679 | + int start = (uart->tx_start + uart->tx_len) & | ||
680 | + (sizeof(uart->txfifo) - 1); | ||
681 | + int space = sizeof(uart->txfifo) - start; | ||
682 | + | ||
683 | + if (uart->tx_len + len > sizeof(uart->txfifo)) | ||
684 | + len = sizeof(uart->txfifo) - uart->tx_len; | ||
685 | + | ||
686 | + if (len) | ||
687 | + uart->gfd.when |= GSMD_FD_WRITE; | ||
688 | + | ||
689 | + if (len > space) { | ||
690 | + memcpy(uart->txfifo + start, data, space); | ||
691 | + memcpy(uart->txfifo, data + space, len - space); | ||
692 | + } else | ||
693 | + memcpy(uart->txfifo + start, data, len); | ||
694 | + | ||
695 | + uart->tx_len += len; | ||
696 | + return len; | ||
697 | +} | ||
698 | + | ||
699 | +int uart_init(struct gsmd_uart *uart, int sockfd) | ||
700 | +{ | ||
701 | + uart->gfd.fd = sockfd; | ||
702 | + uart->gfd.when = GSMD_FD_READ; | ||
703 | + uart->gfd.data = uart; | ||
704 | + uart->gfd.cb = &uart_select_cb; | ||
705 | + | ||
706 | + uart->port.write = uart_write; | ||
707 | + | ||
708 | + return gsmd_register_fd(&uart->gfd); | ||
709 | +} | ||
710 | -- | ||
711 | 1.5.2.1 | ||
712 | |||
diff --git a/meta/recipes-connectivity/gsm/files/0002-Flush-all-pending-commands-before-restarting-the-mod.patch b/meta/recipes-connectivity/gsm/files/0002-Flush-all-pending-commands-before-restarting-the-mod.patch deleted file mode 100644 index 51d50b917b..0000000000 --- a/meta/recipes-connectivity/gsm/files/0002-Flush-all-pending-commands-before-restarting-the-mod.patch +++ /dev/null | |||
@@ -1,76 +0,0 @@ | |||
1 | Upstream-Status: Inappropriate [not used] | ||
2 | |||
3 | From 1078f7aced63c6216bffe649930b97c9ccf9a16e Mon Sep 17 00:00:00 2001 | ||
4 | From: Andrzej Zaborowski <balrog@zabor.org> | ||
5 | Date: Wed, 19 Sep 2007 14:04:50 +0200 | ||
6 | Subject: [PATCH] Flush all pending commands before restarting the modem initialisation. | ||
7 | |||
8 | --- | ||
9 | include/gsmd/gsmd.h | 1 + | ||
10 | src/gsmd/atcmd.c | 21 +++++++++++++++++++++ | ||
11 | src/gsmd/timer.c | 8 ++++++++ | ||
12 | 3 files changed, 30 insertions(+), 0 deletions(-) | ||
13 | |||
14 | diff --git a/include/gsmd/gsmd.h b/include/gsmd/gsmd.h | ||
15 | index 4afdf66..6ac9d8e 100644 | ||
16 | --- a/include/gsmd/gsmd.h | ||
17 | +++ b/include/gsmd/gsmd.h | ||
18 | @@ -131,6 +131,7 @@ struct gsmd_timer { | ||
19 | |||
20 | int gsmd_timer_init(void); | ||
21 | void gmsd_timer_check_n_run(void); | ||
22 | +void gsmd_timer_reset(void); | ||
23 | |||
24 | struct gsmd_timer *gsmd_timer_alloc(void); | ||
25 | int gsmd_timer_register(struct gsmd_timer *timer); | ||
26 | diff --git a/src/gsmd/atcmd.c b/src/gsmd/atcmd.c | ||
27 | index 27dfa41..2f6cee2 100644 | ||
28 | --- a/src/gsmd/atcmd.c | ||
29 | +++ b/src/gsmd/atcmd.c | ||
30 | @@ -264,6 +264,27 @@ static int ml_parse(const char *buf, int len, void *ctx) | ||
31 | if (strlen(buf) == 0 || | ||
32 | !strcmp(buf, "AT-Command Interpreter ready")) { | ||
33 | g->interpreter_ready = 1; | ||
34 | + g->clear_to_send = 1; | ||
35 | + | ||
36 | + /* Flush current queue and reinitialise */ | ||
37 | + while (!llist_empty(&g->busy_atcmds)) { | ||
38 | + cmd = llist_entry(g->busy_atcmds.next, | ||
39 | + struct gsmd_atcmd, list); | ||
40 | + gsmd_log(GSMD_NOTICE, "discarding busy cmd %s\n", | ||
41 | + cmd->buf); | ||
42 | + llist_del(&cmd->list); | ||
43 | + talloc_free(cmd); | ||
44 | + } | ||
45 | + while (!llist_empty(&g->pending_atcmds)) { | ||
46 | + cmd = llist_entry(g->pending_atcmds.next, | ||
47 | + struct gsmd_atcmd, list); | ||
48 | + gsmd_log(GSMD_NOTICE, "discarding pending cmd %s\n", | ||
49 | + cmd->buf); | ||
50 | + llist_del(&cmd->list); | ||
51 | + talloc_free(cmd); | ||
52 | + } | ||
53 | + | ||
54 | + gsmd_timer_reset(); | ||
55 | gsmd_initsettings(g); | ||
56 | gmsd_alive_start(g); | ||
57 | atcmd_wake_queue(g); | ||
58 | diff --git a/src/gsmd/timer.c b/src/gsmd/timer.c | ||
59 | index 5200690..8877275 100644 | ||
60 | --- a/src/gsmd/timer.c | ||
61 | +++ b/src/gsmd/timer.c | ||
62 | @@ -215,3 +215,11 @@ void gsmd_timer_unregister(struct gsmd_timer *timer) | ||
63 | /* re-calculate next expiration */ | ||
64 | calc_next_expiration(); | ||
65 | } | ||
66 | + | ||
67 | +void gsmd_timer_reset(void) | ||
68 | +{ | ||
69 | + while (!llist_empty(&gsmd_timers)) | ||
70 | + /* TODO: free associated resources (e.g timer->cancel_cb()) */ | ||
71 | + llist_del(&llist_entry(gsmd_timers.next, | ||
72 | + struct gsmd_timer, list)->list); | ||
73 | +} | ||
74 | -- | ||
75 | 1.5.2.1 | ||
76 | |||
diff --git a/meta/recipes-connectivity/gsm/files/0003-Correctly-segment-incoming-usock-data-into-packets.patch b/meta/recipes-connectivity/gsm/files/0003-Correctly-segment-incoming-usock-data-into-packets.patch deleted file mode 100644 index 87aaf6b3b9..0000000000 --- a/meta/recipes-connectivity/gsm/files/0003-Correctly-segment-incoming-usock-data-into-packets.patch +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | Upstream-Status: Inappropriate [not used] | ||
2 | |||
3 | From 8af1bb4a0d0df9baa80859c5f7f56cbd7634aded Mon Sep 17 00:00:00 2001 | ||
4 | From: Andrzej Zaborowski <balrog@zabor.org> | ||
5 | Date: Wed, 19 Sep 2007 14:06:19 +0200 | ||
6 | Subject: [PATCH] Correctly segment incoming usock data into packets, handler short reads. | ||
7 | |||
8 | --- | ||
9 | include/gsmd/gsmd.h | 2 ++ | ||
10 | src/gsmd/usock.c | 20 ++++++++++++++++---- | ||
11 | 2 files changed, 18 insertions(+), 4 deletions(-) | ||
12 | |||
13 | diff --git a/include/gsmd/gsmd.h b/include/gsmd/gsmd.h | ||
14 | index 6ac9d8e..acec02a 100644 | ||
15 | --- a/include/gsmd/gsmd.h | ||
16 | +++ b/include/gsmd/gsmd.h | ||
17 | @@ -95,6 +95,8 @@ struct gsmd_user { | ||
18 | struct gsmd *gsmd; | ||
19 | struct gsmd_fd gfd; /* the socket */ | ||
20 | u_int32_t subscriptions; /* bitmaks of subscribed event groups */ | ||
21 | + char usock_fifo[1024]; | ||
22 | + int usock_len; | ||
23 | |||
24 | struct llist_head pb_readrg_list; /* our READRG phonebook list */ | ||
25 | struct llist_head pb_find_list; /* our FIND phonebook list */ | ||
26 | diff --git a/src/gsmd/usock.c b/src/gsmd/usock.c | ||
27 | index 32e98d0..bac5f0c 100644 | ||
28 | --- a/src/gsmd/usock.c | ||
29 | +++ b/src/gsmd/usock.c | ||
30 | @@ -1529,14 +1529,15 @@ static int usock_rcv_pcmd(struct gsmd_user *gu, char *buf, int len) | ||
31 | static int gsmd_usock_user_cb(int fd, unsigned int what, void *data) | ||
32 | { | ||
33 | struct gsmd_user *gu = data; | ||
34 | + struct gsmd_msg_hdr *gph; | ||
35 | |||
36 | /* FIXME: check some kind of backlog and limit it */ | ||
37 | |||
38 | if (what & GSMD_FD_READ) { | ||
39 | - char buf[1024]; | ||
40 | int rcvlen; | ||
41 | /* read data from socket, determine what he wants */ | ||
42 | - rcvlen = read(fd, buf, sizeof(buf)); | ||
43 | + rcvlen = read(fd, gu->usock_fifo + gu->usock_len, | ||
44 | + sizeof(gu->usock_fifo) - gu->usock_len); | ||
45 | if (rcvlen == 0) { | ||
46 | DEBUGP("EOF, this client has just vanished\n"); | ||
47 | /* EOF, this client has just vanished */ | ||
48 | @@ -1549,8 +1550,18 @@ static int gsmd_usock_user_cb(int fd, unsigned int what, void *data) | ||
49 | return 0; | ||
50 | } else if (rcvlen < 0) | ||
51 | return rcvlen; | ||
52 | - else | ||
53 | - return usock_rcv_pcmd(gu, buf, rcvlen); | ||
54 | + | ||
55 | + gu->usock_len += rcvlen; | ||
56 | + gph = (struct gsmd_msg_hdr *) gu->usock_fifo; | ||
57 | + while (gu->usock_len >= sizeof(*gph) && | ||
58 | + gu->usock_len >= sizeof(*gph) + gph->len) { | ||
59 | + usock_rcv_pcmd(gu, gu->usock_fifo, gu->usock_len); | ||
60 | + gu->usock_len -= sizeof(*gph) + gph->len; | ||
61 | + memmove(gu->usock_fifo, | ||
62 | + gu->usock_fifo + sizeof(*gph) + | ||
63 | + gph->len, | ||
64 | + gu->usock_len); | ||
65 | + } | ||
66 | } | ||
67 | |||
68 | if (what & GSMD_FD_WRITE) { | ||
69 | @@ -1609,6 +1620,7 @@ static int gsmd_usock_cb(int fd, unsigned int what, void *data) | ||
70 | newuser->gfd.cb = &gsmd_usock_user_cb; | ||
71 | newuser->gsmd = g; | ||
72 | newuser->subscriptions = 0xffffffff; | ||
73 | + newuser->usock_len = 0; | ||
74 | INIT_LLIST_HEAD(&newuser->finished_ucmds); | ||
75 | INIT_LLIST_HEAD(&newuser->pb_readrg_list); | ||
76 | INIT_LLIST_HEAD(&newuser->pb_find_list); | ||
77 | -- | ||
78 | 1.5.2.1 | ||
79 | |||
diff --git a/meta/recipes-connectivity/gsm/files/0004-Handle-read-and-write-return-values.patch b/meta/recipes-connectivity/gsm/files/0004-Handle-read-and-write-return-values.patch deleted file mode 100644 index 84a4aa12f3..0000000000 --- a/meta/recipes-connectivity/gsm/files/0004-Handle-read-and-write-return-values.patch +++ /dev/null | |||
@@ -1,178 +0,0 @@ | |||
1 | Upstream-Status: Inappropriate [not used] | ||
2 | |||
3 | From 421b0fa14fefbd13a455c20380fecddda616b41a Mon Sep 17 00:00:00 2001 | ||
4 | From: Andrzej Zaborowski <balrog@zabor.org> | ||
5 | Date: Wed, 19 Sep 2007 18:30:36 +0200 | ||
6 | Subject: [PATCH] Handle read() and write() return values. | ||
7 | |||
8 | --- | ||
9 | include/libgsmd/libgsmd.h | 3 +- | ||
10 | src/gsmd/usock.c | 38 ++++++++++++++++----------- | ||
11 | src/libgsmd/lgsm_internals.h | 2 + | ||
12 | src/libgsmd/libgsmd.c | 58 ++++++++++++++++++++++++++--------------- | ||
13 | 4 files changed, 63 insertions(+), 38 deletions(-) | ||
14 | |||
15 | diff --git a/include/libgsmd/libgsmd.h b/include/libgsmd/libgsmd.h | ||
16 | index fc56890..db15aa9 100644 | ||
17 | --- a/include/libgsmd/libgsmd.h | ||
18 | +++ b/include/libgsmd/libgsmd.h | ||
19 | @@ -65,6 +65,7 @@ extern int lgsm_subscriptions(struct lgsm_handle *lh, u_int32_t subscriptions); | ||
20 | |||
21 | extern struct gsmd_msg_hdr *lgsm_gmh_fill(int type, int subtype, int payload_len); | ||
22 | extern int lgsm_send(struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh); | ||
23 | -extern int lgsm_handle_packet(struct lgsm_handle *lh, char *buf, int len); | ||
24 | +extern int lgsm_handle_packet(struct lgsm_handle *lh, | ||
25 | + const char *buf, int len); | ||
26 | |||
27 | #endif | ||
28 | diff --git a/src/gsmd/usock.c b/src/gsmd/usock.c | ||
29 | index bac5f0c..2283600 100644 | ||
30 | --- a/src/gsmd/usock.c | ||
31 | +++ b/src/gsmd/usock.c | ||
32 | @@ -1569,23 +1569,29 @@ static int gsmd_usock_user_cb(int fd, unsigned int what, void *data) | ||
33 | struct gsmd_ucmd *ucmd, *uctmp; | ||
34 | llist_for_each_entry_safe(ucmd, uctmp, &gu->finished_ucmds, | ||
35 | list) { | ||
36 | - int rc; | ||
37 | - | ||
38 | - rc = write(fd, &ucmd->hdr, sizeof(ucmd->hdr) + ucmd->hdr.len); | ||
39 | - if (rc < 0) { | ||
40 | - DEBUGP("write return %d\n", rc); | ||
41 | - return rc; | ||
42 | - } | ||
43 | - if (rc == 0) { | ||
44 | - DEBUGP("write returns zero!!\n"); | ||
45 | - break; | ||
46 | + const void *pos = &ucmd->hdr; | ||
47 | + size_t len = sizeof(ucmd->hdr) + ucmd->hdr.len; | ||
48 | + | ||
49 | + while (len) { | ||
50 | + ssize_t rc; | ||
51 | + | ||
52 | + rc = write(fd, pos, len); | ||
53 | + if (rc < 0 && errno != EINTR) { | ||
54 | + DEBUGP("write returned %s\n", | ||
55 | + strerror(errno)); | ||
56 | + return rc; | ||
57 | + } | ||
58 | + if (rc == 0 && pos == &ucmd->hdr) { | ||
59 | + DEBUGP("write returns zero!!\n"); | ||
60 | + return 0; | ||
61 | + } | ||
62 | + if (rc > 0) { | ||
63 | + len -= rc; | ||
64 | + pos += rc; | ||
65 | + } | ||
66 | } | ||
67 | - if (rc != sizeof(ucmd->hdr) + ucmd->hdr.len) { | ||
68 | - DEBUGP("short write\n"); | ||
69 | - break; | ||
70 | - } | ||
71 | - | ||
72 | - DEBUGP("successfully sent cmd %p to user %p, freeing\n", ucmd, gu); | ||
73 | + DEBUGP("successfully sent cmd %p to user %p, " | ||
74 | + "freeing\n", ucmd, gu); | ||
75 | llist_del(&ucmd->list); | ||
76 | talloc_free(ucmd); | ||
77 | } | ||
78 | diff --git a/src/libgsmd/lgsm_internals.h b/src/libgsmd/lgsm_internals.h | ||
79 | index c826723..f1b1a23 100644 | ||
80 | --- a/src/libgsmd/lgsm_internals.h | ||
81 | +++ b/src/libgsmd/lgsm_internals.h | ||
82 | @@ -8,6 +8,8 @@ struct lgsm_handle { | ||
83 | int fd; | ||
84 | lgsm_msg_handler *handler[__NUM_GSMD_MSGS]; | ||
85 | enum lgsm_netreg_state netreg_state; | ||
86 | + char usock_fifo[1024]; | ||
87 | + int usock_len; | ||
88 | }; | ||
89 | |||
90 | int lgsm_send(struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh); | ||
91 | diff --git a/src/libgsmd/libgsmd.c b/src/libgsmd/libgsmd.c | ||
92 | index 9906ea8..cc804ed 100644 | ||
93 | --- a/src/libgsmd/libgsmd.c | ||
94 | +++ b/src/libgsmd/libgsmd.c | ||
95 | @@ -86,34 +86,37 @@ static int lgsm_open_backend(struct lgsm_handle *lh, const char *device) | ||
96 | } | ||
97 | |||
98 | /* handle a packet that was received on the gsmd socket */ | ||
99 | -int lgsm_handle_packet(struct lgsm_handle *lh, char *buf, int len) | ||
100 | +int lgsm_handle_packet(struct lgsm_handle *lh, const char *buf, int len) | ||
101 | { | ||
102 | struct gsmd_msg_hdr *gmh; | ||
103 | lgsm_msg_handler *handler; | ||
104 | int rc = 0; | ||
105 | |||
106 | - while (len) { | ||
107 | - if (len < sizeof(*gmh)) | ||
108 | - return -EINVAL; | ||
109 | - gmh = (struct gsmd_msg_hdr *) buf; | ||
110 | - | ||
111 | - if (len - sizeof(*gmh) < gmh->len) | ||
112 | - return -EINVAL; | ||
113 | - len -= sizeof(*gmh) + gmh->len; | ||
114 | - buf += sizeof(*gmh) + gmh->len; | ||
115 | - | ||
116 | - if (gmh->msg_type >= __NUM_GSMD_MSGS) | ||
117 | - return -EINVAL; | ||
118 | - | ||
119 | - handler = lh->handler[gmh->msg_type]; | ||
120 | + if (lh->usock_len + len > sizeof(lh->usock_fifo)) | ||
121 | + return -ENOMEM; | ||
122 | |||
123 | - if (handler) | ||
124 | + memcpy(lh->usock_fifo + lh->usock_len, buf, len); | ||
125 | + lh->usock_len += len; | ||
126 | + gmh = (struct gsmd_msg_hdr *) lh->usock_fifo; | ||
127 | + while (lh->usock_len >= sizeof(*gmh) && | ||
128 | + lh->usock_len >= sizeof(*gmh) + gmh->len) { | ||
129 | + if (gmh->msg_type < __NUM_GSMD_MSGS && | ||
130 | + (handler = lh->handler[gmh->msg_type])) | ||
131 | rc |= handler(lh, gmh); | ||
132 | - else | ||
133 | - fprintf(stderr, "unable to handle packet type=%u\n", | ||
134 | - gmh->msg_type); | ||
135 | + else { | ||
136 | + fprintf(stderr, "unable to handle packet " | ||
137 | + "type=%u id=%u\n", | ||
138 | + gmh->msg_type, gmh->id); | ||
139 | + rc |= EINVAL; | ||
140 | + } | ||
141 | + | ||
142 | + lh->usock_len -= gmh->len + sizeof(*gmh); | ||
143 | + memmove(lh->usock_fifo, | ||
144 | + lh->usock_fifo + gmh->len + sizeof(*gmh), | ||
145 | + lh->usock_len); | ||
146 | } | ||
147 | - return rc; | ||
148 | + | ||
149 | + return -rc; | ||
150 | } | ||
151 | |||
152 | int lgsm_register_handler(struct lgsm_handle *lh, int type, lgsm_msg_handler *handler) | ||
153 | @@ -193,8 +196,21 @@ static u_int16_t next_msg_id; | ||
154 | |||
155 | int lgsm_send(struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh) | ||
156 | { | ||
157 | + ssize_t rc; | ||
158 | + size_t len = sizeof(*gmh) + gmh->len; | ||
159 | + const void *pos = gmh; | ||
160 | + | ||
161 | gmh->id = next_msg_id++; | ||
162 | - return send(lh->fd, (char *) gmh, sizeof(*gmh) + gmh->len, 0); | ||
163 | + while (len) { | ||
164 | + rc = send(lh->fd, pos, len, 0); | ||
165 | + if (rc < 0 && errno != EINTR) | ||
166 | + return -errno; | ||
167 | + if (rc > 0) { | ||
168 | + len -= rc; | ||
169 | + pos += rc; | ||
170 | + } | ||
171 | + } | ||
172 | + return 0; | ||
173 | } | ||
174 | |||
175 | struct gsmd_msg_hdr *lgsm_gmh_fill(int type, int subtype, int payload_len) | ||
176 | -- | ||
177 | 1.5.2.1 | ||
178 | |||
diff --git a/meta/recipes-connectivity/gsm/files/0005-Add-ask-ds-option-forSMS.patch b/meta/recipes-connectivity/gsm/files/0005-Add-ask-ds-option-forSMS.patch deleted file mode 100644 index faf0e8a382..0000000000 --- a/meta/recipes-connectivity/gsm/files/0005-Add-ask-ds-option-forSMS.patch +++ /dev/null | |||
@@ -1,132 +0,0 @@ | |||
1 | Upstream-Status: Inappropriate [not used] | ||
2 | |||
3 | diff --git a/include/gsmd/usock.h b/include/gsmd/usock.h | ||
4 | index 236ad78..66cdf48 100644 | ||
5 | --- a/include/gsmd/usock.h | ||
6 | +++ b/include/gsmd/usock.h | ||
7 | @@ -332,6 +332,7 @@ struct gsmd_sms { | ||
8 | struct gsmd_sms_submit { | ||
9 | struct gsmd_addr addr; | ||
10 | struct gsmd_sms payload; | ||
11 | + int ask_ds; | ||
12 | }; | ||
13 | |||
14 | /* Refer to GSM 07.05 subclause 4.4 */ | ||
15 | diff --git a/include/libgsmd/sms.h b/include/libgsmd/sms.h | ||
16 | index 3ada62d..9808442 100644 | ||
17 | --- a/include/libgsmd/sms.h | ||
18 | +++ b/include/libgsmd/sms.h | ||
19 | @@ -46,6 +46,7 @@ struct lgsm_sms { | ||
20 | enum gsmd_sms_alphabet alpha; | ||
21 | u_int8_t data[LGSM_SMS_DATA_MAXLEN+1]; | ||
22 | int length; | ||
23 | + int ask_ds; | ||
24 | }; | ||
25 | |||
26 | /* GSM 03.40 subclause 9.2.2.2 and GSM 07.05 subclause 4.4 and subclause 3.1 */ | ||
27 | diff --git a/src/gsmd/sms_pdu.c b/src/gsmd/sms_pdu.c | ||
28 | index d1235dd..d461999 100644 | ||
29 | --- a/src/gsmd/sms_pdu.c | ||
30 | +++ b/src/gsmd/sms_pdu.c | ||
31 | @@ -247,7 +247,8 @@ int sms_pdu_make_smssubmit(char *dest, const struct gsmd_sms_submit *src) | ||
32 | GSMD_SMS_TP_MTI_SUBMIT | | ||
33 | (0 << 2) | /* Reject Duplicates: 0 */ | ||
34 | GSMD_SMS_TP_VPF_NOT_PRESENT | | ||
35 | - GSMD_SMS_TP_SRR_STATUS_REQUEST | | ||
36 | + (src->ask_ds ? GSMD_SMS_TP_SRR_STATUS_REQUEST : | ||
37 | + GSMD_SMS_TP_SRR_NOT_REQUEST) | | ||
38 | (src->payload.has_header ? GSMD_SMS_TP_UDHI_WITH_HEADER : | ||
39 | GSMD_SMS_TP_UDHI_NO_HEADER) | | ||
40 | GSMD_SMS_TP_RP_NOT_SET; | ||
41 | diff --git a/src/libgsmd/libgsmd_sms.c b/src/libgsmd/libgsmd_sms.c | ||
42 | index 22d7dbf..bbc8689 100644 | ||
43 | --- a/src/libgsmd/libgsmd_sms.c | ||
44 | +++ b/src/libgsmd/libgsmd_sms.c | ||
45 | @@ -126,6 +126,7 @@ int lgsm_sms_send(struct lgsm_handle *lh, | ||
46 | if (lgsm_number2addr(&gss->addr, sms->addr, 1)) | ||
47 | return -EINVAL; | ||
48 | |||
49 | + gss->ask_ds = sms->ask_ds; | ||
50 | gss->payload.has_header = 0; | ||
51 | gss->payload.length = sms->length; | ||
52 | gss->payload.coding_scheme = sms->alpha; | ||
53 | @@ -161,6 +162,7 @@ int lgsm_sms_write(struct lgsm_handle *lh, | ||
54 | if (lgsm_number2addr(&gsw->sms.addr, sms_write->sms.addr, 1)) | ||
55 | return -EINVAL; | ||
56 | |||
57 | + gsw->sms.ask_ds = sms_write->sms.ask_ds; | ||
58 | gsw->sms.payload.has_header = 0; | ||
59 | gsw->sms.payload.length = sms_write->sms.length; | ||
60 | gsw->sms.payload.coding_scheme = sms_write->sms.alpha; | ||
61 | diff --git a/src/util/shell.c b/src/util/shell.c | ||
62 | index f902126..f26e17e 100644 | ||
63 | --- a/src/util/shell.c | ||
64 | +++ b/src/util/shell.c | ||
65 | @@ -355,7 +355,7 @@ static int shell_help(void) | ||
66 | "\tsd\tSMS Delete (sd=index,delflg)\n" | ||
67 | "\tsl\tSMS List (sl=stat)\n" | ||
68 | "\tsr\tSMS Read (sr=index)\n" | ||
69 | - "\tss\tSMS Send (ss=number,text|[\"text\"])\n" | ||
70 | + "\tss\tSMS Send (ss=ask_ds,number,text|[\"text\"])\n" | ||
71 | "\tsw\tSMS Write (sw=stat,number,text)\n" | ||
72 | "\tsm\tSMS Storage stats\n" | ||
73 | "\tsM\tSMS Set preferred storage (sM=mem1,mem2,mem3)\n" | ||
74 | @@ -563,33 +563,29 @@ int shell_main(struct lgsm_handle *lgsmh) | ||
75 | struct lgsm_sms sms; | ||
76 | |||
77 | ptr = strchr(buf, '='); | ||
78 | + sms.ask_ds = atoi(ptr+1); | ||
79 | fcomma = strchr(buf, ','); | ||
80 | - if (!ptr || !fcomma) { | ||
81 | - printf("Wrong command format\n"); | ||
82 | - } else { | ||
83 | - strncpy(sms.addr, ptr+1, fcomma-ptr-1); | ||
84 | - sms.addr[fcomma-ptr-1] = '\0'; | ||
85 | - | ||
86 | - /* todo define \" to allow " in text */ | ||
87 | - if (fcomma[1] == '"' && | ||
88 | - !strchr(fcomma+2, '"')) { | ||
89 | + lcomma = strchr(fcomma+1, ','); | ||
90 | + strncpy(sms.addr, fcomma+1, lcomma-fcomma-1); | ||
91 | + sms.addr[lcomma-fcomma-1] = '\0'; | ||
92 | + /* todo define \" to allow " in text */ | ||
93 | + if (lcomma[1]=='"' && | ||
94 | + !strchr(lcomma+2, '"')) { | ||
95 | /* read until closing '"' */ | ||
96 | rc = fscanf(stdin, "%[^\"]\"", | ||
97 | - fcomma+strlen(fcomma)); | ||
98 | + lcomma+strlen(lcomma)); | ||
99 | if (rc == EOF) { | ||
100 | printf("EOF\n"); | ||
101 | return -1; | ||
102 | } | ||
103 | /* remove brackets */ | ||
104 | - fcomma++; | ||
105 | - fcomma[strlen(fcomma)] = '\0'; | ||
106 | - } | ||
107 | - | ||
108 | - printf("Send SMS\n"); | ||
109 | - packing_7bit_character(fcomma+1, &sms); | ||
110 | + lcomma++; | ||
111 | + lcomma[strlen(lcomma)] = '\0'; | ||
112 | + } | ||
113 | + printf("Send SMS\n"); | ||
114 | + packing_7bit_character(lcomma+1, &sms); | ||
115 | |||
116 | - lgsm_sms_send(lgsmh, &sms); | ||
117 | - } | ||
118 | + lgsm_sms_send(lgsmh, &sms); | ||
119 | } else if ( !strncmp(buf, "sw", 2)) { | ||
120 | printf("Write SMS\n"); | ||
121 | struct lgsm_sms_write sms_write; | ||
122 | @@ -603,6 +599,7 @@ int shell_main(struct lgsm_handle *lgsmh) | ||
123 | sms_write.sms.addr[lcomma-fcomma-1] = '\0'; | ||
124 | packing_7bit_character( | ||
125 | lcomma+1, &sms_write.sms); | ||
126 | + sms_write.sms.ask_ds = 0; | ||
127 | |||
128 | lgsm_sms_write(lgsmh, &sms_write); | ||
129 | } else if (!strncmp(buf, "sm", 2)) { | ||
130 | -- | ||
131 | 1.5.2.1 | ||
132 | |||
diff --git a/meta/recipes-connectivity/gsm/files/024_sms-text-in-bracket.patch b/meta/recipes-connectivity/gsm/files/024_sms-text-in-bracket.patch deleted file mode 100644 index 3aa13df01c..0000000000 --- a/meta/recipes-connectivity/gsm/files/024_sms-text-in-bracket.patch +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=834 | ||
2 | |||
3 | From: Kristian Mueller <kristian@mput.de> | ||
4 | Subject: [PATCH] libgsmd-tool does not allow sms with more than one word | ||
5 | |||
6 | libgsmd-tool only allows for command strings without spaces. | ||
7 | SMS messages with more than one word will be parsed as multible commands. | ||
8 | The patch introduces SMS message text in bracket and fixes a NULL pointer | ||
9 | reference on mailformed "ss" commands. | ||
10 | |||
11 | Signed-off-by: Jim Huang <jserv@openmoko.org> | ||
12 | |||
13 | Upstream-Status: Inappropriate [not used] | ||
14 | --- | ||
15 | src/util/shell.c | 32 ++++++++++++++++++++++++++------ | ||
16 | 1 file changed, 26 insertions(+), 6 deletions(-) | ||
17 | |||
18 | Index: gsm/src/util/shell.c | ||
19 | =================================================================== | ||
20 | --- gsm.orig/src/util/shell.c 2007-08-31 16:15:30.000000000 +0800 | ||
21 | +++ gsm/src/util/shell.c 2007-09-17 23:35:31.000000000 +0800 | ||
22 | @@ -389,7 +389,7 @@ | ||
23 | "\tsd\tSMS Delete (sd=index,delflg)\n" | ||
24 | "\tsl\tSMS List (sl=stat)\n" | ||
25 | "\tsr\tSMS Read (sr=index)\n" | ||
26 | - "\tss\tSMS Send (ss=number,text)\n" | ||
27 | + "\tss\tSMS Send (ss=number,text|[\"text\"])\n" | ||
28 | "\tsw\tSMS Write (sw=stat,number,text)\n" | ||
29 | "\tsm\tSMS Storage stats\n" | ||
30 | "\tsM\tSMS Set preferred storage (sM=mem1,mem2,mem3)\n" | ||
31 | @@ -612,16 +612,36 @@ | ||
32 | |||
33 | lgsm_sms_read(lgsmh, atoi(ptr+1)); | ||
34 | } else if ( !strncmp(buf, "ss", 2)) { | ||
35 | - printf("Send SMS\n"); | ||
36 | struct lgsm_sms sms; | ||
37 | |||
38 | ptr = strchr(buf, '='); | ||
39 | fcomma = strchr(buf, ','); | ||
40 | - strncpy(sms.addr, ptr+1, fcomma-ptr-1); | ||
41 | - sms.addr[fcomma-ptr-1] = '\0'; | ||
42 | - packing_7bit_character(fcomma+1, &sms); | ||
43 | + if (!ptr || !fcomma) { | ||
44 | + printf("Wrong command format\n"); | ||
45 | + } else { | ||
46 | + strncpy(sms.addr, ptr+1, fcomma-ptr-1); | ||
47 | + sms.addr[fcomma-ptr-1] = '\0'; | ||
48 | + | ||
49 | + /* todo define \" to allow " in text */ | ||
50 | + if (fcomma[1] == '"' && | ||
51 | + !strchr(fcomma+2, '"')) { | ||
52 | + /* read until closing '"' */ | ||
53 | + rc = fscanf(stdin, "%[^\"]\"", | ||
54 | + fcomma+strlen(fcomma)); | ||
55 | + if (rc == EOF) { | ||
56 | + printf("EOF\n"); | ||
57 | + return -1; | ||
58 | + } | ||
59 | + /* remove brackets */ | ||
60 | + fcomma++; | ||
61 | + fcomma[strlen(fcomma)] = '\0'; | ||
62 | + } | ||
63 | + | ||
64 | + printf("Send SMS\n"); | ||
65 | + packing_7bit_character(fcomma+1, &sms); | ||
66 | |||
67 | - lgsm_sms_send(lgsmh, &sms); | ||
68 | + lgsm_sms_send(lgsmh, &sms); | ||
69 | + } | ||
70 | } else if ( !strncmp(buf, "sw", 2)) { | ||
71 | printf("Write SMS\n"); | ||
72 | struct lgsm_sms_write sms_write; | ||
diff --git a/meta/recipes-connectivity/gsm/files/025_sms-status-report.patch b/meta/recipes-connectivity/gsm/files/025_sms-status-report.patch deleted file mode 100644 index a0f466a00e..0000000000 --- a/meta/recipes-connectivity/gsm/files/025_sms-status-report.patch +++ /dev/null | |||
@@ -1,135 +0,0 @@ | |||
1 | Upstream-Status: Inappropriate [not used] | ||
2 | |||
3 | From: Erin Yueh <erin_yueh@openmoko.com> | ||
4 | Subject: [PATCH] SMS status report | ||
5 | |||
6 | I made a patch for SMS status report. It can change SMS-Submit messages | ||
7 | and ask for a status report. When the destination address receives our | ||
8 | message, the service center will send a SMS-STATUS-REPORT to us. We can | ||
9 | tell what messages we sent by TP-MR (message reference number) value and | ||
10 | can know the sending result by TP-ST (Status) value from status report | ||
11 | messages. | ||
12 | |||
13 | PS. if you don't want to ask a status report, you can change this value | ||
14 | back. Replace "GSMD_SMS_TP_SRR_STATUS_REQUEST" with | ||
15 | "GSMD_SMS_TP_SRR_NOT_REQUEST". | ||
16 | header[pos ++] = | ||
17 | GSMD_SMS_TP_MTI_SUBMIT | | ||
18 | (0 << 2) | /* Reject Duplicates: 0 */ | ||
19 | GSMD_SMS_TP_VPF_NOT_PRESENT | | ||
20 | - GSMD_SMS_TP_SRR_NOT_REQUEST | | ||
21 | + GSMD_SMS_TP_SRR_STATUS_REQUEST | | ||
22 | (src->payload.has_header ? GSMD_SMS_TP_UDHI_WITH_HEADER : | ||
23 | GSMD_SMS_TP_UDHI_NO_HEADER) | | ||
24 | GSMD_SMS_TP_RP_NOT_SET; | ||
25 | |||
26 | Signed-off-by: Jim Huang <jserv@openmoko.org> | ||
27 | --- | ||
28 | src/gsmd/sms_pdu.c | 54 +++++++++++++++++++++++++++++++++++++++++++----------- | ||
29 | src/util/event.c | 6 +++++- | ||
30 | 2 files changed, 48 insertions(+), 12 deletions(-) | ||
31 | |||
32 | Index: gsm/src/gsmd/sms_pdu.c | ||
33 | =================================================================== | ||
34 | --- gsm.orig/src/gsmd/sms_pdu.c 2007-09-06 11:14:34.000000000 +0800 | ||
35 | +++ gsm/src/gsmd/sms_pdu.c 2007-09-17 23:39:20.000000000 +0800 | ||
36 | @@ -139,6 +139,17 @@ | ||
37 | /* Skip TP-PID */ | ||
38 | len -= 9; | ||
39 | src += 9; | ||
40 | + | ||
41 | + /* TP-UDL */ | ||
42 | + dst->payload.length = src[0]; | ||
43 | + i = sms_data_bytelen(dst->payload.coding_scheme, src[0]); | ||
44 | + | ||
45 | + /* TP-UD */ | ||
46 | + if (len < 1 + i || i > GSMD_SMS_DATA_MAXLEN) | ||
47 | + return 1; | ||
48 | + memcpy(dst->payload.data, src + 1, i); | ||
49 | + dst->payload.data[i] = 0; | ||
50 | + | ||
51 | break; | ||
52 | case GSMD_SMS_TP_MTI_SUBMIT: | ||
53 | if (len < 4) | ||
54 | @@ -179,23 +190,44 @@ | ||
55 | src += vpf ? 3 : 2; | ||
56 | |||
57 | memset(dst->time_stamp, 0, 7); | ||
58 | + | ||
59 | + /* TP-UDL */ | ||
60 | + dst->payload.length = src[0]; | ||
61 | + i = sms_data_bytelen(dst->payload.coding_scheme, src[0]); | ||
62 | + | ||
63 | + /* TP-UD */ | ||
64 | + if (len < 1 + i || i > GSMD_SMS_DATA_MAXLEN) | ||
65 | + return 1; | ||
66 | + memcpy(dst->payload.data, src + 1, i); | ||
67 | + dst->payload.data[i] = 0; | ||
68 | break; | ||
69 | case GSMD_SMS_TP_MTI_STATUS_REPORT: | ||
70 | - /* TODO */ | ||
71 | + if (len < 3) | ||
72 | + return 1; | ||
73 | + | ||
74 | + /* TP-MR set it gsmd_sms_list.index*/ | ||
75 | + dst->index = (int) src[1]; | ||
76 | + /* TP-STATUS set it to coding_scheme */ | ||
77 | + dst->payload.coding_scheme = (int) src[len-1]; | ||
78 | + /* TP-RA */ | ||
79 | + i = sms_number_bytelen(src[3], src[2]); | ||
80 | + if (len < 13 + i) | ||
81 | + return 1; | ||
82 | + if (sms_address2ascii(&dst->addr, src + 2)) | ||
83 | + return 1; | ||
84 | + len -= 4 + i; | ||
85 | + src += 4 + i; | ||
86 | + /* TP-SCTS */ | ||
87 | + memcpy(dst->time_stamp, src, 7); | ||
88 | + /* TP-UD */ | ||
89 | + dst->payload.length = 0; | ||
90 | + dst->payload.data[0] = 0; | ||
91 | + break; | ||
92 | default: | ||
93 | /* Unknown PDU type */ | ||
94 | return 1; | ||
95 | } | ||
96 | |||
97 | - /* TP-UDL */ | ||
98 | - dst->payload.length = src[0]; | ||
99 | - i = sms_data_bytelen(dst->payload.coding_scheme, src[0]); | ||
100 | - | ||
101 | - /* TP-UD */ | ||
102 | - if (len < 1 + i || i > GSMD_SMS_DATA_MAXLEN) | ||
103 | - return 1; | ||
104 | - memcpy(dst->payload.data, src + 1, i); | ||
105 | - dst->payload.data[i] = 0; | ||
106 | |||
107 | return 0; | ||
108 | } | ||
109 | @@ -215,7 +247,7 @@ | ||
110 | GSMD_SMS_TP_MTI_SUBMIT | | ||
111 | (0 << 2) | /* Reject Duplicates: 0 */ | ||
112 | GSMD_SMS_TP_VPF_NOT_PRESENT | | ||
113 | - GSMD_SMS_TP_SRR_NOT_REQUEST | | ||
114 | + GSMD_SMS_TP_SRR_STATUS_REQUEST | | ||
115 | (src->payload.has_header ? GSMD_SMS_TP_UDHI_WITH_HEADER : | ||
116 | GSMD_SMS_TP_UDHI_NO_HEADER) | | ||
117 | GSMD_SMS_TP_RP_NOT_SET; | ||
118 | Index: gsm/src/util/event.c | ||
119 | =================================================================== | ||
120 | --- gsm.orig/src/util/event.c 2007-09-06 11:14:34.000000000 +0800 | ||
121 | +++ gsm/src/util/event.c 2007-09-17 23:39:47.000000000 +0800 | ||
122 | @@ -128,8 +128,12 @@ | ||
123 | static int inds_handler(struct lgsm_handle *lh, int evt, | ||
124 | struct gsmd_evt_auxdata *aux) | ||
125 | { | ||
126 | - if (aux->u.ds.inlined) | ||
127 | + if (aux->u.ds.inlined) { | ||
128 | + struct gsmd_sms_list *sms; | ||
129 | + sms = (struct gsmd_sms_list *) aux->data; | ||
130 | printf("EVENT: Incoming Status Report\n"); | ||
131 | + printf("message ref = %d, status = %d\n", sms->index,sms->payload.coding_scheme); | ||
132 | + } | ||
133 | else | ||
134 | printf("EVENT: Incoming Status Report stored at location %i\n", | ||
135 | aux->u.ds.index); | ||
diff --git a/meta/recipes-connectivity/gsm/files/027_phonebook-find-and-read-range-support.patch b/meta/recipes-connectivity/gsm/files/027_phonebook-find-and-read-range-support.patch deleted file mode 100644 index c94e4b2035..0000000000 --- a/meta/recipes-connectivity/gsm/files/027_phonebook-find-and-read-range-support.patch +++ /dev/null | |||
@@ -1,425 +0,0 @@ | |||
1 | Upstream-Status: Inappropriate [not used] | ||
2 | |||
3 | From: Sean Chiang <sean_chiang@openmoko.com> | ||
4 | Subject: [PATCH] Improvement for find and read phonebooks in gsmd | ||
5 | |||
6 | This patch is an improvement for find and read phonebooks. | ||
7 | After clients make a request to find / read phonebooks, then clients | ||
8 | should make a request to retrieve all the records. | ||
9 | |||
10 | Signed-off-by: Jim Huang <jserv@openmoko.org> | ||
11 | --- | ||
12 | include/gsmd/gsmd.h | 3 | ||
13 | include/gsmd/usock.h | 20 +++- | ||
14 | include/libgsmd/phonebook.h | 6 + | ||
15 | src/gsmd/usock.c | 184 +++++++++++++++++++++++++++++++++++----- | ||
16 | src/libgsmd/libgsmd_phonebook.c | 48 ++++++++++ | ||
17 | 5 files changed, 238 insertions(+), 23 deletions(-) | ||
18 | |||
19 | Index: gsm/include/libgsmd/phonebook.h | ||
20 | =================================================================== | ||
21 | --- gsm.orig/include/libgsmd/phonebook.h 2007-08-31 16:15:29.000000000 +0800 | ||
22 | +++ gsm/include/libgsmd/phonebook.h 2007-09-17 23:48:41.000000000 +0800 | ||
23 | @@ -106,4 +106,10 @@ | ||
24 | /* Get the location range/nlength/tlength supported */ | ||
25 | extern int lgsm_pb_get_support(struct lgsm_handle *lh); | ||
26 | |||
27 | +/* Retrieve the records of READRG request */ | ||
28 | +extern int lgsm_pb_retrieve_readrg(struct lgsm_handle *lh, int num); | ||
29 | + | ||
30 | +/* Retrieve the records of FIND request */ | ||
31 | +extern int lgsm_pb_retrieve_find(struct lgsm_handle *lh, int num); | ||
32 | + | ||
33 | #endif | ||
34 | Index: gsm/include/gsmd/gsmd.h | ||
35 | =================================================================== | ||
36 | --- gsm.orig/include/gsmd/gsmd.h 2007-08-31 16:15:29.000000000 +0800 | ||
37 | +++ gsm/include/gsmd/gsmd.h 2007-09-17 23:48:41.000000000 +0800 | ||
38 | @@ -92,6 +92,9 @@ | ||
39 | struct gsmd *gsmd; | ||
40 | struct gsmd_fd gfd; /* the socket */ | ||
41 | u_int32_t subscriptions; /* bitmaks of subscribed event groups */ | ||
42 | + | ||
43 | + struct llist_head pb_readrg_list; /* our READRG phonebook list */ | ||
44 | + struct llist_head pb_find_list; /* our FIND phonebook list */ | ||
45 | }; | ||
46 | |||
47 | #define GSMD_DEBUG 1 /* debugging information */ | ||
48 | Index: gsm/include/gsmd/usock.h | ||
49 | =================================================================== | ||
50 | --- gsm.orig/include/gsmd/usock.h 2007-08-31 16:15:29.000000000 +0800 | ||
51 | +++ gsm/include/gsmd/usock.h 2007-09-17 23:48:56.000000000 +0800 | ||
52 | @@ -194,6 +194,8 @@ | ||
53 | GSMD_PHONEBOOK_GET_SUPPORT = 6, | ||
54 | GSMD_PHONEBOOK_LIST_STORAGE = 7, | ||
55 | GSMD_PHONEBOOK_SET_STORAGE = 8, | ||
56 | + GSMD_PHONEBOOK_RETRIEVE_READRG = 9, | ||
57 | + GSMD_PHONEBOOK_RETRIEVE_FIND = 10, | ||
58 | }; | ||
59 | |||
60 | /* Type-of-Address, Numbering-Plan-Identification field, GSM 03.40, 9.1.2.5 */ | ||
61 | @@ -431,7 +433,6 @@ | ||
62 | char text[GSMD_PB_TEXT_MAXLEN+1]; | ||
63 | } __attribute__ ((packed)); | ||
64 | |||
65 | - | ||
66 | /* Refer to GSM 07.07 subclause 8.13 */ | ||
67 | /* FIXME: the tlength depends on SIM, use +CPBR=? to get */ | ||
68 | struct gsmd_phonebook_find { | ||
69 | @@ -471,8 +472,18 @@ | ||
70 | char opname_longalpha[16]; | ||
71 | }; | ||
72 | |||
73 | +/* Refer to GSM 07.07 subclause 8.11 */ | ||
74 | +struct gsmd_phonebook_mem { | ||
75 | + u_int8_t type[3]; | ||
76 | + u_int8_t pad; | ||
77 | + u_int16_t used; | ||
78 | + u_int16_t total; | ||
79 | +} __attribute__ ((packed)); | ||
80 | + | ||
81 | struct gsmd_phonebook_storage { | ||
82 | - char storage[3]; | ||
83 | + /* FIXME the amount of phonebook storage should be dynamic */ | ||
84 | + u_int8_t num; | ||
85 | + struct gsmd_phonebook_mem mem[20]; | ||
86 | } __attribute__ ((packed)); | ||
87 | |||
88 | /* Subscriber number information from 3GPP TS 07.07, Clause 7.1 */ | ||
89 | @@ -517,6 +528,11 @@ | ||
90 | char buf[]; | ||
91 | } __attribute__ ((packed)); | ||
92 | |||
93 | +struct gsmd_phonebooks { | ||
94 | + struct llist_head list; | ||
95 | + struct gsmd_phonebook pb; | ||
96 | +} __attribute__ ((packed)); | ||
97 | + | ||
98 | extern struct gsmd_ucmd *ucmd_alloc(int extra_size); | ||
99 | extern int usock_init(struct gsmd *g); | ||
100 | extern void usock_cmd_enqueue(struct gsmd_ucmd *ucmd, struct gsmd_user *gu); | ||
101 | Index: gsm/src/libgsmd/libgsmd_phonebook.c | ||
102 | =================================================================== | ||
103 | --- gsm.orig/src/libgsmd/libgsmd_phonebook.c 2007-08-31 16:15:29.000000000 +0800 | ||
104 | +++ gsm/src/libgsmd/libgsmd_phonebook.c 2007-09-17 23:48:41.000000000 +0800 | ||
105 | @@ -33,7 +33,7 @@ | ||
106 | gmh->data[2] = '\0'; | ||
107 | |||
108 | rc = lgsm_send(lh, gmh); | ||
109 | - if (rc < gmh->len + 3) { | ||
110 | + if (rc < gmh->len + sizeof(*gmh)) { | ||
111 | lgsm_gmh_free(gmh); | ||
112 | return -EIO; | ||
113 | } | ||
114 | @@ -177,3 +177,49 @@ | ||
115 | { | ||
116 | return lgsm_send_simple(lh, GSMD_MSG_PHONEBOOK, GSMD_PHONEBOOK_GET_SUPPORT); | ||
117 | } | ||
118 | + | ||
119 | +int lgsm_pb_retrieve_readrg(struct lgsm_handle *lh, int num) | ||
120 | +{ | ||
121 | + struct gsmd_msg_hdr *gmh; | ||
122 | + int rc; | ||
123 | + | ||
124 | + gmh = lgsm_gmh_fill(GSMD_MSG_PHONEBOOK, | ||
125 | + GSMD_PHONEBOOK_RETRIEVE_READRG, sizeof(int)); | ||
126 | + if (!gmh) | ||
127 | + return -ENOMEM; | ||
128 | + | ||
129 | + *(int *)(gmh->data) = num; | ||
130 | + | ||
131 | + rc = lgsm_send(lh, gmh); | ||
132 | + if (rc < gmh->len + sizeof(*gmh)) { | ||
133 | + lgsm_gmh_free(gmh); | ||
134 | + return -EIO; | ||
135 | + } | ||
136 | + | ||
137 | + lgsm_gmh_free(gmh); | ||
138 | + | ||
139 | + return 0; | ||
140 | +} | ||
141 | + | ||
142 | +int lgsm_pb_retrieve_find(struct lgsm_handle *lh, int num) | ||
143 | +{ | ||
144 | + struct gsmd_msg_hdr *gmh; | ||
145 | + int rc; | ||
146 | + | ||
147 | + gmh = lgsm_gmh_fill(GSMD_MSG_PHONEBOOK, | ||
148 | + GSMD_PHONEBOOK_RETRIEVE_FIND, sizeof(int)); | ||
149 | + if (!gmh) | ||
150 | + return -ENOMEM; | ||
151 | + | ||
152 | + *(int *)(gmh->data) = num; | ||
153 | + | ||
154 | + rc = lgsm_send(lh, gmh); | ||
155 | + if (rc < gmh->len + sizeof(*gmh)) { | ||
156 | + lgsm_gmh_free(gmh); | ||
157 | + return -EIO; | ||
158 | + } | ||
159 | + | ||
160 | + lgsm_gmh_free(gmh); | ||
161 | + | ||
162 | + return 0; | ||
163 | +} | ||
164 | Index: gsm/src/gsmd/usock.c | ||
165 | =================================================================== | ||
166 | --- gsm.orig/src/gsmd/usock.c 2007-08-31 16:15:30.000000000 +0800 | ||
167 | +++ gsm/src/gsmd/usock.c 2007-09-17 23:53:34.000000000 +0800 | ||
168 | @@ -1035,21 +1035,56 @@ | ||
169 | |||
170 | static int phonebook_find_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp) | ||
171 | { | ||
172 | - struct gsmd_user *gu = ctx; | ||
173 | - struct gsmd_ucmd *ucmd; | ||
174 | - | ||
175 | + struct gsmd_user *gu = ctx; | ||
176 | + struct gsmd_ucmd *ucmd; | ||
177 | + struct gsmd_phonebooks *gps; | ||
178 | + char *fcomma, *lcomma, *ptr1, *ptr2 = NULL; | ||
179 | + int *num; | ||
180 | + | ||
181 | DEBUGP("resp: %s\n", resp); | ||
182 | |||
183 | - /* FIXME: using link list, also we need to handle the case of | ||
184 | - * no query result */ | ||
185 | - ucmd = gsmd_ucmd_fill(strlen(resp) + 1, GSMD_MSG_PHONEBOOK, | ||
186 | + /* | ||
187 | + * [+CPBF: <index1>,<number>,<type>,<text>[[...] | ||
188 | + * <CR><LF>+CPBF: <index2>,<unmber>,<type>,<text>]] | ||
189 | + */ | ||
190 | + ucmd = gsmd_ucmd_fill(sizeof(int), GSMD_MSG_PHONEBOOK, | ||
191 | GSMD_PHONEBOOK_FIND, 0); | ||
192 | if (!ucmd) | ||
193 | return -ENOMEM; | ||
194 | |||
195 | - strcpy(ucmd->buf, resp); | ||
196 | + num = (int*) ucmd->buf; | ||
197 | + | ||
198 | + *num = 0; | ||
199 | + | ||
200 | + ptr1 = strtok(resp, "\n"); | ||
201 | + | ||
202 | + while (ptr1) { | ||
203 | + gps = (struct gsmd_phonebooks *) malloc(sizeof(struct gsmd_phonebooks)); | ||
204 | + ptr2 = strchr(ptr1, ' '); | ||
205 | + gps->pb.index = atoi(ptr2+1); | ||
206 | + | ||
207 | + fcomma = strchr(ptr1, '"'); | ||
208 | + lcomma = strchr(fcomma+1, '"'); | ||
209 | + strncpy(gps->pb.numb, fcomma + 1, (lcomma-fcomma-1)); | ||
210 | + gps->pb.numb[(lcomma - fcomma) - 1] = '\0'; | ||
211 | + | ||
212 | + gps->pb.type = atoi(lcomma + 2); | ||
213 | + | ||
214 | + ptr2 = strrchr(ptr1, ','); | ||
215 | + fcomma = ptr2 + 1; | ||
216 | + lcomma = strchr(fcomma + 1, '"'); | ||
217 | + strncpy(gps->pb.text, fcomma + 1, (lcomma - fcomma - 1)); | ||
218 | + gps->pb.text[(lcomma - fcomma) - 1] = '\0'; | ||
219 | + | ||
220 | + llist_add_tail(&gps->list, &gu->pb_find_list); | ||
221 | + | ||
222 | + (*num)++; | ||
223 | + | ||
224 | + ptr1 = strtok(NULL, "\n"); | ||
225 | + } | ||
226 | |||
227 | usock_cmd_enqueue(ucmd, gu); | ||
228 | + | ||
229 | return 0; | ||
230 | } | ||
231 | |||
232 | @@ -1102,22 +1137,51 @@ | ||
233 | { | ||
234 | struct gsmd_user *gu = ctx; | ||
235 | struct gsmd_ucmd *ucmd; | ||
236 | + struct gsmd_phonebooks *gps; | ||
237 | + char *fcomma, *lcomma, *ptr1, *ptr2 = NULL; | ||
238 | + int *num; | ||
239 | |||
240 | DEBUGP("resp: %s\n", resp); | ||
241 | |||
242 | /* | ||
243 | - * +CPBR: 4,"1234",129,"6C5F745E7965" | ||
244 | - * +CPBR: 5,"5678",129,"800062115BB6" | ||
245 | - * +CPBR: 6,"7890",129,"810280AA591A" | ||
246 | - * +CPBR: 8,"36874",129,"005300650061006E" | ||
247 | - * | ||
248 | + * [+CPBR: <index1>,<number>,<type>,<text>[[...] | ||
249 | + * <CR><LF>+CPBR: <index2>,<unmber>,<type>,<text>]] | ||
250 | */ | ||
251 | - ucmd = gsmd_ucmd_fill(strlen(resp)+1, GSMD_MSG_PHONEBOOK, | ||
252 | + ucmd = gsmd_ucmd_fill(sizeof(int), GSMD_MSG_PHONEBOOK, | ||
253 | GSMD_PHONEBOOK_READRG, 0); | ||
254 | if (!ucmd) | ||
255 | return -ENOMEM; | ||
256 | |||
257 | - strcpy(ucmd->buf, resp); | ||
258 | + num = (int*) ucmd->buf; | ||
259 | + | ||
260 | + *num = 0; | ||
261 | + | ||
262 | + ptr1 = strtok(resp, "\n"); | ||
263 | + | ||
264 | + while(ptr1) { | ||
265 | + gps = (struct gsmd_phonebooks *) malloc(sizeof(struct gsmd_phonebooks)); | ||
266 | + ptr2 = strchr(ptr1, ' '); | ||
267 | + gps->pb.index = atoi(ptr2+1); | ||
268 | + | ||
269 | + fcomma = strchr(ptr1, '"'); | ||
270 | + lcomma = strchr(fcomma+1, '"'); | ||
271 | + strncpy(gps->pb.numb, fcomma + 1, (lcomma-fcomma-1)); | ||
272 | + gps->pb.numb[(lcomma - fcomma) - 1] = '\0'; | ||
273 | + | ||
274 | + gps->pb.type = atoi(lcomma + 2); | ||
275 | + | ||
276 | + ptr2 = strrchr(ptr1, ','); | ||
277 | + fcomma = ptr2 + 1; | ||
278 | + lcomma = strchr(fcomma + 1, '"'); | ||
279 | + strncpy(gps->pb.text, fcomma + 1, (lcomma - fcomma - 1)); | ||
280 | + gps->pb.text[(lcomma - fcomma) - 1] = '\0'; | ||
281 | + | ||
282 | + llist_add_tail(&gps->list, &gu->pb_readrg_list); | ||
283 | + | ||
284 | + (*num)++; | ||
285 | + | ||
286 | + ptr1 = strtok(NULL, "\n"); | ||
287 | + } | ||
288 | |||
289 | usock_cmd_enqueue(ucmd, gu); | ||
290 | |||
291 | @@ -1209,22 +1273,38 @@ | ||
292 | static int phonebook_list_storage_cb(struct gsmd_atcmd *cmd, | ||
293 | void *ctx, char *resp) | ||
294 | { | ||
295 | - /* +CPBS: ("EN","BD","FD","DC","LD","RC","LR","MT","AD", | ||
296 | - * "SM","SD","MC","LM","AF","ON","UD") */ | ||
297 | /* TODO; using link list ; need to handle command error */ | ||
298 | struct gsmd_user *gu = ctx; | ||
299 | struct gsmd_ucmd *ucmd; | ||
300 | + struct gsmd_phonebook_storage *gps; | ||
301 | + char *ptr; | ||
302 | |||
303 | DEBUGP("resp: %s\n", resp); | ||
304 | |||
305 | - ucmd = gsmd_ucmd_fill(strlen(resp) + 1, | ||
306 | + /* | ||
307 | + * +CPBS: (<storage>s) | ||
308 | + */ | ||
309 | + | ||
310 | + ucmd = gsmd_ucmd_fill(sizeof(*gps), | ||
311 | GSMD_MSG_PHONEBOOK, | ||
312 | GSMD_PHONEBOOK_LIST_STORAGE, 0); | ||
313 | |||
314 | if (!ucmd) | ||
315 | return -ENOMEM; | ||
316 | |||
317 | - strcpy(ucmd->buf, resp); | ||
318 | + gps = (struct gsmd_phonebook_storage *) ucmd->buf; | ||
319 | + gps->num = 0; | ||
320 | + | ||
321 | + if (!strncmp(resp, "+CPBS", 5)) { | ||
322 | + char* delim = "(,"; | ||
323 | + ptr = strpbrk(resp, delim); | ||
324 | + while ( ptr ) { | ||
325 | + strncpy(gps->mem[gps->num].type, ptr+2, 2); | ||
326 | + gps->mem[gps->num].type[2] = '\0'; | ||
327 | + ptr = strpbrk(ptr+2, delim); | ||
328 | + gps->num++; | ||
329 | + } | ||
330 | + } | ||
331 | |||
332 | usock_cmd_enqueue(ucmd, gu); | ||
333 | |||
334 | @@ -1235,11 +1315,13 @@ | ||
335 | struct gsmd_msg_hdr *gph,int len) | ||
336 | { | ||
337 | struct gsmd_atcmd *cmd = NULL; | ||
338 | + struct gsmd_ucmd *ucmd = NULL; | ||
339 | struct gsmd_phonebook_readrg *gpr; | ||
340 | struct gsmd_phonebook *gp; | ||
341 | struct gsmd_phonebook_find *gpf; | ||
342 | - int *index; | ||
343 | - int atcmd_len; | ||
344 | + struct gsmd_phonebooks *cur, *cur2; | ||
345 | + int *index, *num; | ||
346 | + int atcmd_len, i; | ||
347 | char *storage; | ||
348 | char buf[1024]; | ||
349 | |||
350 | @@ -1343,6 +1425,66 @@ | ||
351 | cmd = atcmd_fill("AT+CPBR=?", 9+1, | ||
352 | &phonebook_get_support_cb, gu, gph->id); | ||
353 | break; | ||
354 | + case GSMD_PHONEBOOK_RETRIEVE_READRG: | ||
355 | + if (len < sizeof(*gph) + sizeof(int)) | ||
356 | + return -EINVAL; | ||
357 | + | ||
358 | + num = (int *) ((void *)gph + sizeof(*gph)); | ||
359 | + | ||
360 | + ucmd = gsmd_ucmd_fill(sizeof(struct gsmd_phonebook)*(*num), | ||
361 | + GSMD_MSG_PHONEBOOK, | ||
362 | + GSMD_PHONEBOOK_RETRIEVE_READRG, 0); | ||
363 | + if (!ucmd) | ||
364 | + return -ENOMEM; | ||
365 | + | ||
366 | + gp = (struct gsmd_phonebook*) ucmd->buf; | ||
367 | + | ||
368 | + if (!llist_empty(&gu->pb_readrg_list)) { | ||
369 | + | ||
370 | + llist_for_each_entry_safe(cur, cur2, | ||
371 | + &gu->pb_readrg_list, list) { | ||
372 | + gp->index = cur->pb.index; | ||
373 | + strcpy(gp->numb, cur->pb.numb); | ||
374 | + gp->type = cur->pb.type; | ||
375 | + strcpy(gp->text, cur->pb.text); | ||
376 | + gp++; | ||
377 | + | ||
378 | + llist_del(&cur->list); | ||
379 | + free(cur); | ||
380 | + } | ||
381 | + } | ||
382 | + | ||
383 | + usock_cmd_enqueue(ucmd, gu); | ||
384 | + | ||
385 | + break; | ||
386 | + case GSMD_PHONEBOOK_RETRIEVE_FIND: | ||
387 | + if (len < sizeof(*gph) + sizeof(int)) | ||
388 | + return -EINVAL; | ||
389 | + | ||
390 | + num = (int *) ((void *)gph + sizeof(*gph)); | ||
391 | + | ||
392 | + ucmd = gsmd_ucmd_fill(sizeof(struct gsmd_phonebook)*(*num), GSMD_MSG_PHONEBOOK, | ||
393 | + GSMD_PHONEBOOK_RETRIEVE_FIND, 0); | ||
394 | + if (!ucmd) | ||
395 | + return -ENOMEM; | ||
396 | + | ||
397 | + gp = (struct gsmd_phonebook*) ucmd->buf; | ||
398 | + | ||
399 | + if (!llist_empty(&gu->pb_find_list)) { | ||
400 | + llist_for_each_entry_safe(cur, cur2, &gu->pb_find_list, list) { | ||
401 | + gp->index = cur->pb.index; | ||
402 | + strcpy(gp->numb, cur->pb.numb); | ||
403 | + gp->type = cur->pb.type; | ||
404 | + strcpy(gp->text, cur->pb.text); | ||
405 | + gp++; | ||
406 | + | ||
407 | + llist_del(&cur->list); | ||
408 | + free(cur); | ||
409 | + } | ||
410 | + } | ||
411 | + | ||
412 | + usock_cmd_enqueue(ucmd, gu); | ||
413 | + break; | ||
414 | default: | ||
415 | return -EINVAL; | ||
416 | } | ||
417 | @@ -1468,6 +1610,8 @@ | ||
418 | newuser->gsmd = g; | ||
419 | newuser->subscriptions = 0xffffffff; | ||
420 | INIT_LLIST_HEAD(&newuser->finished_ucmds); | ||
421 | + INIT_LLIST_HEAD(&newuser->pb_readrg_list); | ||
422 | + INIT_LLIST_HEAD(&newuser->pb_find_list); | ||
423 | |||
424 | llist_add(&newuser->list, &g->users); | ||
425 | gsmd_register_fd(&newuser->gfd); | ||
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; | ||
diff --git a/meta/recipes-connectivity/gsm/files/default b/meta/recipes-connectivity/gsm/files/default deleted file mode 100644 index 6ef4f6db57..0000000000 --- a/meta/recipes-connectivity/gsm/files/default +++ /dev/null | |||
@@ -1,59 +0,0 @@ | |||
1 | # gsmd This shell script configures for the gsmd init script. | ||
2 | |||
3 | . /etc/init.d/functions | ||
4 | |||
5 | case `machine_id` in | ||
6 | "gta01"|"gta02") | ||
7 | GSMD_OPTS="-s 115200 -F" | ||
8 | if [ -d '/sys/bus/platform/devices/gta01-pm-gsm.0' ] ; then | ||
9 | GSM_POW="/sys/bus/platform/devices/gta01-pm-gsm.0/power_on" | ||
10 | GSM_RES="/sys/bus/platform/devices/gta01-pm-gsm.0/reset" | ||
11 | else | ||
12 | GSM_POW="/sys/bus/platform/devices/neo1973-pm-gsm.0/power_on" | ||
13 | GSM_RES="/sys/bus/platform/devices/neo1973-pm-gsm.0/reset" | ||
14 | fi | ||
15 | GSM_DEV="/dev/ttySAC0" | ||
16 | GSM_DL="/sys/devices/platform/neo1973-pm-gsm.0/download" | ||
17 | ;; | ||
18 | "htc_apache"|"htc_blueangel"|"htc_universal") | ||
19 | GSMD_OPTS="-s 115200 -F" | ||
20 | GSM_DEV="/dev/ttyS0" | ||
21 | ;; | ||
22 | "htc_himalaya") | ||
23 | GSMD_OPTS="-s 115200 -F" | ||
24 | GSM_DEV="/dev/ttyS2" | ||
25 | ;; | ||
26 | "htc_magician") | ||
27 | GSMD_OPTS="-s 115200 -F" | ||
28 | GSM_DEV="/dev/ttyS1" | ||
29 | ;; | ||
30 | "palm_treo_650") | ||
31 | GSMD_OPTS="-s 460800 -F -w 1" | ||
32 | GSM_DEV="/dev/ttyS0" | ||
33 | ;; | ||
34 | "motorola_ezx_platform") | ||
35 | GSMD_OPTS="-s 115200 -F -v ti" | ||
36 | GSM_DEV="/dev/mux0" | ||
37 | ;; | ||
38 | "omap3430_ldp_board") | ||
39 | # Need a machine for the Zoom modem, but this will do | ||
40 | GSMD_OPTS="-s 460800 -F -v ti -m gta01" | ||
41 | GSM_DEV="/dev/ttyS0" | ||
42 | ;; | ||
43 | *) | ||
44 | # Unknown board | ||
45 | |||
46 | # If you must specify special options, uncomment and modify the next line | ||
47 | #GSMD_OPTS="-s 115200 -F" | ||
48 | |||
49 | # If your GSM device needs to be powered up, uncomment and modify the next line | ||
50 | #GSM_POW="/sys/bus/platform/devices/gta01-pm-gsm.0/power_on" | ||
51 | |||
52 | # If your GSM device then needs to be reset, uncomment and modify the next line | ||
53 | #GSM_RES="/sys/bus/platform/devices/gta01-pm-gsm.0/reset" | ||
54 | |||
55 | # This should be in a common /etc/default/serial, together with | ||
56 | # BT_DEV and IR_DEV for devices that have those on a serial port | ||
57 | #GSM_DEV="/dev/ttyS1" | ||
58 | ;; | ||
59 | esac | ||
diff --git a/meta/recipes-connectivity/gsm/files/fix_machine_init.patch b/meta/recipes-connectivity/gsm/files/fix_machine_init.patch deleted file mode 100644 index 1f135d5085..0000000000 --- a/meta/recipes-connectivity/gsm/files/fix_machine_init.patch +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | Rebase the patch to latest version. | ||
2 | |||
3 | By Dongxiao Xu <dongxiao.xu@intel.com> | ||
4 | |||
5 | Upstream-Status: Pending | ||
6 | |||
7 | diff -ruN gsm-orig/src/gsmd/gsmd.c gsm/src/gsmd/gsmd.c | ||
8 | --- gsm-orig/src/gsmd/gsmd.c 2010-11-25 10:14:22.000000000 +0800 | ||
9 | +++ gsm/src/gsmd/gsmd.c 2010-11-25 10:14:52.000000000 +0800 | ||
10 | @@ -196,14 +196,11 @@ | ||
11 | |||
12 | sms_cb_init(gsmd); | ||
13 | |||
14 | - if (gsmd->vendorpl && gsmd->vendorpl->initsettings){ | ||
15 | + if (gsmd->vendorpl && gsmd->vendorpl->initsettings) | ||
16 | rc |= gsmd->vendorpl->initsettings(gsmd); | ||
17 | - if (gsmd->machinepl && gsmd->machinepl->initsettings) | ||
18 | - rc |= gsmd->machinepl->initsettings(gsmd); | ||
19 | - return rc; | ||
20 | - } | ||
21 | - else | ||
22 | - return rc; | ||
23 | + if (gsmd->machinepl && gsmd->machinepl->initsettings) | ||
24 | + rc |= gsmd->machinepl->initsettings(gsmd); | ||
25 | + return rc; | ||
26 | } | ||
27 | |||
28 | static int firstcmd_response = 0; | ||
diff --git a/meta/recipes-connectivity/gsm/files/gsmd b/meta/recipes-connectivity/gsm/files/gsmd deleted file mode 100644 index dc10e63098..0000000000 --- a/meta/recipes-connectivity/gsm/files/gsmd +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | # | ||
3 | # gsmd This shell script starts and stops gsmd. | ||
4 | # | ||
5 | # chkconfig: 345 90 40 | ||
6 | # description: Gsmd manages access to a serial- or USB-connected GSM | ||
7 | # processname: gsmd | ||
8 | |||
9 | PATH=/bin:/usr/bin:/sbin:/usr/sbin | ||
10 | |||
11 | [ -f /etc/default/rcS ] && . /etc/default/rcS | ||
12 | [ -f /etc/default/gsmd ] && . /etc/default/gsmd | ||
13 | |||
14 | case "$1" in | ||
15 | start) | ||
16 | [ -n "$GSM_POW" ] && ( echo "0" >$GSM_POW; sleep 1 ) | ||
17 | [ -n "$GSM_POW" ] && ( echo "1" >$GSM_POW; sleep 1 ) | ||
18 | [ -n "$GSM_RES" ] && ( echo "1" >$GSM_RES; sleep 1 ) | ||
19 | [ -n "$GSM_RES" ] && ( echo "0" >$GSM_RES; sleep 2 ) | ||
20 | |||
21 | echo -n "Starting GSM daemon: " | ||
22 | start-stop-daemon -S -x /usr/sbin/gsmd -- gsmd -p $GSM_DEV $GSMD_OPTS -d -l syslog | ||
23 | |||
24 | if [ $? = 0 ]; then | ||
25 | echo "gsmd." | ||
26 | else | ||
27 | echo "(failed.)" | ||
28 | fi | ||
29 | ;; | ||
30 | stop) | ||
31 | [ -n "$GSM_POW" ] && echo "0" >$GSM_POW | ||
32 | |||
33 | echo -n "Stopping GSM daemon: " | ||
34 | start-stop-daemon -K -x /usr/sbin/gsmd | ||
35 | echo "gsmd." | ||
36 | ;; | ||
37 | restart|force-reload) | ||
38 | $0 stop | ||
39 | $0 start | ||
40 | ;; | ||
41 | *) | ||
42 | echo "Usage: /etc/init.d/gsmd {start|stop|restart|force-reload}" | ||
43 | exit 1 | ||
44 | ;; | ||
45 | esac | ||
46 | |||
47 | exit 0 | ||
diff --git a/meta/recipes-connectivity/gsm/files/install-ts-headers.patch b/meta/recipes-connectivity/gsm/files/install-ts-headers.patch deleted file mode 100644 index b77b6d9086..0000000000 --- a/meta/recipes-connectivity/gsm/files/install-ts-headers.patch +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | Upstream-Status: Inappropriate [not used] | ||
2 | |||
3 | Index: gsm/include/gsmd/Makefile.am | ||
4 | =================================================================== | ||
5 | --- gsm.orig/include/gsmd/Makefile.am 2007-10-29 21:05:57.000000000 +0100 | ||
6 | +++ gsm/include/gsmd/Makefile.am 2007-10-29 21:06:03.000000000 +0100 | ||
7 | @@ -1,4 +1,4 @@ | ||
8 | |||
9 | -pkginclude_HEADERS = event.h usock.h | ||
10 | +pkginclude_HEADERS = event.h ts0705.h ts0707.h usock.h | ||
11 | |||
12 | -noinst_HEADERS = atcmd.h gsmd.h select.h ts0705.h ts0707.h unsolicited.h usock.h vendorplugin.h | ||
13 | +noinst_HEADERS = atcmd.h gsmd.h select.h unsolicited.h usock.h vendorplugin.h | ||
diff --git a/meta/recipes-connectivity/gsm/files/lgsm_send_fix_return_value.patch b/meta/recipes-connectivity/gsm/files/lgsm_send_fix_return_value.patch deleted file mode 100644 index 9ff1c9d28e..0000000000 --- a/meta/recipes-connectivity/gsm/files/lgsm_send_fix_return_value.patch +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | Upstream-Status: Inappropriate [not used] | ||
2 | |||
3 | --- gsm/src/libgsmd/libgsmd.c.orig 2007-09-25 00:41:56.000000000 -0500 | ||
4 | +++ gsm/src/libgsmd/libgsmd.c 2007-09-25 00:43:44.000000000 -0500 | ||
5 | @@ -210,7 +210,7 @@ | ||
6 | pos += rc; | ||
7 | } | ||
8 | } | ||
9 | - return 0; | ||
10 | + return (sizeof(*gmh) + gmh->len); | ||
11 | } | ||
12 | |||
13 | struct gsmd_msg_hdr *lgsm_gmh_fill(int type, int subtype, int payload_len) | ||
diff --git a/meta/recipes-connectivity/gsm/gsmd.inc b/meta/recipes-connectivity/gsm/gsmd.inc deleted file mode 100644 index a96851874e..0000000000 --- a/meta/recipes-connectivity/gsm/gsmd.inc +++ /dev/null | |||
@@ -1,108 +0,0 @@ | |||
1 | SUMMARY = "GSM libraries and daemons" | ||
2 | DESCRIPTION = "GSM libraries and daemons implementing the 07.10 specification" | ||
3 | HOMEPAGE = "http://www.openmoko.org" | ||
4 | LICENSE = "GPLv2+ & LGPLv2.1+" | ||
5 | LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \ | ||
6 | file://COPYING.library;md5=2d5025d4aa3495befef8f17206a5b0a1 \ | ||
7 | file://src/util/event.c;beginline=1;endline=21;md5=7fc982f6308a591d1e3581e59c6768ce \ | ||
8 | file://src/libgsmd/libgsmd_sms.c;beginline=1;endline=19;md5=7bd4cdfab49cfba6a2afc020ee0b0806" | ||
9 | SECTION = "libs/gsm" | ||
10 | PROVIDES += "gsmd" | ||
11 | RPROVIDES_${PN} = "libgsmd0 libgsmd gsmd gsmd-devel" | ||
12 | PV = "0.1+svnr${SRCPV}" | ||
13 | PR = "r2" | ||
14 | |||
15 | SRC_URI = "svn://svn.openmoko.org/trunk/src/target;module=gsm;proto=http \ | ||
16 | file://fix_machine_init.patch \ | ||
17 | file://gsmd \ | ||
18 | file://default" | ||
19 | S = "${WORKDIR}/gsm" | ||
20 | |||
21 | inherit autotools pkgconfig update-rc.d | ||
22 | |||
23 | UPDATERCPN = "gsmd" | ||
24 | INITSCRIPT_NAME = "gsmd" | ||
25 | INITSCRIPT_PARAMS = "defaults 35" | ||
26 | |||
27 | do_install_append() { | ||
28 | install -d ${D}/${sysconfdir}/init.d | ||
29 | install -m 0755 ${WORKDIR}/gsmd ${D}/${sysconfdir}/init.d/ | ||
30 | install -d ${D}/${sysconfdir}/default | ||
31 | install ${WORKDIR}/default ${D}/${sysconfdir}/default/gsmd | ||
32 | } | ||
33 | |||
34 | PACKAGES =+ "\ | ||
35 | ${PN}-tools \ | ||
36 | ${BASEPN}-plugins \ | ||
37 | ${BASEPN}-plugin-machine-generic \ | ||
38 | ${BASEPN}-plugin-machine-telit \ | ||
39 | ${BASEPN}-plugin-machine-tihtc \ | ||
40 | ${BASEPN}-plugin-machine-gta01 \ | ||
41 | ${BASEPN}-plugin-vendor-bcm \ | ||
42 | ${BASEPN}-plugin-vendor-qc \ | ||
43 | ${BASEPN}-plugin-vendor-ti \ | ||
44 | ${BASEPN}-plugin-vendor-telit \ | ||
45 | ${BASEPN}-plugin-vendor-tihtc \ | ||
46 | " | ||
47 | |||
48 | ALLOW_EMPTY_${BASEPN}-plugin-machine-gta01 = "1" | ||
49 | |||
50 | RDEPENDS_${BASEPN}-plugins = "\ | ||
51 | ${BASEPN}-plugin-machine-generic \ | ||
52 | ${BASEPN}-plugin-machine-telit \ | ||
53 | ${BASEPN}-plugin-machine-tihtc \ | ||
54 | ${BASEPN}-plugin-machine-gta01 \ | ||
55 | ${BASEPN}-plugin-vendor-bcm \ | ||
56 | ${BASEPN}-plugin-vendor-qc \ | ||
57 | ${BASEPN}-plugin-vendor-ti \ | ||
58 | ${BASEPN}-plugin-vendor-telit \ | ||
59 | ${BASEPN}-plugin-vendor-tihtc \ | ||
60 | " | ||
61 | |||
62 | RDEPENDS_${PN} += "update-rc.d initscripts" | ||
63 | RRECOMMENDS_${PN} += "${BASEPN}-plugins" | ||
64 | |||
65 | FILES_${PN}-dbg += "${libdir}/gsmd/.debug/*" | ||
66 | FILES_${PN}-dev += "${libdir}/gsmd/*.so ${libdir}/gsmd/*.la" | ||
67 | FILES_${PN}-staticdev += "${libdir}/gsmd/*.a" | ||
68 | FILES_${PN}-tools = "${bindir}/*" | ||
69 | FILES_${BASEPN}-plugins = "" | ||
70 | FILES_${BASEPN}-plugin-machine-generic = "${libdir}/gsmd/libgsmd-machine_generic.so.*" | ||
71 | FILES_${BASEPN}-plugin-machine-tihtc = "${libdir}/gsmd/libgsmd-machine_tihtc.so.*" | ||
72 | FILES_${BASEPN}-plugin-machine-telit = "${libdir}/gsmd/libgsmd-machine_telit.so.*" | ||
73 | FILES_${BASEPN}-plugin-machine-gta01 = "${libdir}/gsmd/libgsmd-machine_gta01.so.*" | ||
74 | FILES_${BASEPN}-plugin-vendor-qc = "${libdir}/gsmd/libgsmd-vendor_qc.so.*" | ||
75 | FILES_${BASEPN}-plugin-vendor-bcm = "${libdir}/gsmd/libgsmd-vendor_bcm.so.*" | ||
76 | FILES_${BASEPN}-plugin-vendor-ti = "${libdir}/gsmd/libgsmd-vendor_ti.so.*" | ||
77 | FILES_${BASEPN}-plugin-vendor-telit = "${libdir}/gsmd/libgsmd-vendor_telit.so.*" | ||
78 | FILES_${BASEPN}-plugin-vendor-tihtc = "${libdir}/gsmd/libgsmd-vendor_tihtc.so.*" | ||
79 | |||
80 | PACKAGES_DYNAMIC = "lib${BASEPN}* ${BASEPN}" | ||
81 | |||
82 | ALLOW_EMPTY_${BASEPN}-plugins = "1" | ||
83 | |||
84 | RCONFLICTS_lib${BASEPN} = "lib${CONFLICTNAME}" | ||
85 | RCONFLICTS_${BASEPN} = "${CONFLICTNAME}" | ||
86 | RCONFLICTS_${BASEPN}-plugins = "${CONFLICTNAME}-plugins" | ||
87 | RCONFLICTS_${BASEPN}-plugin-machine-generic = "${CONFLICTNAME}-plugin-machine-generic" | ||
88 | RCONFLICTS_${BASEPN}-plugin-machine-telit = "${CONFLICTNAME}-plugin-machine-telit" | ||
89 | RCONFLICTS_${BASEPN}-plugin-machine-tihtc = "${CONFLICTNAME}-plugin-machine-tihtc" | ||
90 | RCONFLICTS_${BASEPN}-plugin-machine-gta01 = "${CONFLICTNAME}-plugin-machine-gta01" | ||
91 | RCONFLICTS_${BASEPN}-plugin-vendor-qc = "${CONFLICTNAME}-plugin-vendor-qc" | ||
92 | RCONFLICTS_${BASEPN}-plugin-vendor-bcm = "${CONFLICTNAME}-plugin-vendor-bcm" | ||
93 | RCONFLICTS_${BASEPN}-plugin-vendor-ti = "${CONFLICTNAME}-plugin-vendor-ti" | ||
94 | RCONFLICTS_${BASEPN}-plugin-vendor-telit = "${CONFLICTNAME}-plugin-vendor-telit" | ||
95 | RCONFLICTS_${BASEPN}-plugin-vendor-tihtc = "${CONFLICTNAME}-plugin-vendor-tihtc" | ||
96 | |||
97 | RPROVIDES_lib${BASEPN} += "lib${CONFLICTNAME}" | ||
98 | RPROVIDES_${BASEPN} = "${CONFLICTNAME}" | ||
99 | RPROVIDES_${BASEPN}-plugins = "${CONFLICTNAME}-plugins" | ||
100 | RPROVIDES_${BASEPN}-plugin-machine-generic = "${CONFLICTNAME}-plugin-machine-generic" | ||
101 | RPROVIDES_${BASEPN}-plugin-machine-telit = "${CONFLICTNAME}-plugin-machine-telit" | ||
102 | RPROVIDES_${BASEPN}-plugin-machine-tihtc = "${CONFLICTNAME}-plugin-machine-tihtc" | ||
103 | RPROVIDES_${BASEPN}-plugin-machine-gta01 = "${CONFLICTNAME}-plugin-machine-gta01" | ||
104 | RPROVIDES_${BASEPN}-plugin-vendor-qc = "${CONFLICTNAME}-plugin-vendor-qc" | ||
105 | RPROVIDES_${BASEPN}-plugin-vendor-bcm = "${CONFLICTNAME}-plugin-vendor-bcm" | ||
106 | RPROVIDES_${BASEPN}-plugin-vendor-ti = "${CONFLICTNAME}-plugin-vendor-ti" | ||
107 | RPROVIDES_${BASEPN}-plugin-vendor-telit = "${CONFLICTNAME}-plugin-vendor-telit" | ||
108 | RPROVIDES_${BASEPN}-plugin-vendor-tihtc = "${CONFLICTNAME}-plugin-vendor-tihtc" | ||
diff --git a/meta/recipes-connectivity/gsm/libgsmd_svn.bb b/meta/recipes-connectivity/gsm/libgsmd_svn.bb deleted file mode 100644 index ea8eaaea02..0000000000 --- a/meta/recipes-connectivity/gsm/libgsmd_svn.bb +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | BASEPN = "gsmd" | ||
2 | CONFLICTNAME = "gsmd-devel" | ||
3 | |||
4 | SRCREV = "5394" | ||
5 | require gsmd.inc | ||
6 | |||
diff --git a/meta/recipes-core/tasks/task-base.bb b/meta/recipes-core/tasks/task-base.bb index ddae7aebee..b9bc3aae0f 100644 --- a/meta/recipes-core/tasks/task-base.bb +++ b/meta/recipes-core/tasks/task-base.bb | |||
@@ -2,7 +2,7 @@ DESCRIPTION = "Merge machine and distro options to create a basic machine task/p | |||
2 | LICENSE = "MIT" | 2 | LICENSE = "MIT" |
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \ | 3 | LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \ |
4 | file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" | 4 | file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" |
5 | PR = "r73" | 5 | PR = "r74" |
6 | 6 | ||
7 | inherit task | 7 | inherit task |
8 | 8 | ||
@@ -357,5 +357,4 @@ RDEPENDS_task-base-serial = "\ | |||
357 | lrzsz " | 357 | lrzsz " |
358 | 358 | ||
359 | RDEPENDS_task-base-phone = "\ | 359 | RDEPENDS_task-base-phone = "\ |
360 | gsmd \ | 360 | ofono" |
361 | libgsmd-tools" | ||