http://bugs.winehq.org/show_bug.cgi?id=25083
Summary: HyperTerminal unable to loop back on COM1 (RS-232) Product: Wine Version: 1.3.6 Platform: x86-64 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown AssignedTo: wine-bugs@winehq.org ReportedBy: graham@nerve.org.za
On a machine with an on-board RS-232 port at COM1, HyperTerminal (as shipped with Windows XP) is firstly unable to detect the port until changes are made in the WINE registry, thereafter, after attaching a simple loopback adapter (pins 2 and 3 of a DB9F shorted) no characters are echoed to the screen.
Obtaining the software:
From a Windows XP installation, copy the files hypertrm.exe and htrn_jis.dll
from 'C:\Program Files\Windows NT' and hticons.dll and hypertrm.dll from C:\Windows\System32' into a suitable directory below .wine/drive_c
or
Download a free 30 day trial of HyperTerminal Private Edition 7.0 from http://www.hilgraeve.com/hyperterminal/
Create a symbolic link for COM1, documented here: http://www.winehq.org/docs/wineusr-guide/misc-things-to-configure ln -s /dev/ttyS0 ~/.wine/dosdevices/com1
At this point, starting HyperTerminal will result in no serial ports being shown.
Now, create a registry entry in WINE for the serial port, mentioned in this bug report: http://bugs.winehq.org/show_bug.cgi?id=4282 Add the following lines to .wine/system.reg [Hardware\Devicemap\SerialComm] "Serial0"="COM1"
Now HyperTerminal can be started, COM1 can be selected and configured, but no characters are echoed to the screen.
However, the free terminal program, simply named 'Terminal' and available here: https://sites.google.com/site/terminalbpp/ Does echo characters to the screen.
http://bugs.winehq.org/show_bug.cgi?id=25083
--- Comment #1 from Graham Inggs graham@nerve.org.za 2010-11-09 09:58:10 CST --- Created an attachment (id=31804) --> (http://bugs.winehq.org/attachment.cgi?id=31804) Sample HyperTerminal configuration file for COM1
This sample HyperTerminal configuration can be specified when starting the program as follows: wine hypertrm.exe direct_com1.ht
http://bugs.winehq.org/show_bug.cgi?id=25083
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, hardware URL| |http://www.hilgraeve.com/hy | |perterminal/
http://bugs.winehq.org/show_bug.cgi?id=25083
Graham Inggs graham@nerve.org.za changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #31804|0 |1 is obsolete| |
--- Comment #2 from Graham Inggs graham@nerve.org.za 2010-11-12 07:10:01 CST --- Created an attachment (id=31874) --> (http://bugs.winehq.org/attachment.cgi?id=31874) Sample HyperTerminal configuration file for COM1
http://bugs.winehq.org/show_bug.cgi?id=25083
--- Comment #3 from Graham Inggs graham@nerve.org.za 2010-11-12 07:18:08 CST --- Created an attachment (id=31875) --> (http://bugs.winehq.org/attachment.cgi?id=31875) Terminal PortMon Log
Log file captured by PortMon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) of Terminal.exe starting and sending the characters '12345'. Run on native Windows XP.
http://bugs.winehq.org/show_bug.cgi?id=25083
--- Comment #4 from Graham Inggs graham@nerve.org.za 2010-11-12 07:19:19 CST --- Created an attachment (id=31876) --> (http://bugs.winehq.org/attachment.cgi?id=31876) HyperTerminal PortMon Log
Log file captured by PortMon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) of hypertrm.exe starting and sending the characters '12345'. Run on native Windows XP.
http://bugs.winehq.org/show_bug.cgi?id=25083
--- Comment #5 from Graham Inggs graham@nerve.org.za 2010-11-12 07:26:01 CST --- The attachments 'Terminal PortMon Log' and 'HyperTerminal PortMon Log' were captured using the program PortMon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) running on native Windows XP.
In each case I waited approximately 5 seconds before sending the string '12345'. Notice how Terminal continually attempts to read from the serial0, which times out after 2ms, then checks the modem status lines. Compare this to how HyperTerminal's read from serial0 does not time out, it completes after 5.5s when the first character is echoed back.
http://bugs.winehq.org/show_bug.cgi?id=25083
--- Comment #6 from Graham Inggs graham@nerve.org.za 2010-11-12 07:27:46 CST --- The attachments 'Terminal PortMon Log' and 'HyperTerminal PortMon Log' were captured using the program PortMon ( http://technet.microsoft.com/en-us/sysinternals/bb896644.aspx ) running on native Windows XP.
In each case I waited approximately 5 seconds before sending the string '12345'. Notice how Terminal continually attempts to read from the serial0, which times out after 2ms, then checks the modem status lines. Compare this to how HyperTerminal's read from serial0 does not time out, it completes after 5.5s when the first character is echoed back.
http://bugs.winehq.org/show_bug.cgi?id=25083
--- Comment #7 from Graham Inggs graham@nerve.org.za 2010-11-12 07:33:09 CST --- I connected an oscilloscope to the serial port while running HyperTerminal on Wine 1.3.6. I noticed that characters were being sent out of the port while a key was held down, but they were not echoed back to the screen.
While holding a key down to get a good trace on the 'scope I received a burst of characters on the screen. I then found that this burst occurs approximately every three seconds.
http://bugs.winehq.org/show_bug.cgi?id=25083
--- Comment #8 from Graham Inggs graham@nerve.org.za 2011-03-15 05:37:59 CDT --- Problem still occurring in WINE 1.3.15.
HyperTerminal Private Edition 6.3, which is free for personal and educational use, can be downloaded here: http://www.hilgraeve.com/htpe/support/htpe63.exe
http://bugs.winehq.org/show_bug.cgi?id=25083
Graham Inggs graham@nerve.org.za changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|1.3.6 |1.3.15
http://bugs.winehq.org/show_bug.cgi?id=25083
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|1.3.15 |1.3.6
--- Comment #9 from Dmitry Timoshkov dmitry@codeweavers.com 2011-03-15 06:25:11 CDT --- Adding a comment (without changing an originally reported Wine version) is enough.
http://bugs.winehq.org/show_bug.cgi?id=25083
--- Comment #10 from Graham Inggs graham@nerve.org.za 2011-06-01 08:36:25 CDT --- Problem still occurring in WINE 1.3.21.
http://bugs.winehq.org/show_bug.cgi?id=25083
Graham Inggs graham@nerve.org.za changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1
--- Comment #11 from Graham Inggs graham@nerve.org.za 2011-08-09 02:02:52 CDT --- *** This bug has been confirmed by popular vote. ***
http://bugs.winehq.org/show_bug.cgi?id=25083
--- Comment #12 from Graham Inggs graham@nerve.org.za 2011-08-10 05:17:12 CDT --- Problem still occurring in WINE 1.3.26.
http://bugs.winehq.org/show_bug.cgi?id=25083
--- Comment #13 from Graham Inggs graham@nerve.org.za 2011-11-18 04:30:38 CST --- Problem still occurring in WINE 1.3.32.
http://bugs.winehq.org/show_bug.cgi?id=25083
--- Comment #14 from Graham Inggs graham@nerve.org.za 2011-12-08 08:31:22 CST --- Could be related to bug 19713?
http://bugs.winehq.org/show_bug.cgi?id=25083
--- Comment #15 from Graham Inggs graham@nerve.org.za 2012-05-10 07:09:39 CDT --- Still occurring in WINE 1.5.3.
http://bugs.winehq.org/show_bug.cgi?id=25083
Graham Inggs graham@nerve.org.za changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |graham@nerve.org.za
http://bugs.winehq.org/show_bug.cgi?id=25083
--- Comment #16 from Graham Inggs graham@nerve.org.za 2013-03-05 03:58:05 CST --- Still occurring in WINE 1.5.25.
https://bugs.winehq.org/show_bug.cgi?id=25083
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |00cpxxx@gmail.com
--- Comment #17 from Bruno Jesus 00cpxxx@gmail.com --- Still in wine 1.7.33.
https://bugs.winehq.org/show_bug.cgi?id=25083
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |focht@gmx.net Component|-unknown |ntdll Summary|HyperTerminal unable to |HyperTerminal 6.3 is unable |loop back on COM1 (RS-232) |to receive characters with | |serial port loop back setup
--- Comment #18 from Anastasius Focht focht@gmx.net --- Hello folks,
confirming.
--- snip --- $ pwd /home/focht/.wine/drive_c/Program Files/Windows NT/HyperTerminal
$ WINEDEBUG=+tid,+seh,+relay,+tapi,+comm wine ./HyperTrm.exe >>log.txt 2>&1 ... 0023:Call KERNEL32.CreateFileA(0033f3a4 "\\.\com1",c0000000,00000000,00000000,00000003,40000000,00000000) ret=10038503 0023:Ret KERNEL32.CreateFileA() retval=000000cc ret=10038503 0023:Call KERNEL32.SetupComm(000000cc,00002000,00002000) ret=10038589 0023:trace:comm:io_control 0xcc IOCTL_SERIAL_SET_QUEUE_SIZE 0x33f328 8 (nil) 0 0x33f2b0 0023:fixme:comm:set_queue_size insize 8192 outsize 8192 unimplemented stub 0023:Ret KERNEL32.SetupComm() retval=00000001 ret=10038589 0023:Call KERNEL32.GetCommConfig(000000cc,0033f324,0033f380) ret=10038734 ... 0023:trace:comm:GetCommState OK 0023:trace:comm:dump_dcb bytesize=8 baudrate=115200 fParity=0 Parity=0 stopbits=1 0023:trace:comm:dump_dcb ~IXON ~IXOFF 0023:trace:comm:dump_dcb fOutxCtsFlow=0 fRtsControl=1 0023:trace:comm:dump_dcb fOutxDsrFlow=0 fDtrControl=1 0023:trace:comm:dump_dcb ~CRTSCTS 0023:Ret KERNEL32.GetCommConfig() retval=00000001 ret=10038734 0023:Call KERNEL32.SetCommConfig(000000cc,0033f324,00000034) ret=1003878a 0023:trace:comm:SetCommConfig (0xcc, 0x33f324, 52) 0023:trace:comm:dump_dcb bytesize=8 baudrate=115200 fParity=1 Parity=0 stopbits=1 0023:trace:comm:dump_dcb ~IXON ~IXOFF 0023:trace:comm:dump_dcb fOutxCtsFlow=0 fRtsControl=1 0023:trace:comm:dump_dcb fOutxDsrFlow=0 fDtrControl=1 0023:trace:comm:dump_dcb ~CRTSCTS ... 0023:Ret KERNEL32.SetCommConfig() retval=00000001 ret=1003878a 0023:Call KERNEL32.SetCommTimeouts(000000cc,0033f36c) ret=100387d4 0023:trace:comm:SetCommTimeouts (0xcc, 0x33f36c) 0023:trace:comm:io_control 0xcc IOCTL_SERIAL_SET_TIMEOUTS 0x33f290 20 (nil) 0 0x33f210 0023:Ret KERNEL32.SetCommTimeouts() retval=00000001 ret=100387d4 0023:Call KERNEL32.GetCommTimeouts(000000cc,0033f358) ret=100387ed 0023:trace:comm:GetCommTimeouts (0xcc, 0x33f358) 0023:trace:comm:io_control 0xcc IOCTL_SERIAL_GET_TIMEOUTS (nil) 0 0x33f290 20 0x33f210 0023:Ret KERNEL32.GetCommTimeouts() retval=00000001 ret=100387ed 0023:Call KERNEL32.SetCommMask(000000cc,000000a0) ret=100385d7 0023:trace:comm:SetCommMask handle 0xcc, mask a0 0023:trace:comm:io_control 0xcc IOCTL_SERIAL_SET_WAIT_MASK 0x33f364 4 (nil) 0 0x33f2b0 0023:Ret KERNEL32.SetCommMask() retval=00000001 ret=100385d7 0023:Call KERNEL32.CreateThread(00000000,000007d0,10038cd1,0042fdc8,00000000,0033f4a8) ret=10038619 0023:Ret KERNEL32.CreateThread() retval=000000d0 ret=10038619 0023:Call KERNEL32.SetThreadPriority(000000d0,00000001) ret=1003862b ... 0026:Starting thread proc 0x10038cd1 (arg=0x42fdc8) ... 0026:Call KERNEL32.SetEvent(000000a0) ret=10038d07 0026:Ret KERNEL32.SetEvent() retval=00000001 ret=10038d07 ... 0026:Call KERNEL32.SetEvent(0000009c) ret=10038d0f 0026:Ret KERNEL32.SetEvent() retval=00000001 ret=10038d0f ... 0026:Call KERNEL32.ResetEvent(000000a4) ret=10038d1b 0026:Ret KERNEL32.ResetEvent() retval=00000001 ret=10038d1b ... 0026:Call KERNEL32.WaitForMultipleObjects(00000003,0042fecc,00000000,ffffffff) ret=10038d36 0026:Ret KERNEL32.WaitForMultipleObjects() retval=00000000 ret=10038d36 ... 0026:Call KERNEL32.WaitCommEvent(000000cc,00a3ea24,00a3ea48) ret=10038ffa ... 0026:trace:comm:io_control 0xcc IOCTL_SERIAL_WAIT_ON_MASK (nil) 0 0xa3ea24 4 0xa3ea48 ... 0026:trace:comm:get_irq_info TIOCGICOUNT err Inappropriate ioctl for device 0026:trace:comm:get_irq_info TIOCSERGETLSR err Inappropriate ioctl for device 0026:trace:comm:get_modem_status 0166 -> MS_RLSD_ON MS_DSR_ON MS_CTS_ON 0026:trace:comm:check_events mask 0x000000a0 0026:trace:comm:check_events old->rx 0x00000000 vs. new->rx 0x00000000 0026:trace:comm:check_events old->tx 0x00000000 vs. new->tx 0x00000000 0026:trace:comm:check_events old->frame 0x00000000 vs. new->frame 0x00000000 0026:trace:comm:check_events old->overrun 0x00000000 vs. new->overrun 0x00000000 0026:trace:comm:check_events old->parity 0x00000000 vs. new->parity 0x00000000 0026:trace:comm:check_events old->brk 0x00000000 vs. new->brk 0x00000000 0026:trace:comm:check_events old->buf_overrun 0x00000000 vs. new->buf_overrun 0x00000000 0026:trace:comm:check_events old->temt 0x00000001 vs. new->temt 0x00000001 ... 0026:Ret KERNEL32.WaitCommEvent() retval=00000000 ret=10038ffa 0026:Call KERNEL32.GetLastError() ret=10039015 0026:Ret KERNEL32.GetLastError() retval=000003e5 ret=10039015 ... 0026:Call KERNEL32.WaitForMultipleObjects(00000003,0042fecc,00000000,ffffffff) ret=10038d36 ... 0027:Starting thread proc 0x7bc8f895 (arg=(nil)) 0027:trace:comm:wait_for_event device=0xcc fd=0x0000000f mask=0x000000a0 buffer=0xa3ea24 event=0x9c irq_info=0x14f628 ... 0027:trace:comm:get_irq_info TIOCGICOUNT err Inappropriate ioctl for device 0027:trace:comm:get_irq_info TIOCSERGETLSR err Inappropriate ioctl for device 0027:trace:comm:get_modem_status 0166 -> MS_RLSD_ON MS_DSR_ON MS_CTS_ON 0027:trace:comm:check_events mask 0x000000a0 0027:trace:comm:check_events old->rx 0x00000000 vs. new->rx 0x00000000 0027:trace:comm:check_events old->tx 0x00000000 vs. new->tx 0x00000000 0027:trace:comm:check_events old->frame 0x00000000 vs. new->frame 0x00000000 0027:trace:comm:check_events old->overrun 0x00000000 vs. new->overrun 0x00000000 0027:trace:comm:check_events old->parity 0x00000000 vs. new->parity 0x00000000 0027:trace:comm:check_events old->brk 0x00000000 vs. new->brk 0x00000000 0027:trace:comm:check_events old->buf_overrun 0x00000000 vs. new->buf_overrun 0x00000000 0027:trace:comm:check_events old->temt 0x00000001 vs. new->temt 0x00000001 ... 0026:Ret KERNEL32.WaitForMultipleObjects() retval=00000001 ret=10038d36 ... 0026:Call KERNEL32.ReadFile(000000cc,00432be8,00000050,00a3ea18,00a3ea34) ret=10038f1c ... 0026:trace:comm:io_control 0xcc IOCTL_SERIAL_GET_TIMEOUTS (nil) 0 0xa3e788 20 0xa3e780 ... 0026:Ret KERNEL32.ReadFile() retval=00000000 ret=10038f1c 0026:Call KERNEL32.GetLastError() ret=10038f53 ... 0026:Ret KERNEL32.GetLastError() retval=000003e5 ret=10038f53 ... 0026:Call KERNEL32.WaitForMultipleObjects(00000003,0042fecc,00000000,ffffffff) ret=10038d36 ... --- snip ---
There are 3 events being waited on:
WAIT_OBJECT_0+0 = modem status event WAIT_OBJECT_0+1 = read event (overlapped i/o) WAIT_OBJECT_0+2 = write event (overlapped i/o)
The app signals the first two events on its own to initiate I/O operations (WaitCommEvent and ReadFile).
WaitCommEvent results in a modem status APC being queued and executed continuously on thread 0027 which is *not* the initiating thread.
ReadFile causes an async read operation registered at server for APC_ASYNC_IO completion.
The write use-case (3rd event) works: 'WriteFile' issued from thread 0025, the completion is fulfilled on thread 0026.
--- snip --- 0025:Call KERNEL32.WriteFile(000000cc,004331d0,00000001,0093e938,0042fe38) ret=10038b67 ... 0026:Ret KERNEL32.WaitForMultipleObjects() retval=00000002 ret=10038d36 ... 0025:Ret KERNEL32.WriteFile() retval=00000001 ret=10038b67 ... 0025:Call KERNEL32.SetEvent(00000098) ret=100045b3 ... 0026:Call KERNEL32.GetOverlappedResult(000000cc,0042fe38,00a3ea20,00000000) ret=10038d7c ... 0026:Ret KERNEL32.GetOverlappedResult() retval=00000001 ret=10038d7c 0026:Call KERNEL32.SetEvent(00000098) ret=100045b3 ... 0026:Ret KERNEL32.SetEvent() retval=00000001 ret=100045b3 ... 0026:Call KERNEL32.ResetEvent(000000a4) ret=10038e23 0026:Ret KERNEL32.ResetEvent() retval=00000001 ret=10038e23 0026:Call KERNEL32.WaitForMultipleObjects(00000003,0042fecc,00000000,ffffffff) ret=10038d36 ... 0026:Ret KERNEL32.WaitForMultipleObjects() retval=00000002 ret=10038d36 ... --- snip ---
The read use-case from another run, with additional server/ntdll debug channel and custom trace added.
Debugging APCs on the client side is kind of hit-and-miss. Adding custom debug traces is the best option here to avoid crashes and/or nested exceptions during debugging of APC invocation.
--- snip --- ... 0026: register_async( type=1, async={handle=00cc,event=00a0,callback=7bc45206,iosb=00a3ea34,arg=00158490,cvalue=00a3ea34}, count=80 ) 0026: register_async() = PENDING 0026:trace:ntdll:NtReadFile = 0x00000103 0026:Ret KERNEL32.ReadFile() retval=00000000 ret=10038f1c 0026:Call KERNEL32.GetLastError() ret=10038f53 0026:Ret KERNEL32.GetLastError() retval=000003e5 ret=10038f53 0026:Call KERNEL32.WaitForMultipleObjects(00000003,0042fecc,00000000,ffffffff) ret=10038d36 0026: select( flags=2, cookie=00a3e69c, timeout=infinite, prev_apc=0000, result={}, data={WAIT,handles={009c,00a0,00a4}} ) 0026: select() = PENDING { timeout=infinite, call={APC_NONE}, apc_handle=0000 } ... <keypress in Minicom on other serial port, loopback> ... 0026: *wakeup* signaled=192 ... 0026: select( flags=2, cookie=00a3e69c, timeout=infinite, prev_apc=0000, result={}, data={WAIT,handles={009c,00a0,00a4}} ) 0026: select() = USER_APC { timeout=infinite, call={APC_ASYNC_IO,func=7bc45206,user=00158490,sb=00a3ea34,status=ALERTED}, apc_handle=00d4 } ... 0026:trace:ntdll:FILE_AsyncReadService read=1, fileio->already=1, fileio->count=80 0026:trace:ntdll:FILE_AsyncReadService status=0x103 ... 0026: select( flags=2, cookie=00a3e69c, timeout=infinite, prev_apc=00d4, result={APC_ASYNC_IO,status=PENDING,total=0,apc=00000000}, data={WAIT,handles={009c,00a0,00a4}} ) 0026: select() = PENDING { timeout=infinite, call={APC_NONE}, apc_handle=0000 } ... <blocks until next keypress> ... 0026: *wakeup* signaled=192 0026:trace:server:server_select ret2=0xc0 0026: select( flags=2, cookie=00a3e68c, timeout=infinite, prev_apc=0000, result={}, data={WAIT,handles={009c,00a0,00a4}} ) 0026: select() = USER_APC { timeout=infinite, call={APC_ASYNC_IO,func=7bc45206,user=001578b0,sb=00a3ea34,status=ALERTED}, apc_handle=00d4 } --- snip ---
The data from serial port is read through the client side invoked user APC (see added 'FILE_AsyncReadService' trace).
The second 'select' call, which is needed to determine the signalled wait object/event for exiting 'NtWaitForMultipleObjects' doesn't work here. It blocks in 'wait_select_reply' -> 'read', only to be unblocked by another APC_ASYNC_IO, triggered by next keypress.
Source: http://source.winehq.org/git/wine.git/blob/8d817997cea784bcf784759e1d3aa93c5...
$ sha1sum htpe63.exe 091514cf4c177d8700ce2cbae1fd80bda0ece7d8 htpe63.exe
$ du -sh htpe63.exe 1.3M htpe63.exe
$ wine --version wine-1.7.33
Regards
https://bugs.winehq.org/show_bug.cgi?id=25083
--- Comment #19 from Graham Inggs graham@nerve.org.za --- I've just tried HyperTerminal Private Edition 6.3 on Wine 1.7.50 and now it crashes with 'page fault on write access' about 5 seconds after opening a connection.
https://bugs.winehq.org/show_bug.cgi?id=25083
Zeb Figura z.figura12@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|ntdll |serial