sp_close(): disable exclusive mode to allow re-opening the port later#5
sp_close(): disable exclusive mode to allow re-opening the port later#5jpnurmi wants to merge 1 commit intosigrokproject:masterfrom
Conversation
|
I'm not sure why you're finding you need this. After I'm not familar with Dart, your bindings for it, or what your users might be doing with them - is it possible the user having that issue has a race where another open() is happening before the first close() is complete? Or is it possible to demonstrate the EBUSY with a simple C program? I'd be surprised if so because I'm sure we have programs out there that re-open the same port without this patch. |
|
Hmm, it's fairly possible that this occurs specifically with socat, because that's what I'm using for emulation when developing anything related to serial ports. |
|
[Cross-posting this comment to PR #4 and #5.] Hi @martinling, @jpnurmi and @luizribeiro, I have a setup with a Riden RD6012P. I'm using the esp-link firmware in my Wifi module which makes it possible to run modbus over telnet. Thus, I do: sudo socat pty,link=/dev/virtualcom0,raw,group-late=dialout,mode=660 tcp:192.168.nnn.nnn:23 PRs #4 and #5 together make sigrok work with the socat pty and makes it possible for me to use the PSU over Wifi. (And, yes, it is funny that PR #5 is needed. If PR #5 is not applied, there is an "sr: serial-libsp: Error opening port (16): Device or resource busy." error occurring after the first call to sp_open. This occurs also if the pty has been opened before in the same session with a different (erroneous) specified device. It is as if the socat opened pty is dependent on the port being in non-exclusive mode to close (fully).) It would make life easier if you applied these two PRs. And I don't think it is strange at all to make it possible for libserialport to handle a "forwarded" serial port in this way. |
|
While I agree with Martin's argument that the current implementation isn't showing problems elsewhere as far as we know, I also don't see the problem with releasing the exclusive mode right before closing the port. Hence, merged as https://sigrok.org/gitaction?p=libserialport.git;a=commit;h=32b94b12cac47933b0e06d317eaa37a539d207c1, thank you! |
No description provided.