Skip to content

Open the display serial port in exclusive mode - #1096

Open
d-tatianin wants to merge 1 commit into
mathoudebine:mainfrom
d-tatianin:fix/exclusive-serial-port-lock
Open

d-tatianin wants to merge 1 commit into
mathoudebine:mainfrom
d-tatianin:fix/exclusive-serial-port-lock

Conversation

@d-tatianin

Copy link
Copy Markdown

No description provided.

Nothing prevented two instances of the system monitor from opening the same
serial port, e.g. when using "Save and run" from the configuration window while
the system monitor is already running. Both instances then send commands to the
display at the same time: the interleaved data corrupts the display (torn
images), and a Turing 3.5" (rev. A) ends up rebooting and disconnecting from
USB again and again.

Open the port with pyserial exclusive=True. On Linux and macOS, it takes a
flock() on the port so that a second instance cannot open it: it fails through
the existing retry logic instead of corrupting the display. On Windows the
option is ignored, COM ports are already opened in exclusive mode by the OS.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant