diff options
author | laforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3> | 2006-10-22 23:17:15 +0000 |
---|---|---|
committer | laforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3> | 2006-10-22 23:17:15 +0000 |
commit | 7fe163099476937a14dd7a0714de542f7f94f665 (patch) | |
tree | 7e1c703f7f30efd941591d35e51cc57616f60cec /src/libgsmd/libgsmd.c | |
parent | 1cfa84da8e1defe1a9d138c82afa80374eace8ab (diff) |
gsmd passthrough mode now working
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@109 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src/libgsmd/libgsmd.c')
-rw-r--r-- | src/libgsmd/libgsmd.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libgsmd/libgsmd.c b/src/libgsmd/libgsmd.c index 104a8b3..b916898 100644 --- a/src/libgsmd/libgsmd.c +++ b/src/libgsmd/libgsmd.c @@ -68,6 +68,8 @@ static int lgsm_open_backend(struct lgsm_handle *lh, const char *device) int lgsm_handle_packet(struct lgsm_handle *lh, char *buf, int len) { struct gsmd_msg_hdr *gmh = (struct gsmd_msg_hdr *)buf; + lgsm_msg_handler *handler; + if (len < sizeof(*gmh)) return -EINVAL; @@ -77,7 +79,12 @@ int lgsm_handle_packet(struct lgsm_handle *lh, char *buf, int len) if (gmh->msg_type >= __NUM_GSMD_MSGS) return -EINVAL; - return lh->handler[gmh->msg_type](lh, gmh); + handler = lh->handler[gmh->msg_type]; + + if (handler) + handler(lh, gmh); + else + fprintf(stderr, "unable to handle packet type=%u\n", gmh->msg_type); } /* blocking read and processing of packets until packet matching 'id' is found */ @@ -124,9 +131,6 @@ struct lgsm_handle *lgsm_init(const char *device) return NULL; } - /* send some initial commands, such as ATV1 (verbose response) - * and +CRC=1 (which we currently require!) */ - return lh; } |