Commit a88444e1 authored by Ove Kaaven's avatar Ove Kaaven Committed by Alexandre Julliard

Implementation of EV_RXFLAG.

parent b38e1dec
...@@ -9,6 +9,7 @@ struct DosDeviceStruct { ...@@ -9,6 +9,7 @@ struct DosDeviceStruct {
int suspended; int suspended;
int unget,xmit; int unget,xmit;
int baudrate; int baudrate;
int evtchar;
/* events */ /* events */
int commerror, eventmask; int commerror, eventmask;
/* buffers */ /* buffers */
......
...@@ -246,15 +246,20 @@ static void comm_notification(int fd,void*private) ...@@ -246,15 +246,20 @@ static void comm_notification(int fd,void*private)
if (!bleft) { if (!bleft) {
ptr->commerror = CE_RXOVER; ptr->commerror = CE_RXOVER;
} else { } else {
ptr->ibuf_head += len; /* check for events */
if (ptr->ibuf_head >= ptr->ibuf_size) if ((ptr->eventmask & EV_RXFLAG) &&
ptr->ibuf_head = 0; memchr(ptr->inbuf + ptr->ibuf_head, ptr->evtchar, bleft)) {
/* flag event */ *(WORD*)(unknown[cid]) |= EV_RXFLAG;
mask |= CN_EVENT;
}
if (ptr->eventmask & EV_RXCHAR) { if (ptr->eventmask & EV_RXCHAR) {
*(WORD*)(unknown[cid]) |= EV_RXCHAR; *(WORD*)(unknown[cid]) |= EV_RXCHAR;
mask |= CN_EVENT; mask |= CN_EVENT;
} }
/* FIXME: check for event character (EV_RXFLAG) */ /* advance buffer position */
ptr->ibuf_head += len;
if (ptr->ibuf_head >= ptr->ibuf_size)
ptr->ibuf_head = 0;
} }
} }
} while (len > 0); } while (len > 0);
...@@ -426,6 +431,7 @@ INT16 WINAPI OpenComm16(LPCSTR device,UINT16 cbInQueue,UINT16 cbOutQueue) ...@@ -426,6 +431,7 @@ INT16 WINAPI OpenComm16(LPCSTR device,UINT16 cbInQueue,UINT16 cbOutQueue)
COM[port].fd = fd; COM[port].fd = fd;
COM[port].commerror = 0; COM[port].commerror = 0;
COM[port].eventmask = 0; COM[port].eventmask = 0;
COM[port].evtchar = 0; /* FIXME: default? */
/* save terminal state */ /* save terminal state */
tcgetattr(fd,&m_stat[port]); tcgetattr(fd,&m_stat[port]);
/* set default parameters */ /* set default parameters */
...@@ -974,6 +980,8 @@ INT16 WINAPI SetCommState16(LPDCB16 lpdcb) ...@@ -974,6 +980,8 @@ INT16 WINAPI SetCommState16(LPDCB16 lpdcb)
else else
port.c_iflag &= ~IXOFF; port.c_iflag &= ~IXOFF;
ptr->evtchar = lpdcb->EvtChar;
if (tcsetattr(ptr->fd, TCSADRAIN, &port) == -1) { if (tcsetattr(ptr->fd, TCSADRAIN, &port) == -1) {
ptr->commerror = WinError(); ptr->commerror = WinError();
return FALSE; return FALSE;
...@@ -1116,6 +1124,8 @@ INT16 WINAPI GetCommState16(INT16 cid, LPDCB16 lpdcb) ...@@ -1116,6 +1124,8 @@ INT16 WINAPI GetCommState16(INT16 cid, LPDCB16 lpdcb)
lpdcb->XonLim = 10; lpdcb->XonLim = 10;
lpdcb->XoffLim = 10; lpdcb->XoffLim = 10;
lpdcb->EvtChar = ptr->evtchar;
ptr->commerror = 0; ptr->commerror = 0;
return 0; return 0;
} }
......
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