-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
tools: Add locking to pyboard.py serial port for linux and OSX #2256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This adds whole bunch of code. Is it really that needed? |
Well, it adds a bunch of code on the PC side of things (which personally I'm perfectly happy with). I know I've run into the problem myself numerous times having rshell (which derives from pyboard.py) fail to connect to the pyboard becuase I had some other terminal program running in the background. If this isn't accepted here, I'll just add it to rshell, but logically the functionality belongs here. Logically, it probably belongs in a separate file, but I know in the past @dpgeorge has preferred to Every terminal program (piccom, minicom, screen, etc) has similar code. So to summarize, it's not absolutely needed, but without it you get failures trying to run tests if you happen to have the repl open someplace else. |
Yes, which may have bugs, or not work as expected for someone, etc. I'm +0.5 on this, but let @dpgeorge decide on the merge. |
feaee5d
to
f580c22
Compare
f580c22
to
12ca05f
Compare
I fixed a couple minor issues and tested under Python2 & 3 on Windows, Linux, and OSX. |
Running on Arch Linux I get the following error:
Also, running picocom on the same device I don't see the LCK file... I assume that it's supposed to be a standard name that all programs create if they lock the device. |
Hmm. I'll have to install Arch in a VM and try it out. I actually got the filename from the picocom source files, but picocom supports several different methods of locking. It's possible that Arch decided to implement something different. |
Switch PyPortal Titano to 8-bit Mode
This is a useful feature but I think it's better suited to integrate as part of #6375, and to only cover the case of multiple pyboard.py's trying to open the same port (ie don't also try to protect against minicom/picocom/etc). |
It looks like pyserial 3.3 added an exclusive argument to the init method. |
Very nice! See #7141. |
This adds proper locking for the serial port on linux and OSX.
If a program like picocom or minicom has the serial port open and you try to run pyboard, you'll now get an error message.