summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <slp@sunrisemicro.com>2014-09-23 11:14:35 -0400
committerSolomon Peachy <slp@sunrisemicro.com>2014-09-23 11:14:35 -0400
commit4f06d96cef39340ea7c990c01c2f82de7e4f4adc (patch)
treeb9face24538512d82c1b91615608c98b86bbd575
parent7622dfb50288400346372475f80b6b6df6e8559f (diff)
downloadsobredirect-4f06d96cef39340ea7c990c01c2f82de7e4f4adc.tar.gz
sobredirect-4f06d96cef39340ea7c990c01c2f82de7e4f4adc.tar.bz2
sobredirect-4f06d96cef39340ea7c990c01c2f82de7e4f4adc.zip
Log hex dumps in both directions.
-rw-r--r--passthru.c9
1 files 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));
}
}
}