Author: tkreuzer Date: Mon Oct 26 04:24:03 2009 New Revision: 43770
URL: http://svn.reactos.org/svn/reactos?rev=43770&view=rev Log: [KDCOM] For unknown reasons it's not enough to check LSR if the port is ready to receive or not. Adding additional port reads improves the reliability of the data massively. Now it's possible to use kdcom on windows XP!
Modified: branches/ros-amd64-bringup/reactos/drivers/base/kddll/kdcom.c
Modified: branches/ros-amd64-bringup/reactos/drivers/base/kddll/kdcom.c URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/driver... ============================================================================== --- branches/ros-amd64-bringup/reactos/drivers/base/kddll/kdcom.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/drivers/base/kddll/kdcom.c [iso-8859-1] Mon Oct 26 04:24:03 2009 @@ -216,6 +216,11 @@ /* Wait for the port to be ready */ while ((READ_PORT_UCHAR(ComPortBase + COM_LSR) & LSR_TBE) == 0);
+ /* This is needed due to subtle timing issues */ + READ_PORT_UCHAR(ComPortBase + COM_MSR); + while ((READ_PORT_UCHAR(ComPortBase + COM_LSR) & LSR_TBE) == 0); + READ_PORT_UCHAR(ComPortBase + COM_MSR); + /* Send the byte */ WRITE_PORT_UCHAR(ComPortBase + COM_DAT, Byte); } @@ -224,6 +229,8 @@ NTAPI KdpPollByte(OUT PBYTE OutByte) { + READ_PORT_UCHAR(ComPortBase + COM_MSR); // Timing + /* Check if data is available */ if ((READ_PORT_UCHAR(ComPortBase + COM_LSR) & LSR_DR)) {