From a73038cb78e9eb9172ffe4f7104fa1e1426748b7 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Wed, 17 Feb 2016 14:20:47 +0000 Subject: [PATCH] ps2mouse: disable mouse before system shutdown git-svn-id: svn://kolibrios.org@6241 a494cfbc-eb01-0410-851d-a64ba20cac60 --- drivers/mouse/ps2mouse4d/trunk/ps2m_iofuncs.inc | 11 +++++++---- drivers/mouse/ps2mouse4d/trunk/ps2mouse.asm | 13 ++++++++++--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/mouse/ps2mouse4d/trunk/ps2m_iofuncs.inc b/drivers/mouse/ps2mouse4d/trunk/ps2m_iofuncs.inc index 3a1e0741d3..9f4d3d9635 100644 --- a/drivers/mouse/ps2mouse4d/trunk/ps2m_iofuncs.inc +++ b/drivers/mouse/ps2mouse4d/trunk/ps2m_iofuncs.inc @@ -69,11 +69,14 @@ mouse_cmd: call kbd_write cmp ah, 1 je .fail - + + cmp [mouse_cmd_byte], 0xF5 + je .ok call mouse_read - + cmp al, 0xFA jne .noack +.ok: clc ret .noack: @@ -85,8 +88,8 @@ mouse_cmd: .fail: stc ret - - + + mouse_read: mov [mouse_nr_tries], 100 .repeat: diff --git a/drivers/mouse/ps2mouse4d/trunk/ps2mouse.asm b/drivers/mouse/ps2mouse4d/trunk/ps2mouse.asm index 4f55c79032..9e50f3d09e 100644 --- a/drivers/mouse/ps2mouse4d/trunk/ps2mouse.asm +++ b/drivers/mouse/ps2mouse4d/trunk/ps2mouse.asm @@ -22,7 +22,10 @@ entry START proc START c, state:dword, cmdline:dword cmp [state], DRV_ENTRY - jne .nothing + je .init + cmp [state], DRV_EXIT + je .fini + jmp .nothing .init: ; disable keyboard and mouse interrupts ; keyboard IRQ handler can interfere badly otherwise @@ -54,12 +57,12 @@ proc START c, state:dword, cmdline:dword test eax,eax jnz .stop_try mov [MouseType],MT_3BScroll - + call try_mode_ID4 test eax,eax jnz .stop_try mov [MouseType],MT_5BScroll - + .stop_try: mov al, 0xF4 ; enable data reporting @@ -89,6 +92,10 @@ proc START c, state:dword, cmdline:dword .nothing: xor eax, eax ret +.fini: + mov al, 0xF5 + call mouse_cmd + ret .exit: mov bl, 0xA7 ; disable mouse interface