Subject: None
To: None <duncan@comp.vuw.ac.nz>
From: John Kohl <jtk@kolvir.blrc.ma.us>
List: current-users
Date: 07/19/1994 00:41:23
The pms driver generates what appears to be MouseSystems mouse output :)

After doing that I ended up with a driver that got the Y direction
inverted---this seems strange, but it's a genuine Microsoft mouse so it
must be right and the driver must be wrong :)

Here are my diffs vs. the one that cgd checked in yesterday (you can
ignore the #if 0/#endif around the interrupts if the reordering that
Duncan posted makes it work OK).  Note that because of the statics in
pmsintr, you can't have more than one mouse configured---not that you'd
want to, but I made it explicitly give an #error.

*** 1.3	1994/07/18 23:31:07
--- pms.c	1994/07/19 01:00:16
***************
*** 20,26 ****
   * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   *
!  *	$Id: pms.c,v 1.3 1994/07/18 23:31:07 jtkohl Exp $
   */
  
  /*
--- 20,26 ----
   * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   *
!  *	$Id: pms.c,v 1.4 1994/07/19 01:00:15 jtkohl Exp $
   */
  
  /*
***************
*** 31,36 ****
--- 31,41 ----
   * may result in dropped characters and/or corrupted mouse events.
   */
  
+ #include "pms.h"
+ #if NPMS > 1
+ #error Only one PS/2 style mouse may be configured into your system.
+ #endif
+ 
  #include <sys/param.h>
  #include <sys/kernel.h>
  #include <sys/systm.h>
***************
*** 242,251 ****
--- 247,259 ----
  {
  	struct pms_softc *sc = pmscd.cd_devs[PMSUNIT(dev)];
  
+ #if 0
  	/* Disable interrupts. */
+ 	/* disabling interrupts seems to turn off the keyboard too, urk! */
  	pms_pit_cmd(sc->sc_iobase, PMS_INT_DISABLE);
  	pms_aux_cmd(sc->sc_iobase, PMS_AUX_DISABLE);
  	pms_dev_cmd(sc->sc_iobase, PMS_DEV_DISABLE);
+ #endif
  
  	sc->sc_state &= ~PMS_OPEN;
  
***************
*** 369,378 ****
  	static char dx, dy;
  	u_char buffer[5];
  
! 	if ((sc->sc_state & PMS_OPEN) == 0)
  		/* Interrupts are not expected. */
  		return 0;
! 
  	switch (state) {
  
  	case 0:
--- 377,388 ----
  	static char dx, dy;
  	u_char buffer[5];
  
! 	if ((sc->sc_state & PMS_OPEN) == 0) {
  		/* Interrupts are not expected. */
+ 		/* just discard an input byte */
+ 		(void) inb(iobase + PMS_DATA);
  		return 0;
! 	}
  	switch (state) {
  
  	case 0:
***************
*** 390,396 ****
  
  	case 2:
  		dy = inb(iobase + PMS_DATA);
! 		dy = (dy == -128) ? 127 : -dy;
  		state = 0;
  
  		buttons = ((buttons & PS2LBUTMASK) << 2) |
--- 400,407 ----
  
  	case 2:
  		dy = inb(iobase + PMS_DATA);
! 		/* hmm, seems to give Y inverted? --jtk */
! 		dy = (dy == -128) ? -127 : dy;
  		state = 0;
  
  		buttons = ((buttons & PS2LBUTMASK) << 2) |


------------------------------------------------------------------------------