Redirected serial port returns error when accessed using DotNet App

Symptoms

Redirected serial port returns error when accessed through DotNet application. Win32 application(custom app or the standard Hyperterm )  works ok with this same redirected serial port

Cause

DotNet application fails on IOCTL_SERIAL_SET_QUEUE_SIZE while communicating to a redirected serial port. This IOCTL sets queue size for communication devices. DotNet(managed application) requests queue size to be set at 4096 bytes. However Windows Embedded CE 6.0 R3 does not support IOCTL_SERIAL_SET_QUEUE_SIZE and returns ERROR_NOT_SUPPORTED, it maintains a fixed queue size (receive buffer) of 2048. Since this IOCTL is unsupported on Windows CE, the application will see an error when initializing the serial port.

Resolution

Modifying the serial driver’s return value for IOCTL_SERIAL_SET_QUEUE_SIZE in COM_IOControl() will resolve this issue, the change should be similar to the code below.

case IOCTL_SERIAL_SET_QUEUE_SIZE :

        SetLastError(ERROR_NOT_SUPPORTED);

        RetVal = TRUE;                                       

        break;
Thuộc tính

ID Bài viết: 2436129 - Xem lại Lần cuối: 12-10-2010 - Bản sửa đổi: 1

Phản hồi