gsm0710muxd-hack: log: save to /data/local/tmp/

/tmp is not available in Android, so save to /data/local/tmp.
This commit is contained in:
Oliver Smith 2021-10-04 10:51:57 +02:00
parent a5b8b55395
commit 38d40e08ff
2 changed files with 5 additions and 4 deletions

View File

@ -3154,7 +3154,7 @@ static int usage(char *_name)
fprintf(stderr, "\t-m <modem>: Mode (basic, advanced) [%s]\n", cmux_mode ? "advanced" : "basic");
fprintf(stderr, "\t-f <framsize>: Frame size [%d]\n", cmux_N1);
fprintf(stderr, "\t-n <number of ports>: Number of virtual ports to create, must be in range 1-31 [%d]\n", vir_ports);
fprintf(stderr, "\t-o <output log to file>: Output log to /tmp/gsm0710muxd.log [%s]\n", logtofile ? "yes" : "no");
fprintf(stderr, "\t-o <output log to file>: Output log to %s [%s]\n", LOG_FILE_PATH, logtofile ? "yes" : "no");
fprintf(stderr, "\t-h: Show this help message and show current settings.\n");
return -1;
}
@ -3317,12 +3317,12 @@ int main(int argc, char *argv[])
break;
case 'o':
logtofile = 1;
if ((muxlogfile = fopen("/tmp/gsm0710muxd.log", "w+")) == NULL) {
if ((muxlogfile = fopen(LOG_FILE_PATH, "w+")) == NULL) {
fprintf(stderr, "Error: %s.\n", strerror(errno));
usage(argv[0]);
exit(0);
} else {
fprintf(stderr, "gsm0710muxd log is output to /tmp/gsm0710muxd.log\n");
fprintf(stderr, "gsm0710muxd log is output to %s\n", LOG_FILE_PATH);
}
break;
case 'd':
@ -3428,7 +3428,7 @@ int main(int argc, char *argv[])
LOGMUX(LOG_NOTICE, "\t-m <modem>: Mode (basic, advanced) [%s]", cmux_mode ? "advanced" : "basic");
LOGMUX(LOG_NOTICE, "\t-f <framsize>: Frame size [%d]", cmux_N1);
LOGMUX(LOG_NOTICE, "\t-n <number of ports>: Number of virtual ports to create, must be in range 1-31 [%d]", vir_ports);
LOGMUX(LOG_NOTICE, "\t-o <output log to file>: Output log to /tmp/gsm0710muxd.log [%s]", logtofile ? "yes" : "no");
LOGMUX(LOG_NOTICE, "\t-o <output log to file>: Output log to %s [%s]", LOG_FILE_PATH, logtofile ? "yes" : "no");
/* main_exit_signal is set via the function set_main_exit_signal() */
while ((main_exit_signal == 0) && ((rc = watchdog(&serial)) == 0)) {

View File

@ -200,6 +200,7 @@ static int g_set_alarm_flag = 0;
/******************************************************************************/
#define BAUDRATE B460800
#define LOG_FILE_PATH "/data/local/tmp/gsm0710muxd.log"
/*MUX defines */
#define GSM0710_FRAME_FLAG 0xF9 // basic mode flag for frame start and end