diff options
author | erin_yueh <erin_yueh@99fdad57-331a-0410-800a-d7fa5415bdb3> | 2008-02-21 05:16:15 +0000 |
---|---|---|
committer | erin_yueh <erin_yueh@99fdad57-331a-0410-800a-d7fa5415bdb3> | 2008-02-21 05:16:15 +0000 |
commit | 29a2f6a3b46afb00052a24b05232630acad3af70 (patch) | |
tree | 181b89e02491f52e5d375fa277521cd76382e2f3 /src/util | |
parent | 20adbe01bb4d7490436d0294de37b6c12624143b (diff) |
gsmd: get battery status (Sudharshan S)
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@4091 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/shell.c | 10 |
1 files changed, 10 insertions, 0 deletions
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("<BCS>: %d <BCL>: %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); } |