| 109 | } |
| 110 | |
| 111 | static void termios_setflags(int fd, int termios_flags[]) |
| 112 | { |
| 113 | struct termios_list *index = win32_serial_find_port(fd); |
| 114 | int i, result; |
| 115 | int windows_flags[11] = { 0, EV_RXCHAR, EV_TXEMPTY, EV_CTS, EV_DSR, |
| 116 | EV_RING | 0x2000, EV_RLSD, EV_ERR, |
| 117 | EV_ERR, EV_ERR, EV_BREAK |
| 118 | }; |
| 119 | |
| 120 | if (!index) |
| 121 | { |
| 122 | LEAVE("termios_setflags"); |
| 123 | return; |
| 124 | } |
| 125 | |
| 126 | index->event_flag = 0; |
| 127 | |
| 128 | for (i = 0; i < 11; i++) |
| 129 | if (termios_flags[i]) |
| 130 | { |
| 131 | index->event_flag |= windows_flags[i]; |
| 132 | } |
| 133 | |
| 134 | result = SetCommMask(index->hComm, index->event_flag); |
| 135 | |
| 136 | /* |
| 137 | This is rank. 0x2000 was used to detect the trailing edge of ring. |
| 138 | The leading edge is detedted by EV_RING. |
| 139 | |
| 140 | The trailing edge is reliable. The leading edge is not. |
| 141 | Softie no longer allows the trailing edge to be detected in NTsp2 |
| 142 | and beyond. |
| 143 | |
| 144 | So... Try the reliable option above and if it fails, use the less |
| 145 | reliable means. |
| 146 | |
| 147 | The screams for a giveio solution that bypasses the kernel. |
| 148 | */ |
| 149 | if (index->event_flag & 0x2000 && result == 0) |
| 150 | { |
| 151 | index->event_flag &= ~0x2000; |
| 152 | SetCommMask(index->hComm, index->event_flag); |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | #if 0 |
| 157 | /*---------------------------------------------------------- |
no test coverage detected