Author: fireball
Date: Sat Aug 11 13:22:22 2007
New Revision: 28281
URL:
http://svn.reactos.org/svn/reactos?rev=28281&view=rev
Log:
Merge Revision: 25803
Author: dgorbachev
Message:
- fix "keyboard does not respond" bug on Biostar board (thanks to Peter
Krawies)
- fix printf()
Modified:
branches/winldr/arch/i386/hardware.c
branches/winldr/ui/tui.c
Modified: branches/winldr/arch/i386/hardware.c
URL:
http://svn.reactos.org/svn/reactos/branches/winldr/arch/i386/hardware.c?rev…
==============================================================================
--- branches/winldr/arch/i386/hardware.c (original)
+++ branches/winldr/arch/i386/hardware.c Sat Aug 11 13:22:22 2007
@@ -1675,18 +1675,27 @@
{
UCHAR Status;
UCHAR Scancode;
-
+ ULONG Loops;
+ BOOLEAN Result = TRUE;
+
+ /* Identify device */
WRITE_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_DATA,
0xF2);
+ /* Wait for reply */
+ for (Loops = 0; Loops < 100; Loops++)
+ {
StallExecutionProcessor(10000);
-
Status = READ_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_STATUS);
- if ((Status & 0x01) != 0x01)
+ if ((Status & CONTROLLER_STATUS_OUTPUT_BUFFER_FULL) != 0)
+ break;
+ }
+
+ if ((Status & CONTROLLER_STATUS_OUTPUT_BUFFER_FULL) == 0)
{
/* PC/XT keyboard or no keyboard */
DPRINT1("PC/XT keyboard or no keyboard found\n");
- return FALSE;
+ Result = FALSE;
}
Scancode = READ_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_DATA);
@@ -1694,32 +1703,37 @@
{
/* No ACK received */
DPRINT1("No ACK received\n");
- return FALSE;
+ Result = FALSE;
+
}
StallExecutionProcessor(10000);
+
Status = READ_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_STATUS);
- if ((Status & 0x01) != 0x01)
+ if ((Status & CONTROLLER_STATUS_OUTPUT_BUFFER_FULL) == 0)
{
/* Found AT keyboard */
- return TRUE;
+ return Result;
}
Scancode = READ_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_DATA);
if (Scancode != 0xAB)
{
/* No 0xAB received */
+ Result = FALSE;
DPRINT1("No 0xAB received\n");
- return FALSE;
+
}
StallExecutionProcessor(10000);
+
Status = READ_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_STATUS);
- if ((Status & 0x01) != 0x01)
+ if ((Status & CONTROLLER_STATUS_OUTPUT_BUFFER_FULL) == 0)
{
/* No byte in buffer */
DPRINT1("No byte in buffer\n");
- return FALSE;
+ Result = FALSE;
+
}
Scancode = READ_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_DATA);
@@ -1727,12 +1741,12 @@
{
/* No 0x41 received */
DPRINT1("No 0x41 received\n");
- return FALSE;
+ Result = FALSE;
}
/* Found MF-II keyboard */
DPRINT1("Found MF-II keyboard\n");
- return TRUE;
+ return Result;
}
static USHORT
@@ -1910,7 +1924,6 @@
DetectPS2AuxPort(VOID)
{
ULONG Loops;
- UCHAR Scancode;
UCHAR Status;
/* Put the value 0x5A in the output buffer using the
@@ -1931,22 +1944,15 @@
for (Loops = 0; Loops < 10; Loops++)
{
+ StallExecutionProcessor(10000);
Status = READ_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_STATUS);
-
if ((Status & CONTROLLER_STATUS_OUTPUT_BUFFER_FULL) != 0)
- {
- Scancode = READ_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_DATA);
- if ((Status & CONTROLLER_STATUS_MOUSE_OUTPUT_BUFFER_FULL) != 0)
- {
- return TRUE;
- }
break;
}
- StallExecutionProcessor(10000);
- }
-
- return FALSE;
+ READ_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_DATA);
+
+ return (Status & CONTROLLER_STATUS_MOUSE_OUTPUT_BUFFER_FULL);
}
@@ -1968,7 +1974,7 @@
0xF2);
/* Wait for reply */
- for (Loops = 0; Loops < 10; Loops++)
+ for (Loops = 0; Loops < 100; Loops++)
{
StallExecutionProcessor(10000);
Status = READ_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_STATUS);
@@ -1993,15 +1999,6 @@
Scancode = READ_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_DATA);
if (Scancode != 0x00)
Result = FALSE;
-
- /* Flush output buffer */
- for (Loops = 0; Loops < 10; Loops++)
- {
- Status = READ_PORT_UCHAR((PUCHAR)CONTROLLER_REGISTER_STATUS);
- if ((Status & CONTROLLER_STATUS_OUTPUT_BUFFER_FULL) == 0)
- break;
- StallExecutionProcessor(10000);
- }
return Result;
}
Modified: branches/winldr/ui/tui.c
URL:
http://svn.reactos.org/svn/reactos/branches/winldr/ui/tui.c?rev=28281&r…
==============================================================================
--- branches/winldr/ui/tui.c (original)
+++ branches/winldr/ui/tui.c Sat Aug 11 13:22:22 2007
@@ -45,9 +45,9 @@
{
case 'd': case 'u': case 'x':
if (c == 'x')
- *_itoa(va_arg(ap, unsigned long), str, 16) = 0;
+ _itoa(va_arg(ap, unsigned long), str, 16);
else
- *_itoa(va_arg(ap, unsigned long), str, 10) = 0;
+ _itoa(va_arg(ap, unsigned long), str, 10);
ptr = str;