From 29a2f6a3b46afb00052a24b05232630acad3af70 Mon Sep 17 00:00:00 2001 From: erin_yueh Date: Thu, 21 Feb 2008 05:16:15 +0000 Subject: gsmd: get battery status (Sudharshan S) git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@4091 99fdad57-331a-0410-800a-d7fa5415bdb3 --- src/util/shell.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/util') diff --git a/src/util/shell.c b/src/util/shell.c index 1bfff3e..af6f795 100644 --- a/src/util/shell.c +++ b/src/util/shell.c @@ -394,6 +394,8 @@ static int phone_msghandler(struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh) { char *payload = (char *)gmh + sizeof(*gmh); int *intresult = (void *)gmh + sizeof(*gmh); + const struct gsmd_battery_charge *bc = (struct gsmd_battery_charge *) + ((void *) gmh + sizeof(*gmh)); switch (gmh->msg_subtype) { case GSMD_PHONE_GET_IMSI: @@ -423,6 +425,9 @@ static int phone_msghandler(struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh) else printf("Modem down\n"); break; + case GSMD_PHONE_GET_BATTERY: + printf(": %d : %d \n", bc->bcs, bc->bcl); + break; default: return -EINVAL; } @@ -568,6 +573,7 @@ static void shell_help(void) "\tsn\tGet serial number\n" "\tcs\tGet Call status\n" "\tgp\tGet PIN status\n" + "\tcbc\tGet Battery status\n" "\tRh\tRelease all held calls (+CHLD=0)\n" "\tUDUB\tUser Determined User Busy (+CHLD=0)\n" "\tRa\tRelease all active calls (+CHLD=1)\n" @@ -987,6 +993,10 @@ int shell_main(struct lgsm_handle *lgsmh, int sync) ptr = strchr(buf, '='); lgsm_voice_fwd_erase(lgsmh, atoi(ptr+1)); pending_responses ++; + }else if ( !strncmp(buf, "cbc", 3)) { + printf("Battery Connection status and Battery Charge Level\n"); + lgsm_get_battery(lgsmh); + pending_responses++; }else { printf("Unknown command `%s'\n", buf); } -- cgit v1.2.3