[Bug 2469] New: G7ToWin fails to communicate with serial port

Wine Bugs wine-bugs at winehq.org
Mon Sep 6 00:58:41 CDT 2004


http://bugs.winehq.org/show_bug.cgi?id=2469

           Summary: G7ToWin fails to communicate with serial port
           Product: Wine
           Version: 20040813
          Platform: PC
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: wine-binary
        AssignedTo: wine-bugs at winehq.org
        ReportedBy: braun at egeen.ee


G7ToWin is using WriteFile to write the GPS commands out to the serial port:

WriteFile(hCom, msg, count, &bytes, NULL);

This is syncronous write --- non-overlapped i/o;

=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

In the NtWriteFile it is handled as asynchronous i/o, because the
FD_FLAG_TIMEOUT flag is set in the server/serial.c serial_get_info

Asynchronous i/o fails, because there is no overlapped structure assigned.
hEvent is NULL.

=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

My resolution:

--- dll/ntdll/file.c	2004-06-18 02:05:48.000000000 +0300
+++ dll/ntdll/file.c	2004-09-05 22:05:51.000000000 +0300
@@ -601,7 +601,7 @@
         return STATUS_PIPE_DISCONNECTED;
     }
 
-    if (flags & (FD_FLAG_OVERLAPPED|FD_FLAG_TIMEOUT))
+    if (flags & FD_FLAG_OVERLAPPED)
     {
         async_fileio*   ovp;
         NTSTATUS ret;


Only to enter to asynchronous i/o, when FD_FLAG_OVERLAPPED flag is set. Probably
some changes also needed in the server/serial.c serial_get_info --- my patch can
break the asynchronous write.

=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

wineserver log file:
> 0009: get_handle_fd( handle=0x2c, access=40000000 )
> 0009: get_handle_fd() = 0 { fd=12, type=1, flags=2 }
> 0009: register_async( handle=0x2c, type=2, overlapped=0x40320a68, count=8,
status=00000103 )
> 0009: register_async() = 0

ret = register_new_async(&ovp->async);

> 0009: select( flags=6, cookie=0x4068fa98, timeout=0, handles={(nil)} )
> 0009: select() = INVALID_HANDLE

NtWaitForSingleObject(hEvent, TRUE, NULL);
hEvent is NULL

> 0009: close_handle( handle=(nil) )
> 0009: close_handle() = INVALID_HANDLE { fd=0 }

NtClose(hEvent);
hEvent is NULL 


I hope this helps to fix this bug.
sy,
Urmo

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the wine-bugs mailing list