mirror of https://github.com/wolfSSL/wolfBoot.git
test-expected-version: add debug and optional trigger
parent
4c63cfd974
commit
489071a77e
|
@ -49,6 +49,9 @@
|
||||||
#ifndef B115200
|
#ifndef B115200
|
||||||
#define B115200 115200
|
#define B115200 115200
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef TIMEOUT
|
||||||
|
#define TIMEOUT 60
|
||||||
|
#endif
|
||||||
|
|
||||||
void alarm_handler(int signo)
|
void alarm_handler(int signo)
|
||||||
{
|
{
|
||||||
|
@ -67,8 +70,8 @@ int main(int argc, char** argv)
|
||||||
sigset(SIGALRM, alarm_handler);
|
sigset(SIGALRM, alarm_handler);
|
||||||
|
|
||||||
|
|
||||||
if (argc != 1) {
|
if (argc > 2) {
|
||||||
printf("Usage: %s\n", argv[0]);
|
printf("Usage: %s [trigger command]\n", argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,16 +90,22 @@ int main(int argc, char** argv)
|
||||||
tty.c_cc[VTIME] = 5;
|
tty.c_cc[VTIME] = 5;
|
||||||
tcsetattr(serialfd, TCSANOW, &tty);
|
tcsetattr(serialfd, TCSANOW, &tty);
|
||||||
|
|
||||||
alarm(60);
|
alarm(TIMEOUT);
|
||||||
|
|
||||||
|
if (argc > 1) {
|
||||||
|
fprintf(stderr, "Executing \"%s\"\n", argv[1]);
|
||||||
|
system(argv[1]);
|
||||||
|
}
|
||||||
|
|
||||||
while (i >= 0) {
|
while (i >= 0) {
|
||||||
char c;
|
char c;
|
||||||
res = read(serialfd, &c, 1);
|
res = read(serialfd, &c, 1);
|
||||||
if (res <= 0) {
|
if (res <= 0) {
|
||||||
usleep(10000);
|
usleep(10000);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!star) {
|
fprintf(stderr, "rx: %x\n", c);
|
||||||
|
if (!star) {
|
||||||
if (c == '*') {
|
if (c == '*') {
|
||||||
star = 1;
|
star = 1;
|
||||||
i = 3;
|
i = 3;
|
||||||
|
@ -108,6 +117,9 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("%d\n", ver);
|
printf("%d\n", ver);
|
||||||
|
|
||||||
|
fprintf(stderr, "ver: %d\n", ver);
|
||||||
|
|
||||||
close(serialfd);
|
close(serialfd);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue