FreeCalypso > hg > freecalypso-sw
changeset 264:0c938d8b5ba3
fc-tmsh: set-pcm-string and set-rfcap implemented
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Wed, 05 Feb 2014 10:19:21 +0000 |
parents | b5b54feb111a |
children | 4c416868524a |
files | rvinterf/tmsh/ffs2wr.c rvinterf/tmsh/usercmd.c |
diffstat | 2 files changed, 59 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/rvinterf/tmsh/ffs2wr.c Wed Feb 05 07:32:42 2014 +0000 +++ b/rvinterf/tmsh/ffs2wr.c Wed Feb 05 10:19:21 2014 +0000 @@ -16,11 +16,31 @@ #include "tmffs2.h" void +send_file_write(filename, data, size) + char *filename; + u_char *data; +{ + u_char cmdpkt[MAX_PKT_TO_TARGET], *dp; + + dp = cmdpkt + 1; + *dp++ = ETM_FFS2; + *dp++ = TMFFS_FILE_WRITE; + *dp++ = strlen(filename) + 1; + strcpy(dp, filename); + dp += strlen(filename) + 1; + *dp++ = size; /* data size in bytes */ + bcopy(data, dp, size); + dp += size; + *dp++ = FFS_O_CREATE | FFS_O_TRUNC; + send_etm_cmd(cmdpkt, dp - cmdpkt - 1); +} + +void cmd_set_imeisv(argc, argv) char **argv; { char *filename, *cp, digits[16]; - u_char bytes[8], cmdpkt[MAX_PKT_TO_TARGET], *dp; + u_char bytes[8]; int pcm_order, i; if (!strcmp(argv[1], "pcm")) { @@ -54,15 +74,38 @@ printf("Writing \"%02X %02X %02X %02X %02X %02X %02X %02X\" into %s\n", bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7], filename); - dp = cmdpkt + 1; - *dp++ = ETM_FFS2; - *dp++ = TMFFS_FILE_WRITE; - *dp++ = strlen(filename) + 1; - strcpy(dp, filename); - dp += strlen(filename) + 1; - *dp++ = 8; /* data size in bytes */ - bcopy(bytes, dp, 8); - dp += 8; - *dp++ = FFS_O_CREATE | FFS_O_TRUNC; - send_etm_cmd(cmdpkt, dp - cmdpkt - 1); + send_file_write(filename, bytes, 8); } + +void +cmd_set_pcm_string(argc, argv) + char **argv; +{ + char filename[16]; + + if (strcmp(argv[1], "CGMI") && strcmp(argv[1], "CGMM") && + strcmp(argv[1], "CGMR") && strcmp(argv[1], "CGSN")) { + printf("error: \"%s\" is not a recognized PCM string file name\n", + argv[1]); + return; + } + sprintf(filename, "/pcm/%s", argv[1]); + if (strlen(argv[2]) > 20) { + printf("error: %s string may not exceed 20 characters\n", + filename); + return; + } + send_file_write(filename, argv[2], strlen(argv[2])); +} + +void +cmd_set_rfcap(argc, argv) + char **argv; +{ + u_char bytes[16]; + int i; + + for (i = 0; i < 16; i++) + bytes[i] = strtoul(argv[i+1], 0, 16); + send_file_write("/gsm/com/rfcap", bytes, 16); +}
--- a/rvinterf/tmsh/usercmd.c Wed Feb 05 07:32:42 2014 +0000 +++ b/rvinterf/tmsh/usercmd.c Wed Feb 05 10:19:21 2014 +0000 @@ -22,6 +22,8 @@ extern void cmd_r16(); extern void cmd_r32(); extern void cmd_set_imeisv(); +extern void cmd_set_pcm_string(); +extern void cmd_set_rfcap(); extern void cmd_tgtreset(); extern void cmd_version(); extern void cmd_w8(); @@ -54,6 +56,8 @@ {"r16", 1, 2, cmd_r16}, {"r32", 1, 2, cmd_r32}, {"set-imeisv", 2, 2, cmd_set_imeisv}, + {"set-pcm-string", 2, 2, cmd_set_pcm_string}, + {"set-rfcap", 16, 16, cmd_set_rfcap}, {"tgtreset", 0, 0, cmd_tgtreset}, {"version", 1, 1, cmd_version}, {"w8", 2, 246, cmd_w8},