From 4da7a3e44d2bbd7b21ae05c7b6604748e7227227 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Thu, 8 Dec 2022 16:31:24 +0100 Subject: wip2 --- src/net/ps1/src/net.c | 5 +++-- src/net/win9x/src/serial.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'src/net') diff --git a/src/net/ps1/src/net.c b/src/net/ps1/src/net.c index af964cf..185d990 100644 --- a/src/net/ps1/src/net.c +++ b/src/net/ps1/src/net.c @@ -7,6 +7,7 @@ #include #include #include +#include static struct net_host { @@ -82,7 +83,7 @@ static int on_write(const void *const buf, size_t n, void *const arg) EnterCriticalSection(); - for (const char *b = buf; n; n--, b++) + for (const uint8_t *b = buf; n; n--, b++) { struct net_host_fifo *const f = &h->out; size_t new = f->pending + 1; @@ -115,7 +116,7 @@ static int on_read(void *const buf, const size_t n, void *const arg) EnterCriticalSection(); - for (char *b = buf; rem; rem--, b++) + for (uint8_t *b = buf; rem; rem--, b++) { if (f->read == f->pending) goto end; diff --git a/src/net/win9x/src/serial.c b/src/net/win9x/src/serial.c index c1cffb6..57d7261 100644 --- a/src/net/win9x/src/serial.c +++ b/src/net/win9x/src/serial.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -244,6 +245,22 @@ static int on_write(const void *const buf, const size_t n, void *const arg) __func__, GetLastError()); goto failure; } + + printf("%s: outgoing packet, buf: %p, n: %u: [", __func__, buf, (unsigned)n); + + for (size_t i = 0; i < n; i++) + { + const char b = ((const char *)buf)[i]; + printf("%02hhx", b); + + if (isprint((unsigned char)b)) + printf(" (%c)", b); + + if (i + 1 < n) + printf(", "); + } + + printf("]\n"); } return get_result(h, r); -- cgit v1.2.3