winpr-comm: implemented IOCTL_SERIAL_RESET_DEVICE

This commit is contained in:
Emmanuel Ledoux 2014-06-17 17:49:06 +02:00 committed by Emmanuel Ledoux
parent ff9babed4e
commit 62d893b2bd
6 changed files with 21 additions and 3 deletions

View File

@ -417,7 +417,7 @@ WINPR_API HANDLE CommCreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD
#define IOCTL_SERIAL_SET_DTR 0x001B0024
#define IOCTL_SERIAL_CLR_DTR 0x001B0028
/* IOCTL_SERIAL_RESET_DEVICE 0x001B002C */
#define IOCTL_SERIAL_RESET_DEVICE 0x001B002C
#define IOCTL_SERIAL_SET_RTS 0x001B0030
#define IOCTL_SERIAL_CLR_RTS 0x001B0034
#define IOCTL_SERIAL_SET_XOFF 0x001B0038
@ -483,7 +483,7 @@ static const _SERIAL_IOCTL_NAME _SERIAL_IOCTL_NAMES[] =
{IOCTL_SERIAL_SET_CHARS, "IOCTL_SERIAL_SET_CHARS"},
{IOCTL_SERIAL_SET_DTR, "IOCTL_SERIAL_SET_DTR"},
{IOCTL_SERIAL_CLR_DTR, "IOCTL_SERIAL_CLR_DTR"},
// {IOCTL_SERIAL_RESET_DEVICE, "IOCTL_SERIAL_RESET_DEVICE"},
{IOCTL_SERIAL_RESET_DEVICE, "IOCTL_SERIAL_RESET_DEVICE"},
{IOCTL_SERIAL_SET_RTS, "IOCTL_SERIAL_SET_RTS"},
{IOCTL_SERIAL_CLR_RTS, "IOCTL_SERIAL_CLR_RTS"},
{IOCTL_SERIAL_SET_XOFF, "IOCTL_SERIAL_SET_XOFF"},

View File

@ -619,11 +619,19 @@ static BOOL _CommDeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID l
}
break;
}
case IOCTL_SERIAL_RESET_DEVICE:
{
if (pRemoteSerialDriver->reset_device)
{
return pRemoteSerialDriver->reset_device(pComm);
}
break;
}
}
DEBUG_WARN(_T("unsupported IoControlCode=[0x%lX] %s (remote serial driver: %s)"),
dwIoControlCode, _comm_serial_ioctl_name(dwIoControlCode), pRemoteSerialDriver->name);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED); /* => STATUS_NOT_IMPLEMENTED */
return FALSE;
}

View File

@ -243,6 +243,7 @@ typedef struct _REMOTE_SERIAL_DRIVER
BOOL (*get_dtrrts)(WINPR_COMM *pComm, ULONG *pMask);
BOOL (*config_size)(WINPR_COMM *pComm, ULONG *pSize);
BOOL (*immediate_char)(WINPR_COMM *pComm, const UCHAR *pChar);
BOOL (*reset_device)(WINPR_COMM *pComm);
} REMOTE_SERIAL_DRIVER;

View File

@ -153,6 +153,7 @@ static REMOTE_SERIAL_DRIVER _SerCx2Sys =
.get_dtrrts = NULL,
.config_size = NULL, /* not supported by SerCx2.sys */
.immediate_char = NULL, /* not supported by SerCx2.sys */
.reset_device = NULL, /* not supported by SerCx2.sys */
};

View File

@ -402,6 +402,7 @@ static REMOTE_SERIAL_DRIVER _SerCxSys =
.get_dtrrts = NULL,
.config_size = NULL, /* not supported by SerCx.sys */
.immediate_char = NULL,
.reset_device = NULL, /* not supported by SerCx.sys */
};

View File

@ -1506,6 +1506,12 @@ BOOL _immediate_char(WINPR_COMM *pComm, const UCHAR *pChar)
}
BOOL _reset_device(WINPR_COMM *pComm)
{
/* http://msdn.microsoft.com/en-us/library/dn265347%28v=vs.85%29.aspx */
return TRUE;
}
static REMOTE_SERIAL_DRIVER _SerialSys =
{
.id = RemoteSerialDriverSerialSys,
@ -1539,6 +1545,7 @@ static REMOTE_SERIAL_DRIVER _SerialSys =
.get_dtrrts = _get_dtrrts,
.config_size = _config_size,
.immediate_char = _immediate_char,
.reset_device = _reset_device,
};