Artifacts Associated With Ticket 2413550
Ticket change [d19ad23a49] (rid 113384) by ferrieux on 2008-12-10 10:26:48:
- assignee initialized to: "andreas_kupries"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Currently, opening a serial port on Windows involves a double-open: (1) open generically (2) check the handle for serialness (3) reopen with OVERLAPPED flag if serial. This causes trouble in some setups where the open/close (and its timing) is not transparent to the underlying driver, like bluetooth RFCOMM profile. See http://groups.google.fr/group/comp.lang.tcl/tree/browse_frm/thread/9f2f29db7b5864fd/fd6d04dbc15d8575?rnum=1&_done=%2Fgroup%2Fcomp.lang.tcl%2Fbrowse_frm%2Fthread%2F9f2f29db7b5864fd%2Fdd17ccbb0019ed90%3F#doc_fd6d04dbc15d8575 for a concrete example. A simple and efficient solution is to use a "name hint" to detect COM ports by their filename instead of resorting to a syscall to detect serialness after the fact. Rolf Shroedter has suggested that at least the two following patterns should be detected: COM[0-9]:? \\.\COM[0-9]+:? It also turns out that the first one should be applied to the [file tail], since \foo\bar\COM4 is also a valid serial port reference in Windows. However, we believe that a good strategy should be to make only a reasonable effort in that direction, leaving tricky cases handled by the current behavior; this in order not to spoil the performance of [open] for non-serials. A patch will be uploaded shortly to support just the above two patterns. - foundin initialized to: "None"
- is_private initialized to: "0"
- priority initialized to: "8"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "ferrieux"
- subsystem initialized to: "27. Channel Types"
- title initialized to: "Avoid double-open of serial ports on Windows"
- type initialized to: "Patch"
Ticket change [3890368ef9] (rid 112230) by schroedter on 2008-12-11 21:42:32:
- icomment:
The following patch performes a "name hint" to detect native Windows serial port name by one of the following patterns (case-insensitive). Pattern matching is checked quite restrictive, because *all open-filenames* need to pass this test. COM[1-9]:? \\.\COM[0-9]+ //./COM[0-9]+ For all filenames not matching the patterns above, the original behavior open-close-reopen is preserved, thus supporting (virtual) comports of any other name: 1. Open channel with NON-OVERLAPPED flag 2. Detect serial port by checking GetCommState() result 3. Reopen the serial port with OVERLAPPED flag This behavior can be enforced even for native Windows serial ports e.g. with [open /com1 r+]
- login: "schroedter"
- mimetype: "text/plain"
- username: "schroedter"
- icomment:
Add attachment "no_double_serial_open.patch" [610be90398] (rid 92178) by ferrieux on 2008-12-11 21:45:40.
Ticket change [724e1d0756] (rid 100834) by ferrieux on 2008-12-11 21:45:40:
- icomment:
File Added - 304912: no_double_serial_open.patch File Added: no_double_serial_open.patch
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [4fea181e24] (rid 136620) by oehhar on 2014-01-30 11:04:54:
- assignee changed to: "aku"
- closer changed to: "nobody"
- comment changed to:
Currently, opening a serial port on Windows involves a double-open: (1) open generically (2) check the handle for serialness (3) reopen with OVERLAPPED flag if serial. This causes trouble in some setups where the open/close (and its timing) is not transparent to the underlying driver, like bluetooth RFCOMM profile. See http://groups.google.fr/group/comp.lang.tcl/tree/browse_frm/thread/9f2f29db7b5864fd/fd6d04dbc15d8575?rnum=1&_done=%2Fgroup%2Fcomp.lang.tcl%2Fbrowse_frm%2Fthread%2F9f2f29db7b5864fd%2Fdd17ccbb0019ed90%3F#doc_fd6d04dbc15d8575 for a concrete example. A simple and efficient solution is to use a "name hint" to detect COM ports by their filename instead of resorting to a syscall to detect serialness after the fact. Rolf Shroedter has suggested that at least the two following patterns should be detected: COM[0-9]:? \\.\COM[0-9]+:? It also turns out that the first one should be applied to the [file tail], since \foo\bar\COM4 is also a valid serial port reference in Windows. However, we believe that a good strategy should be to make only a reasonable effort in that direction, leaving tricky cases handled by the current behavior; this in order not to spoil the performance of [open] for non-serials. A patch will be uploaded shortly to support just the above two patterns. - icomment: "Patch applied for tcl 8.5 in branch [84307fe13f]"
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- severity changed to: "Minor"
- username: "oehhar"
Ticket change [5776ddc74a] (rid 136882) by oehhar on 2014-02-14 07:59:55:
- icomment:
Action by Phil Hoffman: * branch bug-2413550: [024a523361] successfully tested * Tested patch for tcl8.6.1 provided
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- username: "oehhar"
- icomment:
Add attachment "tcl8.6.1-bug-2413550.diff" [1586b1350f] (rid 136884) by oehhar on 2014-02-14 08:01:23.
Ticket change [5f550355ff] (rid 136894) by dkf on 2014-02-15 15:12:21:
- icomment:
Should we add any tests? Should we add any docs? (With these settled, I see no reason to not commit.)
- login: "dkf"
- mimetype: "text/html"
- username: "dkf"
- icomment:
Ticket change [2b1a24d168] (rid 136950) by oehhar on 2014-02-18 19:55:32:
- icomment:
Thank you, Donal, for the comment. Tests: * As the issue only appears with special hardware, this is imho not possible Docs: * IMHO the docs are sufficient. On the open man page, the windows formats for serial ports are specified as "comx:" and "\\.\comx" which are the supported formats by the patch. So we do not need an alert, that "exotic but possible" file names for serial ports are not supported by hardware not supporting the double open (which is rare). * The only enhancement on the man page would be to remove all the Windows 95 and Windows 98 parts. I was ready to commit today, but have test failures. I have to check, if they are due to the patch or not... Sorry, will take a week (I am on travel). Harald
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- username: "oehhar"
- icomment:
Add attachment "serialTest.tcl" [bf2444911e] (rid 137077) by oehhar on 2014-02-25 17:06:55.
Ticket change [0f7bd6e2f2] (rid 137078) by oehhar on 2014-02-25 17:12:06:
- assignee changed to: "oehhar"
- closedate changed to: "2456714.21674292"
- closer changed to: "oehhar"
- icomment:
Merged to core-8-5-branch [b6459ef66c] and to trunk [eb0919a1ec]. Phil Hoffman tested succesfully with the attached script. Bug closed, thank you all, Harald
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "oehhar"