Module Name:    src
Committed By:   chs
Date:           Sat Dec  7 23:25:19 UTC 2024

Modified Files:
        src/sys/dev/pckbport: pms.c

Log Message:
pms: support PS/2 mouse hot-plug

Detect the BAT (Basic Assurance Test) result value and reset
the driver state in this case.

ok martin@


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/pckbport/pms.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pckbport/pms.c
diff -u src/sys/dev/pckbport/pms.c:1.41 src/sys/dev/pckbport/pms.c:1.42
--- src/sys/dev/pckbport/pms.c:1.41	Tue Sep  5 05:55:12 2023
+++ src/sys/dev/pckbport/pms.c	Sat Dec  7 23:25:19 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: pms.c,v 1.41 2023/09/05 05:55:12 mrg Exp $ */
+/* $NetBSD: pms.c,v 1.42 2024/12/07 23:25:19 chs Exp $ */
 
 /*-
  * Copyright (c) 2004 Kentaro Kurahone.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pms.c,v 1.41 2023/09/05 05:55:12 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pms.c,v 1.42 2024/12/07 23:25:19 chs Exp $");
 
 #include "opt_pms.h"
 
@@ -558,7 +558,7 @@ pmsinput(void *vsc, int data)
 		 * some mice shortly after reset) output garbage bytes
 		 * between packets.  Just ignore them.
 		 */
-		if ((data & 0xc0) != 0)
+		if ((data & 0xc0) != 0 && (data & 0xff) != PMS_RSTDONE)
 			return;	/* not in sync yet, discard input */
 	}
 	if (sc->inputstate >= sizeof(sc->packet))
@@ -594,6 +594,13 @@ pmsinput(void *vsc, int data)
 		break;
 
 	case 2:
+		if (sc->packet[0] == PMS_RSTDONE && sc->packet[1] == 0) {
+			device_printf(sc->sc_dev, "received BAT completion, resetting\n");
+			sc->inputstate = 0;
+			sc->sc_enabled = 0;
+			wakeup(&sc->sc_enabled);
+			return;
+		}
 		break;
 
 	case 4:

Reply via email to