X-Git-Url: http://git.jankratochvil.net/?p=gnokii.git;a=blobdiff_plain;f=gnokii%2Fgnokii.c;h=25f66ec4f4b1dc98701c3cbb1774bbd14dd47431;hp=9daceb9b3c7f2c9c044f2cb5f2222ec237004b22;hb=82bcbc2300f764bcb3551b152a0a961f4fef5e66;hpb=833e1c7c90e13ceaba3dde8e7a36fcc8dfb1db3c diff --git a/gnokii/gnokii.c b/gnokii/gnokii.c index 9daceb9..25f66ec 100644 --- a/gnokii/gnokii.c +++ b/gnokii/gnokii.c @@ -11,6 +11,8 @@ */ +#include "config.h" + #include #include #include @@ -18,6 +20,13 @@ #include #include #include +#include +#include + +#ifdef UCLINUX +/* or "getopt.h" would include insufficient getopt.h from uClinux */ +#include "../getopt/getopt.h" +#endif /* UCLINUX */ #ifndef VC6 #if defined(__svr4__) || defined(__FreeBSD__) @@ -53,32 +62,49 @@ #include "gsm-common.h" #include "gsm-api.h" #include "gsm-networks.h" +#ifndef UCLINUX #include "gsm-ringtones.h" #include "gsm-bitmaps.h" #include "gsm-wap.h" #include "gsm-sms.h" #include "gsm-datetime.h" +#endif /* UCLINUX */ #include "gsm-phonebook.h" +#ifndef UCLINUX #include "gsm-calendar.h" +#endif /* UCLINUX */ #include "gsm-coding.h" +#ifndef UCLINUX #include "newmodules/n6110.h" +#endif #include "files/cfgreader.h" +#ifndef UCLINUX #include "files/gsm-filetypes.h" +#endif /* UCLINUX */ #include "gnokii.h" +#ifdef UCLINUX +#include "data/virtmodem.h" +#endif /* UCLINUX */ #ifdef USE_NLS #include #endif -char *model; /* Model from .gnokiirc file. */ -char *Port; /* Port from .gnokiirc file */ -char *Initlength; /* Init length from .gnokiirc file */ -char *Connection; /* Connection type from .gnokiirc file */ +static char *model; /* Model from .gnokiirc file. */ +static char *Port; /* Port from .gnokiirc file */ +static char *Initlength; /* Init length from .gnokiirc file */ +static char *Connection; /* Connection type from .gnokiirc file */ +#ifndef UCLINUX char *SynchronizeTime; /* If we set date and time from computer to phone (from .gnokiirc file) */ -char *BinDir; /* Binaries directory from .gnokiirc file - not used here yet */ +#endif /* UCLINUX */ +static char *BinDir; /* Binaries directory from .gnokiirc file - not used here yet */ -GSM_SMSMessage SMS[4]; +#ifndef UCLINUX +static GSM_SMSMessage SMS[4]; +#endif /* UCLINUX */ +#ifndef UCLINUX + char *GetProfileCallAlertString(int code) { switch (code) { @@ -214,7 +240,7 @@ char *GetProfileCallerGroups(int code) return BufferProfileGroups; } -char *print_error(GSM_Error e) +static char *print_error(GSM_Error e) { // case GE_DEVICEOPENFAILED: return "Couldn't open specified serial device."; @@ -260,11 +286,11 @@ char *print_error(GSM_Error e) case GE_INVALIDBOOKMARKLOCATION: return "Invalid or empty WAP bookmark location"; case GE_INSIDESETTINGSMENU: return "Inside WAP Settings menu. Please leave it and try again"; case GE_INVALIDSETTINGSLOCATION: return "Invalid or empty WAP settings location"; + case GE_EMPTYSMSC: return "Empty SMSC number. Use --smsc"; default: return "Unknown error."; } } - GSM_Error GSM_ReadRingtoneFileOnConsole(char *FileName, GSM_Ringtone *ringtone) { GSM_Error error; @@ -453,8 +479,8 @@ int GSM_SendMultiPartSMSOnConsole(GSM_MultiSMSMessage *MultiSMS, int argnum, int int w,i; struct option options[] = { - { "smscno", required_argument, NULL, '1'}, - { "smsc", required_argument, NULL, '2'}, + { "smscno", required_argument, NULL, '2'}, + { "smsc", required_argument, NULL, '1'}, { "name", required_argument, NULL, '3'}, { "unicode", no_argument, NULL, '4'}, { "profilestyle", no_argument, NULL, '5'}, @@ -527,7 +553,7 @@ int GSM_SendMultiPartSMSOnConsole(GSM_MultiSMSMessage *MultiSMS, int argnum, int if (error == GE_SMSSENDOK) { fprintf(stdout, _("SMS %i/%i sent OK !\n"),w+1,MultiSMS->number); } else { - fprintf(stdout, _("SMS %i/%i, sending failed (error=%d)\n"),w+1,MultiSMS->number, error); + fprintf(stdout, _("SMS %i/%i, sending failed (%d, %s)\n"),w+1,MultiSMS->number, error,print_error(error)); } } @@ -537,7 +563,7 @@ int GSM_SendMultiPartSMSOnConsole(GSM_MultiSMSMessage *MultiSMS, int argnum, int return 0; } -int GSM_SaveMultiPartSMSOnConsole(GSM_MultiSMSMessage *MultiSMS, int argnum, int argc, char *argv[], +static int GSM_SaveMultiPartSMSOnConsole(GSM_MultiSMSMessage *MultiSMS, int argnum, int argc, char *argv[], bool inter, bool unicode, bool profile, bool scale) { int w,i; @@ -545,8 +571,8 @@ int GSM_SaveMultiPartSMSOnConsole(GSM_MultiSMSMessage *MultiSMS, int argnum, int GSM_SMSMessage SMSold; struct option options[] = { - { "smscno", required_argument, NULL, '1'}, - { "smsc", required_argument, NULL, '2'}, + { "smscno", required_argument, NULL, '2'}, + { "smsc", required_argument, NULL, '1'}, { "name", required_argument, NULL, '3'}, { "unicode", no_argument, NULL, '4'}, { "profilestyle", no_argument, NULL, '5'}, @@ -655,7 +681,7 @@ int GSM_SaveMultiPartSMSOnConsole(GSM_MultiSMSMessage *MultiSMS, int argnum, int if (error == GE_NONE) fprintf(stdout, _("SMS %i/%i saved at location %i !\n"),w+1,MultiSMS->number,MultiSMS->SMS[w].MessageNumber); else - fprintf(stdout, _("SMS %i/%i saving failed (error=%d, location=%i)\n"), w+1, MultiSMS->number, error,MultiSMS->SMS[w].Location); + fprintf(stdout, _("SMS %i/%i saving failed (%d, %s, location=%i)\n"), w+1, MultiSMS->number,error,print_error(error),MultiSMS->SMS[w].Location); } GSM->Terminate(); @@ -682,9 +708,11 @@ void GSM_PlayRingtoneOnConsole(GSM_Ringtone *ringtone) GSM->PlayTone(255*255,0); } +#endif /* UCLINUX */ + /* This function shows the copyright and some informations usefull for debugging. */ -int version(void) +static int version(void) { fprintf(stdout, _("GNOKII Version %s\n" @@ -698,12 +726,32 @@ int version(void) /* The function usage is only informative - it prints this program's usage and command-line options. */ -int usage(void) +static int usage(void) { - fprintf(stdout, _(" usage: gnokii [--help|--monitor [-noloop|-nl]|--version]\n" + fprintf(stdout, _(" usage: gnokii [--help] [--version]\n" + )); +#ifndef UCLINUX +" gnokii --monitor [-noloop|-nl]\n" + )); +#endif /* UCLINUX */ + +#ifndef UCLINUX + fprintf(stdout, _( " gnokii --getmemory memory_type [start [end]] [-short|-v30|-v21|-v]\n" + )); +#else /* UCLINUX */ + fprintf(stdout, _( +" gnokii --getmemory memory_type [start [end]] [-short]\n" + )); +#endif /* UCLINUX */ + + fprintf(stdout, _( " gnokii --writephonebook [-i]\n" + )); + +#ifndef UCLINUX + fprintf(stdout, _( " gnokii --sendphonebookentry destination memory_type location\n" " [--smsc message_center_number] [--smscno message_center_index]\n" " [-s] [-v n] [-d]\n" @@ -711,9 +759,16 @@ int usage(void) " [--smsc message_center_number] [--smscno message_center_index]\n" " [-r] [-i] [-s] [-a] [--name name]\n" " gnokii --getvoicemailbox\n" + )); +#endif /* UCLINUX */ + + fprintf(stdout, _( " gnokii --getspeeddial number\n" " gnokii --setspeeddial number memory_type location\n\n" + )); +#ifndef UCLINUX + fprintf(stdout, _( " gnokii --getsms memory_type start [end] [-f file]\n" " gnokii --getsmsstatus\n" " gnokii --getsmsfolders\n" @@ -814,10 +869,25 @@ int usage(void) " gnokii --sendprofile destination profile_name ringtonefile\n" " picturefile [--smsc message_center_number]\n" " [--smscno message_center_index] [-s] [-v n] [-d] [--scale]\n\n" + )); +#endif /* UCLINUX */ + fprintf(stdout, _( " gnokii --reset [soft|hard]\n" + )); + +#ifndef UCLINUX + fprintf(stdout, _( " gnokii --dialvoice number\n" + )); +#endif /* UCLINUX */ + + fprintf(stdout, _( " gnokii --cancelcall\n" + )); + +#ifndef UCLINUX + fprintf(stdout, _( " gnokii --displayoutput\n" " gnokii --presskeysequence sequence\n" " gnokii --backupsettings file\n" @@ -834,8 +904,15 @@ int usage(void) " gnokii --phonetests\n" " gnokii --simlock\n" " gnokii --getdisplaystatus\n" + )); +#endif /* UCLINUX */ + + fprintf(stdout, _( " gnokii --identify\n\n" + )); +#ifndef UCLINUX + fprintf(stdout, _( " gnokii --getwapbookmark location\n" " gnokii --setwapbookmark title url [location]\n" " gnokii --sendwapbookmark location destination\n" @@ -867,6 +944,15 @@ int usage(void) fprintf(stdout, _( " gnokii --sniff [port]\n" " gnokii --decodefile file\n" +" gnokii --getbinringfromfile file name offset file2\n" + )); +#endif + +#endif /* UCLINUX */ + +#ifdef UCLINUX + fprintf(stdout, _( +" gnokii --gnokiid [--debug] [ [...]]\n" )); #endif @@ -876,7 +962,7 @@ int usage(void) /* fbusinit is the generic function which waits for the FBUS link. The limit is 10 seconds. After 10 seconds we quit. */ -void fbusinit(void (*rlp_handler)(RLP_F96Frame *frame)) +static void fbusinit(void (*rlp_handler)(RLP_F96Frame *frame)) { int count=0; @@ -888,7 +974,7 @@ void fbusinit(void (*rlp_handler)(RLP_F96Frame *frame)) #endif /* Initialise the code for the GSM interface. */ - error = GSM_Initialise(model, Port, Initlength, GetConnectionTypeFromString(Connection), rlp_handler, SynchronizeTime); + error = GSM_Initialise(model, Port, Initlength, GetConnectionTypeFromString(Connection), rlp_handler, ""/*SynchronizeTime*/); if (error != GE_NONE) { fprintf(stderr, _("GSM/FBUS init failed! (Unknown model ?). Quitting.\n")); @@ -909,7 +995,7 @@ void fbusinit(void (*rlp_handler)(RLP_F96Frame *frame)) /* This function checks that the argument count for a given options is withing an allowed range. */ -int checkargs(int opt, struct gnokii_arg_len gals[], int argc) +static int checkargs(int opt, struct gnokii_arg_len gals[], int argc) { int i; @@ -943,6 +1029,8 @@ int checkargs(int opt, struct gnokii_arg_len gals[], int argc) else return 1; } +static int gnokiid(int argc, char *argv[]); + /* Main function - handles command line arguments, passes them to separate functions accordingly. */ @@ -960,14 +1048,19 @@ int main(int argc, char *argv[]) { "help", no_argument, NULL, OPT_HELP },// Display usage. { "version", no_argument, NULL, OPT_VERSION },// Display version and build information. +#ifndef UCLINUX { "getsmsfolders", no_argument, NULL, OPT_GETSMSFOLDERS },// Gets SMS folders { "getsmsstatus", no_argument, NULL, OPT_GETSMSSTATUS },// Get SMS Folder Status +#endif /* UCLINUX */ { "identify", no_argument, NULL, OPT_IDENTIFY },// Identify +#ifndef UCLINUX { "pmon", no_argument, NULL, OPT_PMON },// For development purposes: run in passive monitoring mode { "foogle", no_argument, NULL, OPT_FOOGLE },// For development purposes: insert you function calls here { "getdatetime", no_argument, NULL, OPT_GETDATETIME },// Get date and time mode { "getalarm", no_argument, NULL, OPT_GETALARM },// Get alarm +#endif /* UCLINUX */ { "cancelcall", no_argument, NULL, OPT_CANCELCALL },// Cancel Call +#ifndef UCLINUX { "getdisplaystatus", no_argument, NULL, OPT_GETDISPLAYSTATUS },// Get display status mode { "allringtones", no_argument, NULL, OPT_ALLRINGTONES },/* Displays names of available ringtones */ { "displayoutput", no_argument, NULL, OPT_DISPLAYOUTPUT },/* Show texts from phone's display */ @@ -979,8 +1072,10 @@ int main(int argc, char *argv[]) { "receivesms", no_argument, NULL, OPT_RECEIVESMS }, { "setoperatorname", optional_argument, NULL, OPT_SETOPERATORNAME },/* Set downloaded operator name */ { "setdatetime", optional_argument, NULL, OPT_SETDATETIME },// Set date and time +#endif /* UCLINUX */ { "writephonebook", optional_argument, NULL, OPT_WRITEPHONEBOOK },// Write phonebook (memory) mode { "reset", optional_argument, NULL, OPT_RESET },// Resets the phone +#ifndef UCLINUX { "monitor", optional_argument, NULL, OPT_MONITOR },// Monitor mode { "setlogo", optional_argument, NULL, OPT_SETLOGO },// Set logo { "getprofile", optional_argument, NULL, OPT_GETPROFILE },// Show profile @@ -993,9 +1088,11 @@ int main(int argc, char *argv[]) { "sendphonebookentry", required_argument, NULL, OPT_SENDPHONEBOOKENTRY}, { "savephonebookentry", required_argument, NULL, OPT_SAVEPHONEBOOKENTRY}, { "deletecalendarnote", required_argument, NULL, OPT_DELCALENDARNOTE },// Delete calendar note mode +#endif /* UCLINUX */ { "getmemory", required_argument, NULL, OPT_GETMEMORY },// Get memory mode { "getspeeddial", required_argument, NULL, OPT_GETSPEEDDIAL },// Get speed dial mode { "setspeeddial", required_argument, NULL, OPT_SETSPEEDDIAL },// Set speed dial mode +#ifndef UCLINUX { "getsms", required_argument, NULL, OPT_GETSMS },// Get SMS message mode { "deletesms", required_argument, NULL, OPT_DELETESMS },// Delete SMS message mode { "sendsms", required_argument, NULL, OPT_SENDSMS },// Send SMS message mode @@ -1046,7 +1143,13 @@ int main(int argc, char *argv[]) #ifdef DEBUG { "sniff", optional_argument, NULL, OPT_SNIFFER },// Will show datas from port { "decodefile", required_argument, NULL, OPT_DECODEFILE },//decode input file + { "getbinringfromfile", required_argument, NULL, OPT_GETBINRINGFROMFILE }, #endif +#endif /* UCLINUX */ + +#ifdef UCLINUX + { "gnokiid", optional_argument, NULL, OPT_GNOKIID },// gnokiid mode +#endif /* UCLINUX */ { 0, 0, 0, 0}, }; @@ -1057,6 +1160,7 @@ int main(int argc, char *argv[]) struct gnokii_arg_len gals[] = { +#ifndef UCLINUX { OPT_MONITOR, 0, 1, 0 }, #ifdef SECURITY @@ -1067,6 +1171,7 @@ int main(int argc, char *argv[]) #ifdef DEBUG { OPT_SNIFFER, 0, 1, 0 }, { OPT_DECODEFILE, 1, 1, 0 }, + { OPT_GETBINRINGFROMFILE,4, 4, 0 }, #endif { OPT_SETDATETIME, 0, 5, 0 }, @@ -1081,9 +1186,11 @@ int main(int argc, char *argv[]) { OPT_SAVEPHONEBOOKENTRY,2, 9, 0 }, { OPT_SENDPHONEBOOKENTRY,3, 9, 0 }, { OPT_DELCALENDARNOTE, 1, 1, 0 }, +#endif /* UCLINUX */ { OPT_GETMEMORY, 2, 4, 0 }, { OPT_GETSPEEDDIAL, 1, 1, 0 }, { OPT_SETSPEEDDIAL, 3, 3, 0 }, +#ifndef UCLINUX { OPT_GETSMS, 2, 5, 0 }, { OPT_DELETESMS, 2, 3, 0 }, { OPT_SENDSMS, 1,10, 0 }, @@ -1101,11 +1208,15 @@ int main(int argc, char *argv[]) { OPT_SETRINGTONE, 1, 3, 0 }, { OPT_GETRINGTONE, 1, 2, 0 }, { OPT_PRESSKEYSEQUENCE, 1, 1, 0 }, +#endif /* UCLINUX */ { OPT_RESET, 0, 1, 0 }, +#ifndef UCLINUX { OPT_GETPROFILE, 0, 1, 0 }, { OPT_SETPROFILE, 3, 3, 0 }, { OPT_SENDPROFILE, 4,10, 0 }, +#endif /* UCLINUX */ { OPT_WRITEPHONEBOOK, 0, 1, 0 }, +#ifndef UCLINUX { OPT_PLAYRINGTONE, 1, 1, 0 }, { OPT_COMPOSER, 1, 1, 0 }, { OPT_RINGTONECONVERT, 2, 2, 0 }, @@ -1124,10 +1235,17 @@ int main(int argc, char *argv[]) { OPT_SAVEWAPSETTINGS, 1, 9, 0 }, { OPT_SENDWAPSETTINGS, 2, 9, 0 }, { OPT_DIVERT, 3, 5, 0 }, +#endif /* UCLINUX */ + +#ifdef UCLINUX + { OPT_GNOKIID, 0, INT_MAX, 0 }, +#endif /* UCLINUX */ { 0, 0, 0, 0 }, }; + LIVE; + opterr = 0; /* For GNU gettext */ @@ -1143,7 +1261,7 @@ int main(int argc, char *argv[]) #endif /* Read config file */ - if (CFG_ReadConfig(&model, &Port, &Initlength, &Connection, &BinDir, &SynchronizeTime,false) < 0) { + if (CFG_ReadConfig(&model, &Port, &Initlength, &Connection, &BinDir, false) < 0) { exit(-1); } @@ -1168,6 +1286,7 @@ int main(int argc, char *argv[]) for(i = 2; i < argc; i++) nargv[i-2] = argv[i]; + nargv[argc-2] = NULL; /* required by gnokiid() for execv(3) */ if(checkargs(c, gals, nargc)) { @@ -1195,14 +1314,17 @@ int main(int argc, char *argv[]) // Then, options with no arguments case OPT_HELP: rc = usage(); break; case OPT_VERSION: rc = version(); break; +#ifndef UCLINUX case OPT_MONITOR: rc = monitormode(nargc, nargv); break; case OPT_GETSMSFOLDERS: rc = getsmsfolders(); break; case OPT_GETDATETIME: rc = getdatetime(); break; case OPT_GETALARM: rc = getalarm(); break; case OPT_GETDISPLAYSTATUS: rc = getdisplaystatus(); break; case OPT_PMON: rc = pmon(); break; +#endif /* UCLINUX */ case OPT_WRITEPHONEBOOK: rc = writephonebook(nargc, nargv);break; +#ifndef UCLINUX #ifdef SECURITY case OPT_ENTERSECURITYCODE: rc = entersecuritycode(optarg); break; case OPT_GETSECURITYCODESTATUS: rc = getsecuritycodestatus(); break; @@ -1215,13 +1337,16 @@ int main(int argc, char *argv[]) #ifdef DEBUG case OPT_SNIFFER: rc = sniff(nargc, nargv); break; case OPT_DECODEFILE: rc = decodefile(nargc, nargv); break; + case OPT_GETBINRINGFROMFILE: rc = getbinringfromfile(nargc, nargv);break; #endif // Now, options with arguments case OPT_SETDATETIME: rc = setdatetime(nargc, nargv); break; case OPT_SETALARM: rc = setalarm(nargv); break; case OPT_DIALVOICE: rc = dialvoice(optarg); break; +#endif /* UCLINUX */ case OPT_CANCELCALL: rc = cancelcall(); break; +#ifndef UCLINUX case OPT_GETCALENDARNOTE: rc = getcalendarnote(nargc, nargv);break; case OPT_DELCALENDARNOTE: rc = deletecalendarnote(optarg);break; case OPT_SAVECALENDARNOTE: rc = savecalendarnote(nargc, nargv);break; @@ -1229,9 +1354,11 @@ int main(int argc, char *argv[]) case OPT_SAVEPHONEBOOKENTRY: rc = savephonebookentry(nargc, nargv);break; case OPT_SENDPHONEBOOKENTRY: rc = sendphonebookentry(nargc, nargv);break; case OPT_WRITECALENDARNOTE: rc = writecalendarnote(nargv); break; +#endif /* UCLINUX */ case OPT_GETMEMORY: rc = getmemory(nargc, nargv); break; case OPT_GETSPEEDDIAL: rc = getspeeddial(optarg); break; case OPT_SETSPEEDDIAL: rc = setspeeddial(nargv); break; +#ifndef UCLINUX case OPT_GETSMS: rc = getsms(argc, argv); break; case OPT_GETSMSSTATUS: rc = getsmsstatus(argc, argv); break; case OPT_DELETESMS: rc = deletesms(nargc, nargv); break; @@ -1243,7 +1370,9 @@ int main(int argc, char *argv[]) case OPT_GETSMSC: rc = getsmsc(optarg); break; case OPT_RENAMESMSC: rc = renamesmsc(nargc,nargv); break; case OPT_NETMONITOR: rc = netmonitor(optarg); break; +#endif /* UCLINUX */ case OPT_IDENTIFY: rc = identify(); break; +#ifndef UCLINUX case OPT_SETLOGO: rc = setlogo(nargc, nargv); break; case OPT_GETLOGO: rc = getlogo(nargc, nargv); break; case OPT_RECEIVESMS: rc = receivesms(nargc, nargv); break; @@ -1268,7 +1397,9 @@ int main(int argc, char *argv[]) case OPT_PHONETESTS: rc = phonetests(); break; case OPT_SIMLOCKINFO: rc = simlockinfo(); break; case OPT_SENDDTMF: rc = senddtmf(optarg); break; +#endif /* UCLINUX */ case OPT_RESET: rc = reset(nargc,nargv); break; +#ifndef UCLINUX case OPT_GETOPERATORNAME: rc = getoperatorname(); break; case OPT_SETOPERATORNAME: rc = setoperatorname(nargc,nargv);break; case OPT_GETWAPBOOKMARK: rc = getwapbookmark(nargc,nargv);break; @@ -1284,7 +1415,11 @@ int main(int argc, char *argv[]) case OPT_GETVOICEMAILBOX: rc = getvoicemailbox(); break; case OPT_NM_COLLECT: rc = nm_collect(nargc, nargv); break; case OPT_NETMONITORDATA: rc = netmonitordata(nargc, nargv);break; +#endif /* UCLINUX */ +#ifdef UCLINUX + case OPT_GNOKIID: rc = gnokiid(nargc, nargv); break; +#endif /* UCLINUX */ default: fprintf(stderr, _("Unknown option: %d\n"), c); break; } @@ -1299,10 +1434,146 @@ int main(int argc, char *argv[]) exit(-1); } +#ifndef UCLINUX + /* Restores various phone settings from one file */ int restoresettings(char *argv[]) { - fprintf(stdout,_("Work in progress. Not usefull now. Sorry\n")); + GSM_Backup Backup; + GSM_PhonebookEntry pbk; + + int confirm; + char ans[4]; + + int i,pos; + + GSM_MemoryStatus SIMMemoryStatus = {GMT_SM, 0, 0}; + GSM_MemoryStatus PhoneMemoryStatus = {GMT_ME, 0, 0}; + + if (GSM_ReadBackupFile(argv[0], &Backup)!=GE_NONE) return 1; + + fbusinit(NULL); + + if (Backup.SIMPhonebookUsed!=0) { + confirm=-1; + while (confirm < 0) { + fprintf(stderr, _("Restore SIM phonebook ? ")); + GetLine(stdin, ans, 99); + if (!strcmp(ans, "yes")) confirm = 1; + if (!strcmp(ans, "no" )) confirm = 0; + } + if (confirm==1) { + if (GSM->GetMemoryStatus(&SIMMemoryStatus) != GE_NONE) { + fprintf(stderr,_("Error getting memory status !\n")); + GSM->Terminate(); + } + i=0;pos=1; + + while ((pos-1)!=SIMMemoryStatus.Used+SIMMemoryStatus.Free) { + pbk.Location=pos; + pbk.MemoryType=GMT_SM; + pbk.Name[0]=0; + pbk.Number[0]=0; + pbk.SubEntriesCount = 0; + if (iWritePhonebookLocation(&pbk); + fprintf(stderr,_(".")); + pos++; + } + fprintf(stderr,_("\n")); + } + } + if (Backup.PhonePhonebookUsed!=0) { + confirm=-1; + while (confirm < 0) { + fprintf(stderr, _("Restore phone phonebook ? ")); + GetLine(stdin, ans, 99); + if (!strcmp(ans, "yes")) confirm = 1; + if (!strcmp(ans, "no" )) confirm = 0; + } + if (confirm==1) { + if (GSM->GetMemoryStatus(&PhoneMemoryStatus) != GE_NONE) { + fprintf(stderr,_("Error getting memory status !\n")); + GSM->Terminate(); + } + + i=0;pos=1; + + while ((pos-1)!=PhoneMemoryStatus.Used+PhoneMemoryStatus.Free) { + pbk.Location=pos; + pbk.MemoryType=GMT_ME; + pbk.Name[0]=0; + pbk.Number[0]=0; + pbk.SubEntriesCount = 0; + if (iWritePhonebookLocation(&pbk); + fprintf(stderr,_(".")); + pos++; + } + fprintf(stderr,_("\n")); + } + } + if (Backup.CallerAvailable==true) { + confirm=-1; + while (confirm < 0) { + fprintf(stderr, _("Restore caller groups ? ")); + GetLine(stdin, ans, 99); + if (!strcmp(ans, "yes")) confirm = 1; + if (!strcmp(ans, "no" )) confirm = 0; + } + if (confirm==1) { + for (i=0;i<5;i++) GSM->SetBitmap(&Backup.CallerGroups[i]); + } + } + if (Backup.OperatorLogoAvailable==true) { + confirm=-1; + while (confirm < 0) { + fprintf(stderr, _("Restore operator logo ? ")); + GetLine(stdin, ans, 99); + if (!strcmp(ans, "yes")) confirm = 1; + if (!strcmp(ans, "no" )) confirm = 0; + } + if (confirm==1) { + GSM->SetBitmap(&Backup.OperatorLogo); + } + } + if (Backup.StartupLogoAvailable==true) { + confirm=-1; + while (confirm < 0) { + fprintf(stderr, _("Restore startup logo ? ")); + GetLine(stdin, ans, 99); + if (!strcmp(ans, "yes")) confirm = 1; + if (!strcmp(ans, "no" )) confirm = 0; + } + if (confirm==1) { + GSM->SetBitmap(&Backup.StartupLogo); + } + } + + GSM->Terminate(); + return 0; } @@ -1321,7 +1592,7 @@ int backupsettings(char *argv[]) fprintf(stderr,_("Backup phonebook from SIM...")); Backup.SIMPhonebookUsed=0; - if (GSM->GetMemoryStatus(&SIMMemoryStatus) == GE_NONE) {//FIXME + if (GSM->GetMemoryStatus(&SIMMemoryStatus) == GE_NONE) { Backup.SIMPhonebookSize=SIMMemoryStatus.Used+SIMMemoryStatus.Free; PbkEntry.MemoryType=GMT_SM; @@ -1396,11 +1667,10 @@ int backupsettings(char *argv[]) Backup.OperatorLogoAvailable=true; Backup.OperatorLogo.type=GSM_7110OperatorLogo; if (GSM->GetBitmap(&Backup.OperatorLogo)!=GE_NONE) { - Backup.OperatorLogoAvailable=true; Backup.OperatorLogo.type=GSM_OperatorLogo; if (GSM->GetBitmap(&Backup.OperatorLogo)!=GE_NONE) { Backup.OperatorLogoAvailable=false; - fprintf(stderr,_("Error\n")); + fprintf(stderr,_("Error\n")); } else fprintf(stderr,_("Done\n")); } else fprintf(stderr,_("Done\n")); @@ -1442,9 +1712,6 @@ int presskeysequence(char *argv[]) sleep(1); - /* We need to make sure that the init is finished to avoid interrupted */ - /* multiframe packets... */ - fbusinit(NULL); for (i=0;i=1 && num<=3) { bitmap.number=num; @@ -3255,7 +3515,7 @@ int setlogo(int argc, char *argv[]) strncpy(bitmap.netcode,"000 00",7); bitmap.width=72; bitmap.height=14; - bitmap.size=bitmap.width*bitmap.height/8; + bitmap.size=GSM_GetBitmapSize(&bitmap); GSM_ClearBitmap(&bitmap); } if (!strcmp(argv[0],"7110op")) @@ -3264,7 +3524,7 @@ int setlogo(int argc, char *argv[]) strncpy(bitmap.netcode,"000 00",7); bitmap.width=78; bitmap.height=21; - bitmap.size=(bitmap.width*bitmap.height + 7)/8; + bitmap.size=GSM_GetBitmapSize(&bitmap); GSM_ClearBitmap(&bitmap); } /* FIX ME: how to remove startup and group logos ? */ @@ -3325,7 +3585,7 @@ int setlogo(int argc, char *argv[]) } else { GSM->SetBitmap(&bitmap); GSM->GetBitmap(&oldbit); - fprintf(stderr, _("too long, truncated to \"%s\" (length %i)\n"),oldbit.text,strlen(oldbit.text)); + fprintf(stderr, _("too long, truncated to \"%s\" (length %ld)\n"),oldbit.text,(long)strlen(oldbit.text)); } ok=false; } @@ -3977,6 +4237,89 @@ int monitormode(int argc, char *argv[]) return 0; } +#endif /* UCLINUX */ + +/* Emulation of separate gnokiid binary for uClinux */ + +#ifdef UCLINUX + +#define NICE_LEVEL (-20) + +static void gnokiid_SIGCHLD(int signo) +{ + fprintf (stderr, _("Child process exited, aborting...\n")); + exit(2); +} + +static int gnokiid(int argc, char *argv[]) +{ + bool DebugMode; /* When true, run in debug mode */ + char *Model; /* Model from .gnokiirc file. */ + char *Port; /* Port from .gnokiirc file */ + char *Initlength; /* Init length from .gnokiirc file */ + char *Connection; /* Connection type from .gnokiirc file */ + char *BinDir; /* Directory of the mgnokiidev command */ + + /* evaluate for presence of "--debug" argument in parameter */ + DebugMode = false; + if(argc>0) + { + if( !strcmp(argv[0],"--debug" )) + { + DebugMode = true; + argv++; + argc--; + } + } + +#ifdef DEBUG + fprintf (stderr, _("Initializing gnokiid mode...\n")); +#endif + + if (CFG_ReadConfig(&Model, &Port, &Initlength, &Connection, &BinDir, true) < 0) + return(-1); + + if (VM_Initialise(Model, Port, Initlength, GCT_FBUS, BinDir, DebugMode, true, ""/*SynchronizeTime*/) == false) + return (-1); + + if (argc>0) { +#ifdef DEBUG + fprintf (stderr, _("Spawning gnokiid startup child process \"%s\"...\n"), *argv); +#endif + signal(SIGCHLD,gnokiid_SIGCHLD); + errno=0; + switch (vfork()) { + case -1: /* vfork() failure */ + fprintf (stderr, _("vfork() failed! (%s)\n"),strerror(errno)); + return -1; + case 0: /* child */ + execv(*argv,argv); + fprintf (stderr, _("Spawn of child process failed! (%s)\n"),strerror(errno)); + _exit(9); + break; + default: /* parent */ + /* PASSTHRU */ + break; + } + } + +#ifdef DEBUG + fprintf (stderr, _("Entering gnokiid virtual modem main loop...\n")); +#endif + if (nice(NICE_LEVEL)) + fprintf (stderr, _("WARNING: nice level change failed (by %d)\n"),NICE_LEVEL); + + VM_ThreadLoop(); + + VM_Terminate(); + + return 0; +} + +#endif /* UCLINUX */ + +#ifndef UCLINUX + /* Shows texts from phone's display */ int displayoutput() @@ -4461,10 +4804,12 @@ int setprofile(int argc, char *argv[]) } +#endif /* UCLINUX */ + /* Get requested range of memory storage entries and output to stdout in easy-to-parse format */ -int getmemory(int argc, char *argv[]) +static int getmemory(int argc, char *argv[]) { GSM_PhonebookEntry entry; @@ -4492,6 +4837,7 @@ int getmemory(int argc, char *argv[]) fprintf(stderr, _("Unknown memory type %s!\n"), argv[0]); return (-1); } + GetMemoryTypeString(memory_type_string, &entry.MemoryType); if (argv[argc-1][0] == '-') @@ -4539,6 +4885,7 @@ int getmemory(int argc, char *argv[]) i_used++; else if (do_all) break; +#ifndef UCLINUX if (output_opt && !strcmp( output_opt,"-v30")) { semicolon_pipe_substitution( &entry, 0 ); fprintf(stdout,_("%s"),GSM_GetVCARD(&entry,30)); @@ -4554,6 +4901,7 @@ int getmemory(int argc, char *argv[]) fprintf(stdout,_("%s"),GSM_GetVCARD(&entry,10)); formatdone=true; } +#endif /* UCLINUX */ if (output_opt && !strcmp(output_opt,"-short")) { semicolon_pipe_substitution( &entry, 0 ); fprintf(stdout, "%s;%s;%s;%d;%d;", entry.Name, entry.Number, memory_type_string, entry.Location, entry.Group); @@ -4696,7 +5044,7 @@ int getmemory(int argc, char *argv[]) /* Read data from stdin, parse and write to phone. The parsing is relatively crude and doesn't allow for much variation from the stipulated format. */ -int writephonebook(int argc, char *args[]) +static int writephonebook(int argc, char *args[]) { GSM_PhonebookEntry entry; @@ -4912,7 +5260,7 @@ int writephonebook(int argc, char *args[]) /* Getting speed dials. */ -int getspeeddial(char *Number) { +static int getspeeddial(char *Number) { GSM_SpeedDial entry; GSM_Error error; @@ -4945,7 +5293,7 @@ int getspeeddial(char *Number) { /* Setting speed dials. */ -int setspeeddial(char *argv[]) { +static int setspeeddial(char *argv[]) { GSM_SpeedDial entry; @@ -4981,6 +5329,8 @@ int setspeeddial(char *argv[]) { return 0; } +#ifndef UCLINUX + /* Getting the status of the display. */ int getdisplaystatus() @@ -5040,29 +5390,42 @@ int netmonitor(char *Mode) return 0; } -int identify( void ) +#endif /* UCLINUX */ + +static int identify( void ) { /* Hopefully is 64 larger as FB38_MAX* / FB61_MAX* */ char imei[64], model[64], rev[64], manufacturer[64]; + LIVE; fbusinit(NULL); + LIVE; while (GSM->GetIMEI(imei) != GE_NONE) sleep(1); + LIVE; while (GSM->GetRevision(rev) != GE_NONE) sleep(1); + LIVE; while (GSM->GetModel(model) != GE_NONE) sleep(1); + LIVE; strcpy(manufacturer, "(unknown)"); + LIVE; GSM->GetManufacturer(manufacturer); + LIVE; fprintf(stdout, _("IMEI: %s\n"), imei); fprintf(stdout, _("Model: %s %s (%s)\n"), manufacturer, GetModelName (model), model); fprintf(stdout, _("Revision: %s\n"), rev); + LIVE; GSM->Terminate(); + LIVE; return 0; } +#ifndef UCLINUX + int senddtmf(char *String) { @@ -5075,8 +5438,10 @@ int senddtmf(char *String) return 0; } +#endif /* UCLINUX */ + /* Resets the phone */ -int reset(int argc, char *argv[]) +static int reset(int argc, char *argv[]) { unsigned char _type=0x03; @@ -5104,6 +5469,8 @@ int reset(int argc, char *argv[]) return 0; } +#ifndef UCLINUX + /* This is a "convenience" function to allow quick test of new API stuff which doesn't warrant a "proper" command line function. */ @@ -5147,7 +5514,7 @@ int pmon() /* Initialise the code for the GSM interface. */ - error = GSM_Initialise(model, Port, Initlength, connection, RLP_DisplayF96Frame, SynchronizeTime); + error = GSM_Initialise(model, Port, Initlength, connection, RLP_DisplayF96Frame, ""/*SynchronizeTime*/); if (error != GE_NONE) { fprintf(stderr, _("GSM/FBUS init failed! (Unknown model ?). Quitting.\n")); @@ -7416,53 +7783,34 @@ int getringtone(int argc, char *argv[]) GSM_Error error; GSM_Ringtone SMringtone; - int i; - - char model[64]; - - FILE *file; - ringtone.location=1; if (argc>1) ringtone.location=atoi(argv[1]); /* Initialise the GSM interface. */ fbusinit(NULL); - error=GSM->GetBinRingtone(&ringtone); - - while (GSM->GetModel(model) != GE_NONE) - sleep(1); - - GSM->Terminate(); + error=GSM_GetPhoneRingtone(&ringtone,&SMringtone); fprintf(stdout, _("Downloaded ringtone, location %i: "),ringtone.location); switch (error) { case GE_NONE: fprintf(stdout, _("get succeeded!\n")); - fprintf(stdout, _("Name: %s (binary format)\n"),ringtone.name); + /* In 33.. we have normal "Smart Messaging" format */ + if (GetModelFeature (FN_RINGTONES)==F_RING_SM) { + fprintf(stdout, _("Name: %s (normal format)\n"),SMringtone.name); + GSM_SaveRingtoneFileOnConsole(argv[0], &SMringtone); + } else { + fprintf(stdout, _("Name: %s (binary format)\n"),ringtone.name); + GSM_SaveBinRingtoneFile(argv[0], &ringtone); + } + GSM->Terminate(); + return 0; break; case GE_INVALIDRINGLOCATION: fprintf(stdout, _("invalid location %i!\n"),ringtone.location); break; case GE_UNKNOWNMODEL: - - /* In 3310 we have normal "Smart Messaging" format */ - if (GetModelFeature (FN_RINGTONES)==F_RING_SM) { - - i=7; - if (ringtone.frame[9]==0x4a && ringtone.frame[10]==0x3a) i=8; - ringtone.frame[i]=0x02; - - GSM_UnPackRingtone(&SMringtone, ringtone.frame+i, ringtone.length-i); - - fprintf(stdout, _("Name: %s (normal format)\n"),SMringtone.name); - - GSM_SaveRingtoneFileOnConsole(argv[0], &SMringtone); - - return 0; - } - fprintf(stdout, _("mygnokii doesn't know format for this model!\n")); break; case GE_NOTIMPLEMENTED: @@ -7472,21 +7820,10 @@ int getringtone(int argc, char *argv[]) fprintf(stdout, _("not supported by this model!\n")); break; } - - if (error!=GE_NONE) - return(-1); - - file = fopen(argv[0], "wb"); - - if (!file) - return(GE_CANTOPENFILE); - fwrite(ringtone.frame, 1, ringtone.length, file); - - fclose(file); + GSM->Terminate(); - return 0; - + return(-1); } int binringtoneconvert(int argc, char *argv[]) @@ -7558,32 +7895,32 @@ int binringtoneconvert(int argc, char *argv[]) w=w*2; if (w>z && (w/2)<=z) { switch (m) { - case 1:fprintf(file,_("16"));break; - case 2:fprintf(file,_("8"));break; - case 3:fprintf(file,_("4"));break; - case 4:fprintf(file,_("2"));break; - case 5:fprintf(file,_("1"));break; + case 1:fprintf(file,_("16"));break; + case 2:fprintf(file,_("8"));break; + case 3:fprintf(file,_("4"));break; + case 4:fprintf(file,_("2"));break; + case 5:fprintf(file,_("1"));break; } break; } } if (z>w) fprintf(file,_("1")); pause=false; - switch (GSM_GetNote(j)) { - case Note_C :fprintf(file,_("c"));break; - case Note_Cis:fprintf(file,_("c#"));break; - case Note_D :fprintf(file,_("d"));break; - case Note_Dis:fprintf(file,_("d#"));break; - case Note_E :fprintf(file,_("e"));break; - case Note_F :fprintf(file,_("f"));break; - case Note_Fis:fprintf(file,_("f#"));break; - case Note_G :fprintf(file,_("g"));break; - case Note_Gis:fprintf(file,_("g#"));break; - case Note_A :fprintf(file,_("a"));break; - case Note_Ais:fprintf(file,_("a#"));break; - case Note_H :fprintf(file,_("h"));break; - default :pause=true;fprintf(file,_("p"));break; //Pause ? - } + switch (GSM_GetNote(j)) { + case Note_C :fprintf(file,_("c"));break; + case Note_Cis:fprintf(file,_("c#"));break; + case Note_D :fprintf(file,_("d"));break; + case Note_Dis:fprintf(file,_("d#"));break; + case Note_E :fprintf(file,_("e"));break; + case Note_F :fprintf(file,_("f"));break; + case Note_Fis:fprintf(file,_("f#"));break; + case Note_G :fprintf(file,_("g"));break; + case Note_Gis:fprintf(file,_("g#"));break; + case Note_A :fprintf(file,_("a"));break; + case Note_Ais:fprintf(file,_("a#"));break; + case Note_H :fprintf(file,_("h"));break; + default :pause=true;fprintf(file,_("p"));break; //Pause ? + } w=deflen*1.5; for (m=0;m<6;m++) { w=w*2; @@ -7643,11 +7980,13 @@ int renamesmsc(int argc, char *argv[]) return 0; } +#endif /* UCLINUX */ + /* * Returns number of sostituited characters. * ... may be useful one day ?? */ -int semicolon_pipe_substitution( GSM_PhonebookEntry *pentry, unsigned int direction ) +static int semicolon_pipe_substitution( GSM_PhonebookEntry *pentry, unsigned int direction ) /* direction = 0 : after reading phone memory ( * 1 : writing phone memory */ @@ -7683,6 +8022,10 @@ int str_substch( char *str, const char toric, const char sost ) return( i_sost ); } +#ifndef UCLINUX + +extern GSM_Error N6110_EnableExtendedCommands (unsigned char status); + /* Allows to set simlock state. With older phone (older 51xx, 61xx) can open them, with older and newer should be able to close them */ @@ -7722,11 +8065,11 @@ int setsimlock() fprintf(stderr,_("Error getting simlock info\n"));GSM->Terminate();return -1; } /* Opening all locks (we must check, if we can open them) */ - NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer0); - openbuffer[4]=1;NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer); - openbuffer[4]=2;NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer); - openbuffer[4]=4;NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer); - openbuffer[4]=8;NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer); + NULL_SendMessageSequence(50, &CurrentMagicError, 10, 0x40,openbuffer0); + openbuffer[4]=1;NULL_SendMessageSequence(50, &CurrentMagicError, 10, 0x40,openbuffer); + openbuffer[4]=2;NULL_SendMessageSequence(50, &CurrentMagicError, 10, 0x40,openbuffer); + openbuffer[4]=4;NULL_SendMessageSequence(50, &CurrentMagicError, 10, 0x40,openbuffer); + openbuffer[4]=8;NULL_SendMessageSequence(50, &CurrentMagicError, 10, 0x40,openbuffer); if (GSM->SimlockInfo(&siml)!=GE_NONE) { fprintf(stderr,_("Error getting simlock info\n"));GSM->Terminate();return -1; } @@ -7775,13 +8118,13 @@ int setsimlock() } /* Closing simlock with given values */ closebuffer[4]=1+2+4+8; - NULL_SendMessageSequence (50, &CurrentMagicError, 20, 0x40,closebuffer); + NULL_SendMessageSequence(50, &CurrentMagicError, 20, 0x40,closebuffer); /* Opening all locks */ - NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer0); - openbuffer[4]=1;NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer); - openbuffer[4]=2;NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer); - openbuffer[4]=4;NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer); - openbuffer[4]=8;NULL_SendMessageSequence (50, &CurrentMagicError, 10, 0x40,openbuffer); + NULL_SendMessageSequence(50, &CurrentMagicError, 10, 0x40,openbuffer0); + openbuffer[4]=1;NULL_SendMessageSequence(50, &CurrentMagicError, 10, 0x40,openbuffer); + openbuffer[4]=2;NULL_SendMessageSequence(50, &CurrentMagicError, 10, 0x40,openbuffer); + openbuffer[4]=4;NULL_SendMessageSequence(50, &CurrentMagicError, 10, 0x40,openbuffer); + openbuffer[4]=8;NULL_SendMessageSequence(50, &CurrentMagicError, 10, 0x40,openbuffer); GSM->Reset(0x03); GSM->Terminate(); return 0; @@ -7881,7 +8224,7 @@ int geteeprom() if ((i/256)!=((i-1)/256)) fprintf(stderr,_(".")); - if (NULL_SendMessageSequence(50, &CurrentMagicError, 9, 0x40,buffer)!=GE_NONE) break; + if (NULL_SendMessageSequence(50, &CurrentMagicError, 9, 0x40,buffer)!=GE_NONE) break; i=i+0x10; } @@ -8682,9 +9025,12 @@ int savephonebookentry(int argc, char *argv[]) case GE_NONE: /* Put entry into SMS structure */ - if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) { +#ifndef UCLINUX + if (GetModelFeature(FN_PHONEBOOK)==F_PBK71INT) { GSM_SavePhonebookEntryToSMS(&MultiSMS,&entry,21); - } else { + } else +#endif /* UCLINUX */ + { GSM_SavePhonebookEntryToSMS(&MultiSMS,&entry,10); } @@ -8727,7 +9073,7 @@ int sendphonebookentry(int argc, char *argv[]) case GE_NONE: /* Put entry into SMS structure */ - if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) { + if (GetModelFeature(FN_PHONEBOOK)==F_PBK71INT) { GSM_SavePhonebookEntryToSMS(&MultiSMS,&entry,21); } else { GSM_SavePhonebookEntryToSMS(&MultiSMS,&entry,10); @@ -8746,3 +9092,77 @@ int sendphonebookentry(int argc, char *argv[]) return 0; } + +#ifdef DEBUG +int getbinringfromfile(int argc, char *argv[]) +{ + FILE *file; + int i,j; + bool found; + GSM_BinRingtone binring,ringtone; + + fprintf(stdout,_("Offset %ld\n"),atol(argv[2])); + + file = fopen(argv[0], "rb"); + + if (!file) return(GE_CANTOPENFILE); + + fseek(file,atol(argv[2]),0); + + ringtone.length=fread(ringtone.frame, 1, 900, file); + + fclose(file); + + i=0;found=false; + while (true) { + if (ringtone.frame[i ]==0x00 && ringtone.frame[i+1]==0x02 && + ringtone.frame[i+2]==0xFC && ringtone.frame[i+3]==0x09) { + found=true; + break; + } + i++; + if (i==ringtone.length-3) break; + } + + if (!found) { + fprintf(stdout,_("Start not found\n")); + return (-1); + } + + j=0;found=false; + while (true) { + if (ringtone.frame[j]==0x07 && ringtone.frame[j+1]==0x0B) { + found=true; + break; + } + j++; + if (j==ringtone.length-2) break; + } + + if (!found) { + fprintf(stdout,_("End not found\n")); + return (-1); + } + + binring.length=0; + binring.frame[binring.length++]=0x00; + binring.frame[binring.length++]=0x00; + binring.frame[binring.length++]=0x0C; + binring.frame[binring.length++]=0x01; + binring.frame[binring.length++]=0x2C; + + memcpy(binring.frame+binring.length,argv[1],strlen(argv[1])); + binring.length=binring.length+strlen(argv[1]); + + binring.frame[binring.length++]=0x00; + + memcpy(binring.frame+binring.length,ringtone.frame+i,j-i+2); + binring.length=binring.length+j-i+2; + + GSM_SaveBinRingtoneFile(argv[3], &binring); + + return GE_NONE; +} +#endif + +#endif /* UCLINUX */