Commit 03fbe016 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Ignore failures to retrieve serial status for events we are not interested in.

Based on a patch by Valentine Sinitsyn.
parent b574c115
...@@ -287,18 +287,13 @@ static NTSTATUS get_line_control(int fd, SERIAL_LINE_CONTROL* slc) ...@@ -287,18 +287,13 @@ static NTSTATUS get_line_control(int fd, SERIAL_LINE_CONTROL* slc)
static NTSTATUS get_modem_status(int fd, DWORD* lpModemStat) static NTSTATUS get_modem_status(int fd, DWORD* lpModemStat)
{ {
NTSTATUS status = STATUS_SUCCESS; NTSTATUS status = STATUS_NOT_SUPPORTED;
int mstat; int mstat;
*lpModemStat = 0;
#ifdef TIOCMGET #ifdef TIOCMGET
if (ioctl(fd, TIOCMGET, &mstat) == -1) if (!ioctl(fd, TIOCMGET, &mstat))
{
WARN("ioctl failed\n");
status = FILE_GetNtStatus();
}
else
{ {
*lpModemStat = 0;
#ifdef TIOCM_CTS #ifdef TIOCM_CTS
if (mstat & TIOCM_CTS) *lpModemStat |= MS_CTS_ON; if (mstat & TIOCM_CTS) *lpModemStat |= MS_CTS_ON;
#endif #endif
...@@ -317,9 +312,10 @@ static NTSTATUS get_modem_status(int fd, DWORD* lpModemStat) ...@@ -317,9 +312,10 @@ static NTSTATUS get_modem_status(int fd, DWORD* lpModemStat)
(*lpModemStat & MS_RING_ON) ? "MS_RING_ON " : "", (*lpModemStat & MS_RING_ON) ? "MS_RING_ON " : "",
(*lpModemStat & MS_DSR_ON) ? "MS_DSR_ON " : "", (*lpModemStat & MS_DSR_ON) ? "MS_DSR_ON " : "",
(*lpModemStat & MS_CTS_ON) ? "MS_CTS_ON " : ""); (*lpModemStat & MS_CTS_ON) ? "MS_CTS_ON " : "");
return STATUS_SUCCESS;
} }
#else WARN("ioctl failed\n");
status = STATUS_NOT_SUPPORTED; status = FILE_GetNtStatus();
#endif #endif
return status; return status;
} }
...@@ -873,6 +869,7 @@ typedef struct async_commio ...@@ -873,6 +869,7 @@ typedef struct async_commio
*/ */
static NTSTATUS get_irq_info(int fd, serial_irq_info *irq_info) static NTSTATUS get_irq_info(int fd, serial_irq_info *irq_info)
{ {
NTSTATUS status = STATUS_NOT_IMPLEMENTED;
#ifdef TIOCGICOUNT #ifdef TIOCGICOUNT
struct serial_icounter_struct einfo; struct serial_icounter_struct einfo;
if (!ioctl(fd, TIOCGICOUNT, &einfo)) if (!ioctl(fd, TIOCGICOUNT, &einfo))
...@@ -887,11 +884,10 @@ static NTSTATUS get_irq_info(int fd, serial_irq_info *irq_info) ...@@ -887,11 +884,10 @@ static NTSTATUS get_irq_info(int fd, serial_irq_info *irq_info)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
TRACE("TIOCGICOUNT err %s\n", strerror(errno)); TRACE("TIOCGICOUNT err %s\n", strerror(errno));
return FILE_GetNtStatus(); status = FILE_GetNtStatus();
#else
memset(irq_info,0, sizeof(serial_irq_info));
return STATUS_NOT_IMPLEMENTED;
#endif #endif
memset(irq_info,0, sizeof(serial_irq_info));
return status;
} }
...@@ -1050,15 +1046,24 @@ static NTSTATUS wait_on(HANDLE hDevice, int fd, HANDLE hEvent, DWORD* events) ...@@ -1050,15 +1046,24 @@ static NTSTATUS wait_on(HANDLE hDevice, int fd, HANDLE hEvent, DWORD* events)
#endif #endif
if (commio->evtmask & EV_RXFLAG) if (commio->evtmask & EV_RXFLAG)
FIXME("EV_RXFLAG not handled\n"); FIXME("EV_RXFLAG not handled\n");
if ((status = get_irq_info(fd, &commio->irq_info)) ||
(status = get_modem_status(fd, &commio->mstat))) if ((status = get_irq_info(fd, &commio->irq_info)) &&
goto out_now; (commio->evtmask & (EV_BREAK | EV_ERR)))
goto out_now;
if ((status = get_modem_status(fd, &commio->mstat)) &&
(commio->evtmask & (EV_CTS | EV_DSR| EV_RING| EV_RLSD)))
goto out_now;
/* We might have received something or the TX buffer is delivered */ /* We might have received something or the TX buffer is delivered */
*events = check_events(fd, commio->evtmask, *events = check_events(fd, commio->evtmask,
&commio->irq_info, &commio->irq_info, &commio->irq_info, &commio->irq_info,
commio->mstat, commio->mstat); commio->mstat, commio->mstat);
if (*events) goto out_now; if (*events)
{
status = STATUS_SUCCESS;
goto out_now;
}
/* create the worker for the task */ /* create the worker for the task */
status = RtlQueueWorkItem(wait_for_event, commio, 0 /* FIXME */); status = RtlQueueWorkItem(wait_for_event, commio, 0 /* FIXME */);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment