winpr-comm: renamed waitMask WaitEventMask
winpr-comm: removed ReadIrpQueue
This commit is contained in:
parent
a36467c353
commit
5dc21b5604
@ -150,10 +150,6 @@ static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp)
|
||||
* details, a command line argument? */
|
||||
/* _comm_set_permissive(serial->hComm, TRUE); */
|
||||
|
||||
/* FIXME: this stinks, see also IOCTL_SERIAL_PURGE */
|
||||
// TMP: to be removed
|
||||
//_comm_set_ReadIrpQueue(serial->hComm, serial->ReadIrpQueue);
|
||||
|
||||
/* NOTE: binary mode/raw mode required for the redirection. On
|
||||
* Linux, CommCreateFileA forces this setting.
|
||||
*/
|
||||
|
@ -536,8 +536,6 @@ const char* _comm_serial_ioctl_name(ULONG number);
|
||||
*/
|
||||
BOOL _comm_set_permissive(HANDLE hDevice, BOOL permissive);
|
||||
|
||||
void _comm_set_ReadIrpQueue(HANDLE hComm, wMessageQueue* ReadIrpQueue);
|
||||
|
||||
|
||||
/**
|
||||
* FIXME: to be moved in comm_ioctl.h
|
||||
|
@ -1175,10 +1175,4 @@ HANDLE CommCreateFileA(LPCSTR lpDeviceName, DWORD dwDesiredAccess, DWORD dwShare
|
||||
}
|
||||
|
||||
|
||||
/* FIXME: to be removed */
|
||||
void _comm_set_ReadIrpQueue(HANDLE hComm, wMessageQueue* ReadIrpQueue)
|
||||
{
|
||||
((WINPR_COMM*)hComm)->ReadIrpQueue = ReadIrpQueue;
|
||||
}
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
@ -59,10 +59,6 @@ struct winpr_comm
|
||||
// TMP: to be renamed serverSerialDriverId
|
||||
REMOTE_SERIAL_DRIVER_ID remoteSerialDriverId;
|
||||
|
||||
wMessageQueue* ReadIrpQueue; /* considered as optional since it is
|
||||
* defined outside of CommCreateFile
|
||||
* FIXME: how to remove this shortcut? */
|
||||
|
||||
COMMTIMEOUTS timeouts;
|
||||
|
||||
/* NB: no synchronization required on counters until _get_commstatus()
|
||||
@ -71,7 +67,7 @@ struct winpr_comm
|
||||
struct serial_icounter_struct counters;
|
||||
|
||||
/* TMP: TODO: sync */
|
||||
ULONG waitMask; /* TMP: to be renamed EventMask */
|
||||
ULONG WaitEventMask;
|
||||
ULONG PendingEvents;
|
||||
|
||||
/* NB: CloseHandle() has to free resources */
|
||||
|
@ -84,7 +84,7 @@ static BOOL _set_wait_mask(WINPR_COMM *pComm, const ULONG *pWaitMask)
|
||||
DEBUG_WARN("Not all wait events supported (SerCx2.sys), requested events= 0X%lX, possible events= 0X%lX", *pWaitMask, possibleMask);
|
||||
|
||||
/* FIXME: shall we really set the possibleMask and return FALSE? */
|
||||
pComm->waitMask = possibleMask;
|
||||
pComm->WaitEventMask = possibleMask;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -359,7 +359,7 @@ static BOOL _set_wait_mask(WINPR_COMM *pComm, const ULONG *pWaitMask)
|
||||
DEBUG_WARN("Not all wait events supported (SerCx.sys), requested events= 0x%lX, possible events= 0x%lX", *pWaitMask, possibleMask);
|
||||
|
||||
/* FIXME: shall we really set the possibleMask and return FALSE? */
|
||||
pComm->waitMask = possibleMask;
|
||||
pComm->WaitEventMask = possibleMask;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1041,18 +1041,18 @@ static BOOL _set_wait_mask(WINPR_COMM *pComm, const ULONG *pWaitMask)
|
||||
DEBUG_WARN("Not all wait events supported (Serial.sys), requested events= 0X%lX, possible events= 0X%lX", *pWaitMask, possibleMask);
|
||||
|
||||
/* FIXME: shall we really set the possibleMask and return FALSE? */
|
||||
pComm->waitMask = possibleMask;
|
||||
pComm->WaitEventMask = possibleMask;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pComm->waitMask = possibleMask;
|
||||
pComm->WaitEventMask = possibleMask;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static BOOL _get_wait_mask(WINPR_COMM *pComm, ULONG *pWaitMask)
|
||||
{
|
||||
*pWaitMask = pComm->waitMask;
|
||||
*pWaitMask = pComm->WaitEventMask;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1097,35 +1097,23 @@ static BOOL _purge(WINPR_COMM *pComm, const ULONG *pPurgeMask)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* FIXME: don't rely so much on how the IRP queues are implemented, should be more generic */
|
||||
|
||||
/* nothing to do until IRP_MJ_WRITE-s and IRP_MJ_DEVICE_CONTROL-s are executed in the same thread */
|
||||
/* if (*pPurgeMask & SERIAL_PURGE_TXABORT) */
|
||||
/* { */
|
||||
/* /\* Purges all write (IRP_MJ_WRITE) requests. *\/ */
|
||||
if (*pPurgeMask & SERIAL_PURGE_TXABORT)
|
||||
{
|
||||
/* Purges all write (IRP_MJ_WRITE) requests. */
|
||||
|
||||
/* } */
|
||||
|
||||
// TMP: TODO: intercept this call before CommDeviceIoControl() ?
|
||||
}
|
||||
|
||||
if (*pPurgeMask & SERIAL_PURGE_RXABORT)
|
||||
{
|
||||
/* Purges all read (IRP_MJ_READ) requests. */
|
||||
|
||||
// TMP:
|
||||
if (pComm->ReadIrpQueue != NULL)
|
||||
{
|
||||
assert(0);
|
||||
MessageQueue_Clear(pComm->ReadIrpQueue);
|
||||
}
|
||||
|
||||
/* TMP: TODO: double check if this gives well a change to abort a pending CommReadFile */
|
||||
/* assert(0); */
|
||||
/* fcntl(pComm->fd, F_SETFL, fcntl(pComm->fd, F_GETFL) | O_NONBLOCK); */
|
||||
/* fcntl(pComm->fd, F_SETFL, fcntl(pComm->fd, F_GETFL) & ~O_NONBLOCK); */
|
||||
|
||||
/* TMP: FIXME: synchronization of the incoming
|
||||
* IRP_MJ_READ-s. Could be possible to make them to
|
||||
* transit first by the MainIrpQueue before to
|
||||
* dispatch them */
|
||||
}
|
||||
|
||||
if (*pPurgeMask & SERIAL_PURGE_TXCLEAR)
|
||||
@ -1294,7 +1282,7 @@ static BOOL _get_commstatus(WINPR_COMM *pComm, SERIAL_STATUS *pCommstatus)
|
||||
|
||||
static void _consume_event(WINPR_COMM *pComm, ULONG *pOutputMask, ULONG event)
|
||||
{
|
||||
if ((pComm->waitMask & event) && (pComm->PendingEvents & event))
|
||||
if ((pComm->WaitEventMask & event) && (pComm->PendingEvents & event))
|
||||
{
|
||||
pComm->PendingEvents &= ~event; /* consumed */
|
||||
*pOutputMask |= event;
|
||||
@ -1338,7 +1326,7 @@ static BOOL _wait_on_mask(WINPR_COMM *pComm, ULONG *pOutputMask)
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_WARN("_wait_on_mask pending on events:0X%lX", pComm->waitMask);
|
||||
DEBUG_WARN("_wait_on_mask pending on events:0X%lX", pComm->WaitEventMask);
|
||||
SetLastError(ERROR_IO_PENDING); /* see: WaitCommEvent's help */
|
||||
return FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user