Commit 2a183e62 authored by Wesley W. Terpstra's avatar Wesley W. Terpstra

Windows doesn't have select, and we don't need it.

parent 50a42e25
......@@ -224,6 +224,8 @@ int main() {
signal(SIGINT, &trapSIGINT);
std::cerr << "Executing break -- and entering pipe-mode" << std::endl;
uint8_t buf[1024];
while (1) {
// Poll device
try {
......@@ -233,22 +235,11 @@ int main() {
return -1;
}
/* Check for stdin ready */
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 10000; /* 10ms */
fd_set ifds;
FD_ZERO(&ifds);
FD_SET(0, &ifds);
select(1, &ifds, 0, 0, &tv);
if (FD_ISSET(0, &ifds)) {
uint8_t buf[1024];
int got = read(0, buf, sizeof(buf));
if (got <= 0) break; // EOF
for (int i = 0; i < got; ++i)
uart(Bits(buf[i]));
}
// Get next command
int got = read(0, buf, sizeof(buf));
if (got <= 0) break; // EOF
for (int i = 0; i < got; ++i)
uart(Bits(buf[i]));
}
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment