diff options
author | laforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3> | 2007-01-12 23:57:33 +0000 |
---|---|---|
committer | laforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3> | 2007-01-12 23:57:33 +0000 |
commit | a04e6effed0b81ec7495df2a1448484645b20cc5 (patch) | |
tree | 6292af769d08022e68cd183358ccc78c6a27238c /src/util/shell.c | |
parent | 496d202f517dbecc1be4e1afc6782c0e3dc48373 (diff) |
- use talloc (of samba project) to debug memory allocations and simplify code
- introduce new ucmd_alloc() function
- add DTMF support to gsmd, libgsmd and gsmd-util
- fix crash of libgsmd when events don't have handlers registered
- implement call progress for TI modem
- split modem init string in separate commands to fit our parser
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@544 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src/util/shell.c')
-rw-r--r-- | src/util/shell.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/util/shell.c b/src/util/shell.c index b90cd19..b8f0877 100644 --- a/src/util/shell.c +++ b/src/util/shell.c @@ -25,6 +25,7 @@ static int shell_help(void) "\tO\tPower On\n" "\to\tPower Off\n" "\tR\tRegister Netowrk\n" + "\tq\tQuit\n" ); } @@ -43,6 +44,8 @@ int shell_main(struct lgsm_handle *lgsmh) FD_ZERO(&readset); + printf("# "); + while (1) { fd_set readset; int gsm_fd = lgsm_fd(lgsmh); @@ -63,8 +66,7 @@ int shell_main(struct lgsm_handle *lgsmh) rc = lgsm_handle_packet(lgsmh, buf, rc); } if (FD_ISSET(0, &readset)) { - /* we've received something on stdin. send it as passthrough - * to gsmd */ + /* we've received something on stdin. */ printf("# "); rc = fscanf(stdin, "%s", buf); if (rc == EOF) { @@ -84,6 +86,8 @@ int shell_main(struct lgsm_handle *lgsmh) lgsm_voice_hangup(lgsmh); } else if (buf[0] == 'D') { struct lgsm_addr addr; + if (strlen(buf) < 2) + continue; printf("Dial %s\n", buf+1); addr.type = 129; strncpy(addr.addr, buf+1, sizeof(addr.addr)-1); @@ -93,11 +97,22 @@ int shell_main(struct lgsm_handle *lgsmh) printf("Answer\n"); lgsm_voice_in_accept(lgsmh); } else if (!strcmp(buf, "O")) { + printf("Power-On\n"); lgsm_phone_power(lgsmh, 1); } else if (!strcmp(buf, "o")) { + printf("Power-Off\n"); lgsm_phone_power(lgsmh, 0); } else if (!strcmp(buf, "R")) { + printf("Register\n"); + lgsm_phone_power(lgsmh, 0); lgsm_netreg_register(lgsmh, 0); + } else if (!strcmp(buf, "q")) { + exit(0); + } else if (buf[0] == 'T') { + if (strlen(buf) < 2) + continue; + printf("DTMF: %c\n", buf[1]); + lgsm_voice_dtmf(lgsmh, buf[1]); } else { printf("Unknown command `%s'\n", buf); } |