diff --git a/src/add-ons/kernel/drivers/input/ps2_hid_new/common.c b/src/add-ons/kernel/drivers/input/ps2_hid_new/common.c index 68bd64313c..7035399cfd 100644 --- a/src/add-ons/kernel/drivers/input/ps2_hid_new/common.c +++ b/src/add-ons/kernel/drivers/input/ps2_hid_new/common.c @@ -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; diff --git a/src/add-ons/kernel/drivers/input/ps2_hid_new/keyboard.c b/src/add-ons/kernel/drivers/input/ps2_hid_new/keyboard.c index 1d0d7e8d3f..b74af20926 100644 --- a/src/add-ons/kernel/drivers/input/ps2_hid_new/keyboard.c +++ b/src/add-ons/kernel/drivers/input/ps2_hid_new/keyboard.c @@ -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); diff --git a/src/add-ons/kernel/drivers/input/ps2_hid_new/mouse.c b/src/add-ons/kernel/drivers/input/ps2_hid_new/mouse.c index 757efbe832..4048a2c5ed 100644 --- a/src/add-ons/kernel/drivers/input/ps2_hid_new/mouse.c +++ b/src/add-ons/kernel/drivers/input/ps2_hid_new/mouse.c @@ -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"));