From 42651d311bff5fd00c5e167a6ab894f1915c7b97 Mon Sep 17 00:00:00 2001 From: Peter Ackermans <72704891+PeterAckermans@users.noreply.github.com> Date: Wed, 3 Jul 2024 21:11:05 +0200 Subject: [PATCH 1/3] Adapt to ESP32 V3 --- TelnetSpy.cpp | 4 ++-- TelnetSpy.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/TelnetSpy.cpp b/TelnetSpy.cpp index 83b2dca..4f4cb33 100644 --- a/TelnetSpy.cpp +++ b/TelnetSpy.cpp @@ -737,14 +737,14 @@ void TelnetSpy::handle() { } if (telnetServer->hasClient()) { if (client.connected()) { - WiFiClient rejectClient = telnetServer->available(); + WiFiClient rejectClient = telnetServer->accept(); //available(); if (strlen(rejectMsg) > 0) { rejectClient.write((const uint8_t*) rejectMsg, strlen(rejectMsg)); } rejectClient.flush(); rejectClient.stop(); } else { - client = telnetServer->available(); + client = telnetServer->accept(); //available(); if (strlen(welcomeMsg) > 0) { client.write((const uint8_t*) welcomeMsg, strlen(welcomeMsg)); } diff --git a/TelnetSpy.h b/TelnetSpy.h index 8527f86..c2e05b4 100644 --- a/TelnetSpy.h +++ b/TelnetSpy.h @@ -272,6 +272,7 @@ #define CRITCAL_SECTION_END portEXIT_CRITICAL(&AtomicMutex); #endif #include +#include "rom/ets_sys.h" class TelnetSpy : public Stream { public: From 8bba71317cfce098951c53c3e7c34da51790ab69 Mon Sep 17 00:00:00 2001 From: Peter Ackermans <72704891+PeterAckermans@users.noreply.github.com> Date: Wed, 3 Jul 2024 21:28:42 +0200 Subject: [PATCH 2/3] Update library.properties --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index 0c921f0..fc8e2cc 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=TelnetSpy -version=1.4 +version=1.5 author=Wolfgang Mattis (Y) maintainer=Wolfgang Mattis (Y) sentence=Cloning the serial port via Telnet / Debugging "over the air" (for ESP8266/ESP32) From fe5b974bf7be5b051a0fba84ff211d112882e371 Mon Sep 17 00:00:00 2001 From: Peter Ackermans <72704891+PeterAckermans@users.noreply.github.com> Date: Sun, 29 Sep 2024 20:44:25 +0200 Subject: [PATCH 3/3] ESP32 LIB V3.3 --- TelnetSpy.cpp | 14 +++++++------- TelnetSpy.h | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/TelnetSpy.cpp b/TelnetSpy.cpp index 4f4cb33..c3b542f 100644 --- a/TelnetSpy.cpp +++ b/TelnetSpy.cpp @@ -98,7 +98,7 @@ void TelnetSpy::setPort(uint16_t portToUse) { if (listening) { if (client.connected()) { sendBlock(); - client.flush(); + client.clear(); client.stop(); } if (connected && (callbackDisconnect != NULL)) { @@ -408,13 +408,13 @@ int TelnetSpy::peek (void) { return val; } -void TelnetSpy::flush (void) { +void TelnetSpy::clear (void) { if (usedSer) { usedSer->flush(); } if (client.connected()) { sendBlock(); - client.flush(); + client.clear(); } } @@ -449,7 +449,7 @@ void TelnetSpy::end() { } if (client.connected()) { sendBlock(); - client.flush(); + client.clear(); client.stop(); } if (connected && (callbackDisconnect != NULL)) { @@ -637,7 +637,7 @@ void TelnetSpy::setCallbackOnDisconnect(void (*callback)()) { void TelnetSpy::disconnectClient() { if (client.connected()) { sendBlock(); - client.flush(); + client.clear(); client.stop(); } if (connected && (callbackDisconnect != NULL)) { @@ -741,7 +741,7 @@ void TelnetSpy::handle() { if (strlen(rejectMsg) > 0) { rejectClient.write((const uint8_t*) rejectMsg, strlen(rejectMsg)); } - rejectClient.flush(); + rejectClient.clear(); rejectClient.stop(); } else { client = telnetServer->accept(); //available(); @@ -764,7 +764,7 @@ void TelnetSpy::handle() { if (connected) { connected = false; sendBlock(); - client.flush(); + client.clear(); client.stop(); pingRef = 0xFFFFFFFF; waitRef = 0xFFFFFFFF; diff --git a/TelnetSpy.h b/TelnetSpy.h index c2e05b4..33423e6 100644 --- a/TelnetSpy.h +++ b/TelnetSpy.h @@ -333,7 +333,8 @@ class TelnetSpy : public Stream { int peek(void) override; int read(void) override; int availableForWrite(void); - void flush(void) override; +// void clear(void) override; + void clear(void); void debugWrite(uint8_t); size_t write(uint8_t) override; inline size_t write(unsigned long n) { return write((uint8_t) n); }