refactor close() by SpudGunMan · Pull Request #841 · meshtastic/python

added 3 commits

October 14, 2025 07:42
This ensures flush() is only called if the stream is open, and logs (but ignores) any exceptions during flush. This should prevent the "Bad file descriptor" error.

I see this error a lot on a rak unit, I dont know this is the way but .. you be the judge.
The double flush() is not the root cause; the real issue is that code is trying to use the serial port after it has been closed.
The error occurs both in close() (during flush()) and later in _writeBytes() (during write()), indicating the port is closed or invalid at those times.

pzskc383 pushed a commit to pzskc383/meshtastic-python that referenced this pull request

Jan 18, 2026

@ianmcorvidae @pzskc383