Added tests, I don't think this will work as intended...

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15938 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marcus Overhagen 2006-01-13 17:17:14 +00:00
parent 124a7ec381
commit cf97e60972
3 changed files with 39 additions and 18 deletions

View File

@ -172,6 +172,20 @@ ps2_command(uint8 cmd, const uint8 *out, int out_count, uint8 *in, int in_count)
return res;
}
status_t
ps2_get_command_byte(uint8 *byte)
{
return ps2_command(PS2_CTRL_READ_CMD, NULL, 0, byte, 1);
}
status_t
ps2_set_command_byte(uint8 byte)
{
return ps2_command(PS2_CTRL_WRITE_CMD, &byte, 1, NULL, 0);
}
// #pragma mark -
@ -268,7 +282,32 @@ init_driver(void)
goto err_4;
{
uint8 d;
status_t res;
res = ps2_get_command_byte(&d)
dprintf("ps2_get_command_byte: res 0x%08x, d 0x%02x\n", res, d);
d |= PS2_BITS_TRANSLATE_SCANCODES | PS2_BITS_KEYBOARD_INTERRUPT | PS2_BITS_AUX_INTERRUPT;
d &= ~(PS2_BITS_KEYBOARD_DISABLED | PS2_BITS_MOUSE_DISABLED);
res = ps2_set_command_byte(d);
dprintf("ps2_set_command_byte: res 0x%08x, d 0x%02x\n", res, d);
res = ps2_command(0xae, NULL, 0, NULL, 0);
dprintf("KBD enable: res 0x%08x\n", res);
res = ps2_command(0xa8, NULL, 0, NULL, 0);
dprintf("AUX enable: res 0x%08x\n", res);
res = ps2_command(0xab, NULL, 0, &d, 1);
dprintf("KBD test: res 0x%08x, d 0x%02x\n", res, d);
res = ps2_command(0xa9, NULL, 0, &d, 1);
dprintf("AUX test: res 0x%08x, d 0x%02x\n", res, d);
}
//goto err_5;

View File

@ -294,15 +294,6 @@ keyboard_open(const char *name, uint32 flags, void **_cookie)
goto err3;
}
commandByte = ps2_get_command_byte()
| PS2_BITS_KEYBOARD_INTERRUPT | PS2_BITS_TRANSLATE_SCANCODES;
commandByte &= ~PS2_BITS_KEYBOARD_DISABLED;
status = ps2_set_command_byte(commandByte);
if (status < B_OK) {
TRACE(("keyboard_open(): cannot set command byte\n"));
goto err4;
}
release_sem(gDeviceOpenSemaphore);

View File

@ -372,15 +372,6 @@ mouse_open(const char *name, uint32 flags, void **_cookie)
*_cookie = NULL;
commandByte = ps2_get_command_byte() | PS2_BITS_AUX_INTERRUPT;
commandByte &= ~PS2_BITS_MOUSE_DISABLED;
status = ps2_set_command_byte(commandByte);
if (status < B_OK) {
TRACE(("mouse_open(): sending command byte failed\n"));
goto err4;
}
status = set_mouse_enabled(true);
if (status < B_OK) {
TRACE(("mouse_open(): cannot enable PS/2 mouse\n"));