Web Serial DEVICE_LOST on Linux

Issue #559872992 Accepted P3 / S3 Linux

Downloads

Patched Chromium for Linux (amd64 .deb) Firmware repository CircuitPython UF2 Probe code.py Open Web Serial terminal

Patched build: Chromium 156.0.8065.0, commit f3275a23d1536.

SHA-256: 349b3c57a9b64ca4dcadb140bb2cd8e1d0336d29e97672e82e8e5cde83232ae3

1. Flash the probe firmware

  1. Double-tap reset on the Adafruit Feather nRF52840 Sense. The FTHRSNSBOOT drive appears.
  2. Download the CircuitPython UF2 above and copy it to FTHRSNSBOOT.
  3. Wait for the board to reboot and mount as CIRCUITPY.
  4. Download code.py above and copy it to the root of CIRCUITPY.

Always test at 115200 baud. Opening this board at 1200 baud triggers its bootloader reset.

2. Find and poison the port

# Find the port.
ls -l /dev/serial/by-id/
PORT=/dev/ttyACM0

# Simulate the termios state left by pyserial.
stty -F "$PORT" min 0 time 0

# Must print: min = 0; time = 0
stty -F "$PORT" -a | grep -o 'min = [0-9]*; time = [0-9]*'

Do not unplug or reset the board after poisoning it. Replugging resets termios and hides the bug.

3. Red test with unpatched Chrome

  1. Open the Web Serial terminal in regular system Chrome.
  2. Click Connect, select the Feather, and use 115200 baud.

Expected
Error: The device has been lost. appears immediately.

4. Install the patched build

# Verify the download.
sha256sum chromium-i-559872992-linux-amd64.deb

# Install it on Debian or Ubuntu.
sudo apt install ./chromium-i-559872992-linux-amd64.deb

# Launch it with a clean profile.
chromium-browser-stable \
  --user-data-dir=/tmp/chromium-i-559872992 \
  https://googlechromelabs.github.io/serial-terminal/

5. Green test

  1. Poison the port again with stty -F "$PORT" min 0 time 0.
  2. In the patched build, connect to the Feather at 115200 baud.
  3. The connection must remain open without an error.
  4. Click the black terminal area, type PING, and press Enter. It returns PONG.
  5. Type LED and press Enter. It returns OK and toggles the red LED.
  6. Disconnect.

Expected
The device stays connected and both commands work.

# After disconnect, the patched build has corrected the tty state.
stty -F "$PORT" -a | grep -o 'min = [0-9]*; time = [0-9]*'
# min = 1; time = 0

Troubleshooting