summaryrefslogtreecommitdiff
path: root/src/libgsmd/libgsmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libgsmd/libgsmd.c')
-rw-r--r--src/libgsmd/libgsmd.c12
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;
}
personal git repositories of Harald Welte. Your mileage may vary