Log hex dumps in both directions.

This commit is contained in:
Solomon Peachy 2014-09-23 11:14:35 -04:00
parent 7622dfb502
commit 4f06d96cef
1 changed files with 3 additions and 6 deletions

View File

@ -341,21 +341,18 @@ int main (int argc, char **argv)
while ((i = read(ser_fd1, &c, sizeof(c))) > 0) {
char buf[20];
write(ser_fd2, &c, sizeof(c));
// write(fileno(stdout), "1> ", 3);
sprintf(buf, "1> 0x%02x \n", c);
write(fileno(stdout), buf, strlen(buf));
// write(fileno(stdout), &c, sizeof(c));
// write(fileno(stdout), "\n", 1);
}
}
if (pfds[1].revents & (POLLIN|POLLPRI)) {
uint8_t c;
while ((i = read(ser_fd2, &c, sizeof(c))) > 0) {
char buf[20];
write(ser_fd1, &c, sizeof(c));
// write(fileno(stdout), "2> ", 3);
write(fileno(stdout), &c, sizeof(c));
// write(fileno(stdout), "\n", 1);
sprintf(buf, "2> 0x%02x \n", c);
write(fileno(stdout), buf, strlen(buf));
}
}
}