attempt to fix bug #1185

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20883 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marcus Overhagen 2007-04-28 14:29:56 +00:00
parent 4f7504e31e
commit 3294d37f01

View File

@ -108,6 +108,20 @@ ps2_flush(void)
}
static status_t
ps2_selftest()
{
status_t res;
uint8 in;
res = ps2_command(PS2_CTRL_SELF_TEST, NULL, 0, &in, 1);
if (res != B_OK || in != 0x55) {
INFO("ps2: controller self test failed, status 0x%08lx, data 0x%02x\n", res, in);
return B_ERROR;
}
return B_OK;
}
static status_t
ps2_setup_command_byte()
{
@ -171,11 +185,13 @@ ps2_setup_active_multiplexing(bool *enabled)
INFO("ps2: active multiplexing v%d.%d enabled\n", (in >> 4), in & 0xf);
*enabled = true;
return B_OK;
goto done;
no_support:
TRACE("ps2: active multiplexing not supported\n");
*enabled = false;
done:
// Some controllers get upset by the d3 command and will continue data loopback,
// thus we need to send a harmless command (enable keyboard interface) next
// This fixes bug report #1175
@ -190,9 +206,9 @@ fail:
*enabled = false;
// this should revert the controller into legacy mode,
// just in case it has switched to multiplexed mode
res = ps2_command(PS2_CTRL_SELF_TEST, NULL, 0, &out, 1);
if (res != B_OK || out != 0x55) {
INFO("ps2: controller self test failed, status 0x%08lx, data 0x%02x\n", res, out);
res = ps2_command(PS2_CTRL_SELF_TEST, NULL, 0, &in, 1);
if (res != B_OK || in != 0x55) {
INFO("ps2: controller self test failed, status 0x%08lx, data 0x%02x\n", res, in);
return B_ERROR;
}
return B_OK;
@ -330,6 +346,8 @@ ps2_init(void)
if (status)
goto err4;
ps2_selftest();
status = ps2_setup_command_byte();
if (status) {
INFO("ps2: setting up command byte failed\n");