The previous fix (port access lock) only addressed contention between
our own read/write threads. A recurring "ClearCommError failed -
Acesso negado" after the lock fix indicates the OS is invalidating the
port handle itself (USB power management suspending the port, the
RFID module browning out under high RF output power, or another app
holding the port) rather than an internal race.
Add:
- A "Reconectar automaticamente" checkbox (on by default) that retries
opening the port with backoff (up to 5 attempts) after any fatal
serial error, resuming the scan automatically if one was active.
- A generation counter so stale scheduled reconnects are discarded if
the user manually connects/disconnects in the meantime.
- An actionable hint logged on fatal errors explaining the likely
causes and how to fix each one.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Reading and writing the serial port from different threads without
synchronization can trigger "GetOverlappedResult failed / WriteFile
failed - Acesso negado" on Windows with some USB-serial drivers. Add a
lock guarding all access to the Serial object, make the reader loop
non-blocking (in_waiting + short sleep instead of blocking read), and
recover cleanly to a reconnectable UI state on any fatal serial error
instead of leaving the app stuck in a broken "connected" state.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Tkinter desktop app to connect over serial, configure baudrate/output
power, start/stop tag inventory, and display detected EPC tags in a
table with RSSI and read count.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>