summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortony_guan <tony_guan@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-02-28 07:04:28 +0000
committertony_guan <tony_guan@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-02-28 07:04:28 +0000
commitad71bbb9d55312434d62be75498092436edf1f1d (patch)
tree3c0524845468353a81f09ef4366d2b844a4c0c2f /src
parent78fd16891ec47e2ac7a68b801e1d80cff05afcac (diff)
resolved bug 108, please varify it. thks.
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@1156 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src')
-rw-r--r--src/libgsmd/Makefile.am2
-rw-r--r--src/util/libgsmd-tool.c3
-rw-r--r--src/util/shell.c63
3 files changed, 66 insertions, 2 deletions
diff --git a/src/libgsmd/Makefile.am b/src/libgsmd/Makefile.am
index a1ee710..e9cd1a0 100644
--- a/src/libgsmd/Makefile.am
+++ b/src/libgsmd/Makefile.am
@@ -5,6 +5,6 @@ AM_CFLAGS = -std=gnu99
lib_LTLIBRARIES = libgsmd.la
libgsmd_la_LDFLAGS = -Wc,-nostartfiles -version-info $(LIBVERSION)
-libgsmd_la_SOURCES = libgsmd.c libgsmd_input.c libgsmd_voicecall.c libgsmd_passthrough.c libgsmd_event.c libgsmd_phone.c libgsmd_network.c
+libgsmd_la_SOURCES = libgsmd.c libgsmd_input.c libgsmd_voicecall.c libgsmd_passthrough.c libgsmd_event.c libgsmd_phone.c libgsmd_network.c libgsmd_device.c
noinst_HEADERS = lgsm_internals.h
diff --git a/src/util/libgsmd-tool.c b/src/util/libgsmd-tool.c
index c48bf8e..34bb53c 100644
--- a/src/util/libgsmd-tool.c
+++ b/src/util/libgsmd-tool.c
@@ -95,11 +95,14 @@ int main(int argc, char **argv)
printf("libgsm-tool - (C) 2006 by Harald Welte\n"
"This program is Free Software and has ABSOLUTELY NO WARRANTY\n\n");
+
while (1) {
int c, option_index = 0;
c = getopt_long(argc, argv, "vVhm:p:", opts, &option_index);
if (c == -1)
+ {
break;
+ }
switch (c) {
case 'v':
diff --git a/src/util/shell.c b/src/util/shell.c
index 43a0bfe..c7ccc91 100644
--- a/src/util/shell.c
+++ b/src/util/shell.c
@@ -48,6 +48,7 @@ static int shell_help(void)
"\to\tPower Off\n"
"\tR\tRegister Netowrk\n"
"\tT\tSend DTMF Tone\n"
+ "\tI\tDevice Infor\n"
"\tq\tQuit\n"
);
}
@@ -58,6 +59,7 @@ int shell_main(struct lgsm_handle *lgsmh)
char buf[STDIN_BUF_SIZE+1];
char rbuf[STDIN_BUF_SIZE+1];
int rlen = sizeof(rbuf);
+
fd_set readset;
lgsm_register_handler(lgsmh, GSMD_MSG_PASSTHROUGH, &pt_msghandler);
@@ -136,9 +138,68 @@ int shell_main(struct lgsm_handle *lgsmh)
continue;
printf("DTMF: %c\n", buf[1]);
lgsm_voice_dtmf(lgsmh, buf[1]);
- } else {
+ } else if (buf[0] == 'I') {
+ //FIXME: sometimes, lgsm_get_info returns directly, and sometimes the result just gets lost.
+ static int infoindex=LGSM_INFO_TYPE_NONE;//information
+ infoindex=infoindex%LGSM_INFO_TYPE_IMSI+1;
+ rlen = sizeof(rbuf);
+ switch(infoindex){
+ case LGSM_INFO_TYPE_MANUF:
+
+ if(lgsm_get_info(lgsmh,LGSM_INFO_TYPE_MANUF,rbuf,&rlen))
+ {
+ printf("manufacturer:%s\n",rbuf);
+ }
+ else
+ printf("manufacturer information error!\n");
+ break;
+
+ case LGSM_INFO_TYPE_MODEL:
+ if(lgsm_get_info(lgsmh,LGSM_INFO_TYPE_MODEL,rbuf,&rlen))
+ {
+ printf("model:%s\n",rbuf);
+ }
+ else
+ printf("model error!\n");
+ break;
+
+ case LGSM_INFO_TYPE_REVISION:
+ if(lgsm_get_info(lgsmh,LGSM_INFO_TYPE_REVISION,rbuf,&rlen))
+ {
+ printf("revision:%s\n",rbuf);
+ }
+ else
+ printf("revision information error!\n");
+ break;
+
+ case LGSM_INFO_TYPE_IMSI:
+ if(lgsm_get_info(lgsmh,LGSM_INFO_TYPE_IMSI,rbuf,&rlen))
+ {
+ printf("imei:%s\n",rbuf);
+ }
+ else
+ printf("imei information error!\n");
+ break;
+ case LGSM_INFO_TYPE_SERIAL:
+ if(lgsm_get_info(lgsmh,LGSM_INFO_TYPE_SERIAL,rbuf,&rlen))
+ {
+ printf("sn:%s\n",rbuf);
+ }
+ else
+ printf("sn information error!\n");
+ break;
+ default:
+ printf("something is wrong!\n");
+ }
+
+
+
+ }
+ else {
printf("Unknown command `%s'\n", buf);
}
}
}
}
+
+
personal git repositories of Harald Welte. Your mileage may vary