winpr-comm: slightly improved GetCommProperties()

This commit is contained in:
Emmanuel Ledoux
2014-05-06 16:45:05 +02:00
parent c2b024512a
commit ff4d7d569b
3 changed files with 38 additions and 10 deletions

View File

@@ -163,6 +163,21 @@ typedef struct _SERIAL_HANDFLOW
#define SERIAL_XOFF_CONTINUE ((ULONG)0x80000000)
#define SERIAL_FLOW_INVALID ((ULONG)0x7fffff20)
#define SERIAL_SP_SERIALCOMM ((ULONG)0x00000001)
#define SERIAL_SP_UNSPECIFIED ((ULONG)0x00000000)
#define SERIAL_SP_RS232 ((ULONG)0x00000001)
#define SERIAL_SP_PARALLEL ((ULONG)0x00000002)
#define SERIAL_SP_RS422 ((ULONG)0x00000003)
#define SERIAL_SP_RS423 ((ULONG)0x00000004)
#define SERIAL_SP_RS449 ((ULONG)0x00000005)
#define SERIAL_SP_MODEM ((ULONG)0X00000006)
#define SERIAL_SP_FAX ((ULONG)0x00000021)
#define SERIAL_SP_SCANNER ((ULONG)0x00000022)
#define SERIAL_SP_BRIDGE ((ULONG)0x00000100)
#define SERIAL_SP_LAT ((ULONG)0x00000101)
#define SERIAL_SP_TELNET ((ULONG)0x00000102)
#define SERIAL_SP_X25 ((ULONG)0x00000103)
/**
* A function might be NULL if not supported by the underlying remote driver.

View File

@@ -22,6 +22,7 @@
#ifndef _WIN32
#include "comm_serial_sys.h"
#include "comm_sercx_sys.h"
#include "comm_sercx2_sys.h"

View File

@@ -142,23 +142,33 @@ static BOOL _get_properties(WINPR_COMM *pComm, COMMPROP *pProperties)
{
int i;
/* http://msdn.microsoft.com/en-us/library/windows/hardware/jj680684%28v=vs.85%29.aspx
* http://msdn.microsoft.com/en-us/library/windows/desktop/aa363189%28v=vs.85%29.aspx
*/
/* FIXME: properties should be better probe. The current
* implementation just relies on the Linux' implementation.
*/
// TMP: TODO:
// TMP: COMMPROP_INITIALIZED ?
// TMP: required?
// ZeroMemory(pProperties, sizeof(COMMPROP);
if (pProperties->dwProvSpec1 != COMMPROP_INITIALIZED)
{
ZeroMemory(pProperties, sizeof(COMMPROP));
pProperties->wPacketLength = sizeof(COMMPROP);
}
/* pProperties->PacketLength; */
/* pProperties->PacketVersion; */
/* pProperties->ServiceMask; */
/* pProperties->Reserved1; */
pProperties->wPacketVersion = 2;
pProperties->dwServiceMask = SERIAL_SP_SERIALCOMM;
/* pProperties->Reserved1; not used */
// TMP: FIXME: related to the UART's FIFO ?
/* pProperties->MaxTxQueue; */
/* pProperties->MaxRxQueue; */
pProperties->dwMaxBaud = SERIAL_BAUD_115200; /* _SERIAL_MAX_BAUD */
/* FIXME: what about PST_RS232? */
@@ -182,11 +192,13 @@ static BOOL _get_properties(WINPR_COMM *pComm, COMMPROP *pProperties)
pProperties->wSettableStopParity = STOPBITS_10 | /*STOPBITS_15 |*/ STOPBITS_20 | PARITY_NONE | PARITY_ODD | PARITY_EVEN | PARITY_MARK | PARITY_SPACE;
// TMP: FIXME: related to the UART's FIFO ?
/* pProperties->CurrentTxQueue; */
/* pProperties->CurrentRxQueue; */
/* pProperties->ProvSpec1; */
/* pProperties->ProvSpec2; */
/* pProperties->ProvChar[1]; */
/* pProperties->ProvSpec1; see above */
/* pProperties->ProvSpec2; ignored */
/* pProperties->ProvChar[1]; ignored */
return TRUE;
}