From f07e7027fe91ac71a8ab760f863c3a05a1d1499d Mon Sep 17 00:00:00 2001 From: tick Date: Sat, 1 Dec 2007 01:54:59 +0000 Subject: gsmd: Modem power-up and -down result events.(Andrzej Zaborowski) git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@3544 99fdad57-331a-0410-800a-d7fa5415bdb3 --- src/util/shell.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'src/util') diff --git a/src/util/shell.c b/src/util/shell.c index 62e7b0f..031ed34 100644 --- a/src/util/shell.c +++ b/src/util/shell.c @@ -344,18 +344,33 @@ 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) { +static int phone_msghandler(struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh) +{ + char *payload; + int *intresult = (void *)gmh + sizeof(*gmh); + + 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; + case GSMD_PHONE_POWERUP: + if (*intresult) + printf("Modem power-up failed: %i\n", *intresult); + else + printf("Modem powered-up okay\n"); + break; + case GSMD_PHONE_POWERDOWN: + if (*intresult) + printf("Modem power-down failed: %i\n", *intresult); + else + printf("Modem down\n"); + break; + default: + return -EINVAL; + } + pending_responses --; + return 0; } static int shell_help(void) @@ -688,9 +703,11 @@ int shell_main(struct lgsm_handle *lgsmh, int sync) } else if (!strncmp(buf, "M", 1)) { printf("Modem Power On\n"); lgsm_modem_power(lgsmh, 1); + pending_responses ++; } else if (!strncmp(buf, "m", 1)) { printf("Modem Power Off\n"); lgsm_modem_power(lgsmh, 0); + pending_responses ++; } else { printf("Unknown command `%s'\n", buf); } -- cgit v1.2.3