--- xorg-server/files/patch-Xserver-hw-xfree86-os-support-bsd-bsd_mouse.c	2008-03-28 13:49:26.000000000 -0400
+++ xorg-server/files/patch-Xserver-hw-xfree86-os-support-bsd-bsd_mouse.c	2008-04-02 19:27:08.000000000 -0400
@@ -1,5 +1,5 @@
 --- hw/xfree86/os-support/bsd/bsd_mouse.c.orig	2007-08-23 15:05:48.000000000 -0400
-+++ hw/xfree86/os-support/bsd/bsd_mouse.c	2008-03-28 13:49:17.000000000 -0400
++++ hw/xfree86/os-support/bsd/bsd_mouse.c	2008-04-02 19:27:04.000000000 -0400
 @@ -1,4 +1,3 @@
 -
  /*
@@ -21,7 +21,40 @@
  	NULL
  };
  #elif defined(__OpenBSD__) && defined(WSCONS_SUPPORT)
-@@ -184,6 +187,7 @@
+@@ -101,7 +104,7 @@
+ #if defined(__NetBSD__)
+     return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO;
+ #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+-    return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_MISC;
++    return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO | MSE_MISC;
+ #else
+     return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO;
+ #endif
+@@ -180,10 +183,30 @@
+ 	{ MOUSE_PROTO_THINK,		"ThinkingMouse" },
+ 	{ MOUSE_PROTO_SYSMOUSE,		"SysMouse" }
+ };
+-	
++
++static struct {
++	int dmodel;
++	char *name;
++} ps2proto[] = {
++	{ MOUSE_MODEL_NETSCROLL,	"NetScrollPS/2" },
++	{ MOUSE_MODEL_NET,		"NetMousePS/2" },
++	{ MOUSE_MODEL_GLIDEPOINT,	"GlidePointPS/2" },
++	{ MOUSE_MODEL_THINK,		"ThinkingMousePS/2" },
++	{ MOUSE_MODEL_INTELLI,		"IMPS/2" },
++	{ MOUSE_MODEL_MOUSEMANPLUS,	"MouseManPlusPS/2" },
++	{ MOUSE_MODEL_VERSAPAD,		"PS/2" },
++	{ MOUSE_MODEL_EXPLORER,		"ExplorerPS/2" },
++	{ MOUSE_MODEL_4D,		"IMPS/2" },
++	{ MOUSE_MODEL_4DPLUS,		"IMPS/2" },
++	{ MOUSE_MODEL_SYNAPTICS,	"PS/2" },
++	{ MOUSE_MODEL_GENERIC,		"PS/2" },
++	{ MOUSE_MODEL_UNKNOWN,		"PS/2" },
++};
++
  static const char *
  SetupAuto(InputInfoPtr pInfo, int *protoPara)
  {
@@ -29,7 +62,7 @@
      int i;
      mousehw_t hw;
      mousemode_t mode;
-@@ -192,9 +196,12 @@
+@@ -192,17 +215,20 @@
  	return NULL;
  
      /* set the driver operation level, if applicable */
@@ -45,18 +78,46 @@
      /* interrogate the driver and get some intelligence on the device. */
      hw.iftype = MOUSE_IF_UNKNOWN;
      hw.model = MOUSE_MODEL_GENERIC;
-@@ -210,8 +217,8 @@
+     ioctl(pInfo->fd, MOUSE_GETHWINFO, &hw);
+     xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: hw.iftype is %d, hw.model is %d\n",
+ 		pInfo->name, hw.iftype, hw.model);
+-    if (ioctl(pInfo->fd, MOUSE_GETMODE, &mode) == 0) {
+-	for (i = 0; i < sizeof(devproto)/sizeof(devproto[0]); ++i) {
++    if (ioctl(pInfo->fd, MOUSE_GETMODE, &mode) == 0)
++	for (i = 0; i < sizeof(devproto)/sizeof(devproto[0]); ++i)
+ 	    if (mode.protocol == devproto[i].dproto) {
+ 		/* override some parameters */
+ 		if (protoPara) {
+@@ -210,11 +236,25 @@
  		    protoPara[0] = mode.syncmask[0];
  		    protoPara[1] = mode.syncmask[1];
  		}
--		xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n",
++		if (mode.protocol != MOUSE_PROTO_PS2) {
++		    xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n",
++			pInfo->name, devproto[i].name);
++		    return devproto[i].name;
++		}
++		break;
++	    }
++
++    /* set extended PS/2 protocol */
++    if (mode.protocol == MOUSE_PROTO_PS2) {
++	i = 2;
++	ioctl(pInfo->fd, MOUSE_SETLEVEL, &i);
++	ioctl(pInfo->fd, MOUSE_GETHWINFO, &hw);
++	for (i = 0; i < sizeof(ps2proto)/sizeof(ps2proto[0]); ++i)
++	    if (hw.model == ps2proto[i].dmodel) {
+ 		xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n",
 -			    pInfo->name, devproto[i].name);
-+		xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s, level is %d\n",
-+			    pInfo->name, devproto[i].name, mode.level);
- 		return devproto[i].name;
+-		return devproto[i].name;
++		    pInfo->name, ps2proto[i].name);
++		return ps2proto[i].name;
  	    }
- 	}
-@@ -222,6 +229,7 @@
+-	}
+     }
+     return NULL;
+ }
+@@ -222,6 +262,7 @@
  static void
  SetSysMouseRes(InputInfoPtr pInfo, const char *protocol, int rate, int res)
  {
@@ -64,7 +125,7 @@
      mousemode_t mode;
      MouseDevPtr pMse;
  
-@@ -231,11 +239,11 @@
+@@ -231,11 +272,11 @@
      mode.resolution = res > 0 ? res : -1;
      mode.accelfactor = -1;
  #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
@@ -79,7 +140,7 @@
  	 * this point.
  	 */
  	mode.level = 1;
-@@ -249,27 +257,29 @@
+@@ -249,27 +290,29 @@
  #endif
  
  #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
@@ -122,7 +183,7 @@
      }
      return FALSE;
  }
-@@ -309,15 +319,12 @@
+@@ -309,15 +352,12 @@
  		    devMouse = FALSE;
  		}
  		close(fd);
