From 4f06d96cef39340ea7c990c01c2f82de7e4f4adc Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Tue, 23 Sep 2014 11:14:35 -0400 Subject: [PATCH] Log hex dumps in both directions. --- passthru.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/passthru.c b/passthru.c index 25493ed..1124a03 100644 --- a/passthru.c +++ b/passthru.c @@ -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)); } } }