From ed45d021e84b497e75ff4342ad369c615cc174a3 Mon Sep 17 00:00:00 2001 From: tick Date: Tue, 27 Nov 2007 08:24:57 +0000 Subject: gsmd: Refactorying get_imsi from PHONEBOOK to PHONE (tick) git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@3519 99fdad57-331a-0410-800a-d7fa5415bdb3 --- src/util/shell.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/util') diff --git a/src/util/shell.c b/src/util/shell.c index 40dddaf..62e7b0f 100644 --- a/src/util/shell.c +++ b/src/util/shell.c @@ -131,11 +131,6 @@ static int pb_msghandler(struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh) nFIND = 0; break; - case GSMD_PHONEBOOK_GET_IMSI: - payload = (char *)gmh + sizeof(*gmh); - printf("imsi <%s>\n", payload); - pending_responses --; - break; default: return -EINVAL; } @@ -349,6 +344,20 @@ static int net_msghandler(struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh) } } +static int phone_msghandler(struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh) { + char *payload; + switch (gmh->msg_subtype) { + case GSMD_PHONE_GET_IMSI: + payload = (char *)gmh + sizeof(*gmh); + printf("imsi <%s>\n", payload); + pending_responses --; + break; + default: + return -EINVAL; + } + return 0; +} + static int shell_help(void) { printf( "\tA\tAnswer incoming call\n" @@ -405,6 +414,7 @@ int shell_main(struct lgsm_handle *lgsmh, int sync) lgsm_register_handler(lgsmh, GSMD_MSG_PHONEBOOK, &pb_msghandler); lgsm_register_handler(lgsmh, GSMD_MSG_SMS, &sms_msghandler); lgsm_register_handler(lgsmh, GSMD_MSG_NETWORK, &net_msghandler); + lgsm_register_handler(lgsmh, GSMD_MSG_PHONE, &phone_msghandler); fcntl(0, F_SETFD, O_NONBLOCK); fcntl(gsm_fd, F_SETFD, O_NONBLOCK); -- cgit v1.2.3