open serial port on windows 7 failed
I have a usb-serial port cable [pl2302], enumerated as com3 in my windows 7 box. In interactive tclsh86, I can open com3 with: [open com3: r+] without any problem. But if I save the command to a file: anyname.tcl, for example. and run >tclsh anyname.tcl it will give: couldn't open "com3:": no such file or directory ...
I tried tcl85, same problem. but There is no problem with tclsh84.
a48b313b26When translating a reserved devicename to native pathname, strip ':' postfix. Possible fix for [dcc03414f5], but anyway a good idea. check-in2014-10-31 10:20:03198d89722aWhen translating a reserved devicename to native pathname, strip ':' postfix. Possible fix for [dcc03414f5], but anyway a good idea. check-in2014-10-31 09:59:3635aa29eca7Revert bug-fix for [2413550], in order to be able to investigate whether it caused [dcc03414f5] or not. It turned out that "com3" is ok but not "com3:", thanks, branch closed check-in2014-10-28 11:42:44
I strongly suspect that this bug is introduced with the fix for [2413550] (even though I don't have com3 so I can neither test nor reproduce this.
Can you test [35aa29eca7] (which simply reverts that patch), in order to verify this theory? Assigning to Harald. Feedback from any other person who was involved with [2413550] appreciated!
I got errors while compiling the version. http://core.tcl.tk/tcl/artifact/8714d30185695cd50aebdcd7adc8c2709eccf442
Checkout [35aa29eca7] compiles file with MinGW, MinGW-w64 and VS2012. I suspect you compiled with MSVC 6.0, which doesn't work out-of-the box. You will need the latest Windows PSDK which works with VC++ 6.0 (whatever that is ....) as well.
good news. ~ I compiled and tested OK. Thank you for your help. and when i can get the official release with this bug fix?
I don't have time to look into the source code now. I tried latest release of tcl8.6.2 on another machine (win7/32). [open comX: r+] failed on both interactive and non-interactive mode(script) with usb-serial cable (virtual com port X), no problem with tcl8.4.
Hi Ill, well, the initial issue was similar to yours and the now reverted patch is IMHO a good thing. We have to find out why it fails when run with a script and not when run interactively. So, no direct revert I suppose, sorry. The fix was delivered by another person. I will try to contact him and get direct communication. As serial com adapter drivers tend to be buggy and often do not supporte the full serial api (no control lines etc), it would be helpful to know the type of the adaptor and the driver version. Due to this fact, only you can test, sorry. Thank you, Harald
Branch [bug-dcc03414f5] was meant to investigate whether [2413550] caused this regression or not. It was not meant to be merged to trunk. Since III now confirmed that [bug-dcc03414f5] fixes his problem, we are now sure on which commit caused the regression. Should be investigated before taking further action.
Phil Hoffman pointed out that the correct name is "com3" not "com3". This might be the explanation... LLL, may you please check ? Thank you, Harald
Sorry, last post was a ":" missing:
Wrong: "COM3:"
Correct: "COM3" or "com3" or "Com3"...
Sorry,
Harald
Here is the log of Phil:
Under wish86:
(System32) 18 % set fp [open COM3 r+]
file1f84670
(System32) 19 % close $fp
(System32) 20 % set fp [open COM3: r+]
couldn't open "COM3:": no such file or directory
(System32) 21 % set fp [open //./COM3 r+]
file1f84770
(System32) 22 % close $fp
(System32) 23 % set fp [open {\\.\COM3} r+]
file1f84770
(System32) 24 % close $fp
(System32) 25 % set fp [open //./COM3: r+]
couldn't open "//./COM3:": no such file or directory
(System32) 26 % set fp [open {\\.\COM3:} r+]
couldn't open "\\.\COM3:": no such file or directory
(System32) 27 % info patchlevel
8.6.2
(System32) 28 %
Interesting enough, under tclsh
PS C:\Users\Phil> tclsh
% set fp [open COM3: r+]
file150ac50
% close $fp
% info patchlevel
8.6.2
Good news. I can also open the virtual port [com3] without the ":" suffix in my script with version 8.6.2. It looks like I have found a work around and don't have to revert whole things back to version 8.4. Good job! Thanks, LLL
The issue is, that "COM3:" is not accepted, while "COM3" is. It is not clear why this is the case as the patch explicitly does cover this case.
But anyway, Jan has prepared the patch [25a624797c] to remove the ":" for all system calls, which is the recommended action for windows.
This works well for me. I am not sure if we should document, that "com3" and "com3:" actually works, as the open man page only states "com3:".
Harald
Hi, It seems that this version can open both valid comX with or without ":". There is no feed back (exception) if I give a invalid com number with ":", see logs below~ D:\Tcl_Source_Code-25a624797c\win\Release_VC10>tclsh85.exe % open com3 r+ filea03ef8 % close filea03ef8 % open com3: r+ filea03ef8 % close filea03ef8 % open com30 r+ couldn't open "com30": no such file or directory % open com30: r+ %
Thanks, LL L, for testing. I suppose with the "COM30:", you hit another bug not related to that. With "COM30" you don't open a serial port but a regular file. With "COM30:", I dont know what this is and why there is just no answer... Thank you, Harald
I have retried the "open COM30: r+" issue. It raises an error with an empty error message:
% open COM30: r+
% set errorInfo
while executing
"open COM30: r+"
This issue rises for the following versions for me:
- TCL 8.5.16
- TCL 8.5.17
and not in
- TCL 8.4.20
- TCL 8.5.12
- current 8-5-branch (exe I have sent around)
- TCL 8.6.1
- TCL 8.6.3rc1
So I suppose, this issue was cured in the meanwhile.
Thanks, LL L, for testing! Indeed error-message was empty when the filename contains invalid characters. On Windows ':' in a filename is invalid if it is not part of an extended device or a drive prefix. Fixed in core-8-5-branch and trunk.