Add command line switch to disable/enable ack handling
This commit is contained in:
parent
c97fa6d38b
commit
e26ea540e7
2 changed files with 22 additions and 4 deletions
|
@ -42,6 +42,7 @@ void utils_parse_args(int argc, char *argv[]) {
|
||||||
{0,0,0,0}
|
{0,0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
optind = 0;
|
||||||
int opt_index = 0;
|
int opt_index = 0;
|
||||||
int opt;
|
int opt;
|
||||||
while((opt = getopt_long(argc, argv, "L:", long_opts, &opt_index)) != -1) {
|
while((opt = getopt_long(argc, argv, "L:", long_opts, &opt_index)) != -1) {
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
#include <tilp2/ticables.h>
|
#include <tilp2/ticables.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <error.h>
|
#include <error.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <getopt.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "common/utils.h"
|
#include "common/utils.h"
|
||||||
|
|
||||||
|
@ -61,12 +62,31 @@ void retry_recv(unsigned char* recv, int recvCount) {
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
int err;
|
int err;
|
||||||
|
// z88dk-gdb doesn't like the ACKs -/+, so we just hide them
|
||||||
|
int handle_acks = 1;
|
||||||
|
|
||||||
setvbuf(stdout, NULL, _IONBF, 0);
|
setvbuf(stdout, NULL, _IONBF, 0);
|
||||||
setvbuf(stdin, NULL, _IONBF, 0);
|
setvbuf(stdin, NULL, _IONBF, 0);
|
||||||
|
|
||||||
utils_parse_args(argc, argv);
|
utils_parse_args(argc, argv);
|
||||||
|
|
||||||
|
const struct option long_opts[] = {
|
||||||
|
{"handle-acks", no_argument, &handle_acks, 1},
|
||||||
|
{"no-handle-acks", no_argument, &handle_acks, 0},
|
||||||
|
{0,0,0,0}
|
||||||
|
};
|
||||||
|
|
||||||
|
optind = 0;
|
||||||
|
int opt_index = 0;
|
||||||
|
int opt;
|
||||||
|
while((opt = getopt_long(argc, argv, "", long_opts, &opt_index)) != -1) {
|
||||||
|
if(opt == 0 && long_opts[opt_index].flag) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log(LEVEL_DEBUG, "handle acks: %d\n", handle_acks);
|
||||||
|
|
||||||
ticables_library_init();
|
ticables_library_init();
|
||||||
|
|
||||||
log(LEVEL_INFO, "PROCESS ID: %d\n", getpid());
|
log(LEVEL_INFO, "PROCESS ID: %d\n", getpid());
|
||||||
|
@ -77,7 +97,6 @@ int main(int argc, char *argv[]) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// BEGIN DON'T DO THIS FOR TICALCS
|
|
||||||
err = ticables_cable_open(handle);
|
err = ticables_cable_open(handle);
|
||||||
if(err) {
|
if(err) {
|
||||||
log(LEVEL_ERROR, "Could not open cable: %d\n", err);
|
log(LEVEL_ERROR, "Could not open cable: %d\n", err);
|
||||||
|
@ -92,9 +111,7 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
log(LEVEL_INFO, "INFO: Model %d, Port:%d, Family %d, Variant %d\n", model, port, info.family, info.variant);
|
log(LEVEL_INFO, "INFO: Model %d, Port:%d, Family %d, Variant %d\n", model, port, info.family, info.variant);
|
||||||
// END DON'T DO THIS FOR TICALCS
|
|
||||||
|
|
||||||
bool handle_acks = true;
|
|
||||||
bool handled_first_recv = false;
|
bool handled_first_recv = false;
|
||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue