You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Passing in strings over a certain length freezes the device.
May be related to buffer overflow? looks like it crashes after 64 characters.
Set up (please complete the following information)
change line 79 from if ( connected ) usb_web.println("TinyUSB WebUSB Serial example");
to if ( connected ) usb_web.println("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
Looks like this is still happening. Im also experiencing the issue on the RP2040.
The following code hangs when connected to the webserial example.
The main fix is just sending less than 64 bytes but obviously sometimes you need to send more than that...
Changing 200 to 64 below changes how many bytes are sent.
#include "Adafruit_TinyUSB.h"
// USB WebUSB object
Adafruit_USBD_WebUSB usb_web;
// Landing Page: scheme (0: http, 1: https), url
WEBUSB_URL_DEF(landingPage, 1 /*https*/, "adafruit.github.io/Adafruit_TinyUSB_Arduino/examples/webusb-serial/index.html");
int led_pin = LED_BUILTIN;
// the setup function runs once when you press reset or power the board
void setup()
{
#if defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_RP2040)
// Manual begin() is required on core without built-in support for TinyUSB such as mbed rp2040
TinyUSB_Device_Init(0);
#endif
usb_web.setLandingPage(&landingPage);
usb_web.setLineStateCallback(line_state_callback);
//usb_web.setStringDescriptor("TinyUSB WebUSB");
usb_web.begin();
Serial.begin(115200);
// wait until device mounted
while( !TinyUSBDevice.mounted() ) delay(1);
Serial.println("TinyUSB WebUSB Serial example");
}
void loop(){}
void line_state_callback(bool connected){
if ( connected ) {
for (int i = 0; i < 200; i++) {
int digit = i % 10;
Serial.print(digit);
usb_web.print(digit);
usb_web.flush();
}
}
}
Describe the bug
Passing in strings over a certain length freezes the device.
May be related to buffer overflow? looks like it crashes after 64 characters.
Set up (please complete the following information)
To Reproduce
Steps to reproduce the behavior:
webusb_serial
example hereif ( connected ) usb_web.println("TinyUSB WebUSB Serial example");
to
if ( connected ) usb_web.println("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
Expected behavior
Full string is printed out via web_usb without crashing
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Seems to work as expected on SAMD21 boards
Tested in Chrome 83.0.4103.14 and Brave browser (Chromium)
The text was updated successfully, but these errors were encountered: