[SVGA] New mouse, new patch, new mailing list?

Search this archive.

From: Morris Michael Slutsky (mslutsky@umich.edu)
Date: Mon 21 Aug 2000 - 04:38:19 IDT


	I just bought some crazy Digital Research mouse with two
wheels - one vertical as normally, the other horizontal - model name is
DRMOUSE4DS. I wanted to use this mouse in SVGALib, so I did some playing
around.

	It works just like a PS/2 Intellimouse, but it reports the normal
wheel as a +1/-1 increment, while the new wheel sends a +2/-2.  The mouse
never sends signals for both wheels at once - at least, not so far as I
can tell.  

	I've added the new mouse type DRMOUSE4DS to SVGALib, and have it
reporting the standard wheel in the RX axis and the new wheel in the RY
axis.  

	The svgalib.org front page suggests that 1.4.3 is a current
development version, but I could not find a copy of it anywhere.
Therefore, I used 1.4.2 as a base for my modifications - and have enclosed
a patch for 1.4.2 .  If the patch doesn't come through in the mail, I've
also got it up at

http://www.umich.edu/~mslutsky/svgalib_patch/drmouse4ds.patch


	Well, thanks to all of you for working on SVGALib, I really like
it. Thank you for your time, sorry in advance for any bugs or kludginess
in my mouse patch,

morris

########################

diff -cr svgalib-1.4.2/include/vgamouse.h svgalib-1.4.2-devel/include/vgamouse.h
*** svgalib-1.4.2/include/vgamouse.h	Fri Feb 11 06:45:25 2000
--- svgalib-1.4.2-devel/include/vgamouse.h	Sun Aug 20 16:58:54 2000
***************
*** 23,29 ****
  #define MOUSE_IMPS2 11
  #define MOUSE_PNP 12
  #define MOUSE_WACOM_GRAPHIRE 13
! #define MOUSE_LAST MOUSE_WACOM_GRAPHIRE
  
  #define MOUSE_ORIENTATION_VERTICAL 0
  #define MOUSE_ORIENTATION_HORIZONTAL 1
--- 23,30 ----
  #define MOUSE_IMPS2 11
  #define MOUSE_PNP 12
  #define MOUSE_WACOM_GRAPHIRE 13
! #define MOUSE_DRMOUSE4DS 14
! #define MOUSE_LAST MOUSE_DRMOUSE4DS
  
  #define MOUSE_ORIENTATION_VERTICAL 0
  #define MOUSE_ORIENTATION_HORIZONTAL 1
diff -cr svgalib-1.4.2/src/config/libvga.config svgalib-1.4.2-devel/src/config/libvga.config
*** svgalib-1.4.2/src/config/libvga.config	Fri Feb 11 06:48:20 2000
--- svgalib-1.4.2-devel/src/config/libvga.config	Sun Aug 20 17:41:19 2000
***************
*** 28,33 ****
--- 28,34 ----
  # mouse IMPS2		# Microsoft IntelliMouse or Logitech MouseMan+ on PS/2 port
  # mouse pnp		# plug'n'pray
  # mouse WacomGraphire   # Wacom Graphire tablet/mouse
+ # mouse DRMOUSE4DS	# Digital Research double-wheeled mouse
  # mouse none		# None
  
  mouse Microsoft
Only in svgalib-1.4.2-devel/src/joystick: joystick.o
diff -cr svgalib-1.4.2/src/mouse/ms.c svgalib-1.4.2-devel/src/mouse/ms.c
*** svgalib-1.4.2/src/mouse/ms.c	Fri Feb 11 06:45:25 2000
--- svgalib-1.4.2-devel/src/mouse/ms.c	Sun Aug 20 18:18:38 2000
***************
*** 103,108 ****
--- 103,109 ----
      {0xc8, 0x08, 0x00, 0x00, 4},	/* IntelliMouse (PS/2) */
      {0x40, 0x40, 0x40, 0x00, 3},	/* pnp */
      {0x80, 0x80, 0x80, 0x00, 7},	/* Wacom Graphire */
+     {0xc8, 0x08, 0x00, 0x00, 4},	/* DRMOUSE4DS (Digital Research 2-wheel PS/2) */
  };
  
  static void ms_setspeed(const int old, const int new,
***************
*** 439,445 ****
      if ((__svgalib_mouse_fd = open(m_dev, O_RDWR | O_NDELAY )) < 0)
  	return -1;
  
!     if (m_type == MOUSE_BUSMOUSE || m_type == MOUSE_PS2 || m_type == MOUSE_IMPS2 || m_type == MOUSE_GPM)
  	m_modem_ctl = 0;
  
      /* If no signal will change there is no need to restore
--- 440,447 ----
      if ((__svgalib_mouse_fd = open(m_dev, O_RDWR | O_NDELAY )) < 0)
  	return -1;
  
!     if (m_type == MOUSE_BUSMOUSE || m_type == MOUSE_PS2 
!     		|| m_type == MOUSE_IMPS2 || m_type == MOUSE_GPM || m_type == MOUSE_DRMOUSE4DS)
  	m_modem_ctl = 0;
  
      /* If no signal will change there is no need to restore
***************
*** 497,503 ****
      	usleep(75000);
      	/* Start sending coordinates */
      	write(__svgalib_mouse_fd, "\rST\r", 4);
!     } else if (m_type == MOUSE_IMPS2) {
  	/* Initialize the mouse into wheel mode */
  	write(__svgalib_mouse_fd, "\363\310\363\144\363\120", 6);
      } else if (m_type == MOUSE_PNP) {
--- 499,505 ----
      	usleep(75000);
      	/* Start sending coordinates */
      	write(__svgalib_mouse_fd, "\rST\r", 4);
!     } else if (m_type == MOUSE_IMPS2 || m_type == MOUSE_DRMOUSE4DS) {
  	/* Initialize the mouse into wheel mode */
  	write(__svgalib_mouse_fd, "\363\310\363\144\363\120", 6);
      } else if (m_type == MOUSE_PNP) {
***************
*** 558,564 ****
              MOUSE_RESETBUTTON;
          mouse_caps.axes = MOUSE_6DIM;
          break;
!         
      case MOUSE_INTELLIMOUSE:
      case MOUSE_IMPS2:
      case MOUSE_WACOM_GRAPHIRE:
--- 560,573 ----
              MOUSE_RESETBUTTON;
          mouse_caps.axes = MOUSE_6DIM;
          break;
!     
!     case MOUSE_DRMOUSE4DS:
!     	/* X, Y, RX and RY (two wheels), 3 buttons */
! 	mouse_caps.axes = MOUSE_2DIM | MOUSE_RXDIM | MOUSE_RYDIM;
! 	mouse_caps.buttons = MOUSE_LEFTBUTTON | MOUSE_RIGHTBUTTON | MOUSE_MIDDLEBUTTON;
! 	mouse_caps.info = MOUSE_INFO_WHEEL;
! 	break;
! 	
      case MOUSE_INTELLIMOUSE:
      case MOUSE_IMPS2:
      case MOUSE_WACOM_GRAPHIRE:
***************
*** 741,747 ****
  	goto handle_packets;
      }
      /* Check whether it's a valid data packet. */
!     if ((m_type != MOUSE_PS2)&&(m_type != MOUSE_IMPS2)&&(m_type != MOUSE_SPACEBALL)&&(m_type != MOUSE_WACOM_GRAPHIRE))
  	for (j = 1; j < proto[m_type][4]; j++)
  	    if ((buf[i + j] & proto[m_type][2]) != proto[m_type][3]
  		|| buf[i + j] == 0x80) {
--- 750,757 ----
  	goto handle_packets;
      }
      /* Check whether it's a valid data packet. */
!     if ((m_type != MOUSE_PS2)&&(m_type != MOUSE_IMPS2)&&(m_type != MOUSE_SPACEBALL)
!     	&&(m_type != MOUSE_WACOM_GRAPHIRE) && (m_type != MOUSE_DRMOUSE4DS) )
  	for (j = 1; j < proto[m_type][4]; j++)
  	    if ((buf[i + j] & proto[m_type][2]) != proto[m_type][3]
  		|| buf[i + j] == 0x80) {
***************
*** 897,902 ****
--- 907,964 ----
  	dx = (buf[i] & 0x10) ? buf[i + 1] - 256 : buf[i + 1];
  	dy = (buf[i] & 0x20) ? -(buf[i + 2] - 256) : -buf[i + 2];
  	break;
+     case MOUSE_DRMOUSE4DS:
+     /* Digital Research 4-Axis mouse - like the PS/2 IntelliMouse, but 
+        has two wheels.  */
+         /* This bit modified from the gpm 1.13 imps2 patch by Tim Goodwin */
+         but = ((buf[i] & 1) << 2) /* left */
+             | ((buf[i] & 6) >> 1); /* middle and right */
+         dx = (buf[i] & 0x10) ? buf[i + 1] - 256 : buf[i + 1];
+         dy = (buf[i] & 0x20) ? -(buf[i + 2] - 256) : -buf[i + 2];
+ 
+         /* Did we turn the wheel? */
+         if((wheel = buf[i + 3]) != 0) {
+ #ifdef DEBUG_WHEEL
+             fprintf(stderr, " Wheel turned (0x%02x)", wheel);
+ #endif
+ 	/* RX reports as 1 or F, RY reports as 2 or E */
+ 	/* both never report at the same time, which makes life easier */
+ 	if (m_wheel_delta) 
+ 	{
+ 		switch (wheel & 0x0F)
+ 		{
+ 		case 1:		drx = m_wheel_delta; break;
+ 		case 15:	drx = -m_wheel_delta; break;
+ 		case 2:		dry = -m_wheel_delta; break;
+ 		case 14:	dry = m_wheel_delta; break;
+ 		};
+ #ifdef DEBUG_WHEEL
+                 fprintf(stderr, "; RX axis delta = %d : RY axis delta = %d", drx, dry);
+ #endif
+ 
+             /* Are fake keyboard events enabled? */
+             if(m_fake_kbd_events && __svgalib_keyboard_eventhandler) {
+                 /* Fake keypresses... */
+                 int key = ((drx+dry < 0) ? m_fake_upscancode : m_fake_downscancode);
+ #ifdef DEBUG_WHEEL
+                 fprintf(stderr, "; pressing scancode %d", key);
+ #endif
+                  __svgalib_keyboard_eventhandler(key, 1); /* press */
+                 /* todo: delay */
+ #ifdef DEBUG_WHEEL
+                 fprintf(stderr, ", releasing scancode %d", key);
+ #endif
+                 __svgalib_keyboard_eventhandler(key, 0); /* release */
+             }
+ #ifdef DEBUG_WHEEL
+             fprintf(stderr, ".\n");
+ #endif
+ 
+ 
+ 	}
+     }
+     break;
+     
      case MOUSE_IMPS2:           /* PS/2 IntelliMouse */
          /* This bit modified from the gpm 1.13 imps2 patch by Tim Goodwin */
          but = ((buf[i] & 1) << 2) /* left */
diff -cr svgalib-1.4.2/src/mouse/vgamouse.h svgalib-1.4.2-devel/src/mouse/vgamouse.h
*** svgalib-1.4.2/src/mouse/vgamouse.h	Fri Feb 11 06:45:25 2000
--- svgalib-1.4.2-devel/src/mouse/vgamouse.h	Sun Aug 20 16:58:54 2000
***************
*** 23,29 ****
  #define MOUSE_IMPS2 11
  #define MOUSE_PNP 12
  #define MOUSE_WACOM_GRAPHIRE 13
! #define MOUSE_LAST MOUSE_WACOM_GRAPHIRE
  
  #define MOUSE_ORIENTATION_VERTICAL 0
  #define MOUSE_ORIENTATION_HORIZONTAL 1
--- 23,30 ----
  #define MOUSE_IMPS2 11
  #define MOUSE_PNP 12
  #define MOUSE_WACOM_GRAPHIRE 13
! #define MOUSE_DRMOUSE4DS 14
! #define MOUSE_LAST MOUSE_DRMOUSE4DS
  
  #define MOUSE_ORIENTATION_VERTICAL 0
  #define MOUSE_ORIENTATION_HORIZONTAL 1
diff -cr svgalib-1.4.2/src/vga.c svgalib-1.4.2-devel/src/vga.c
*** svgalib-1.4.2/src/vga.c	Thu Jul  6 12:10:32 2000
--- svgalib-1.4.2-devel/src/vga.c	Sun Aug 20 17:57:38 2000
***************
*** 3508,3514 ****
  {
    "Microsoft", "MouseSystems", "MMSeries", "Logitech", "Busmouse", "PS2",
      "MouseMan", "gpm", "Spaceball", "none", "IntelliMouse", "IMPS2", "pnp", 
!     "WacomGraphire", NULL};
  
  static int check_digit(char *ptr, char *digits)
  {
--- 3508,3514 ----
  {
    "Microsoft", "MouseSystems", "MMSeries", "Logitech", "Busmouse", "PS2",
      "MouseMan", "gpm", "Spaceball", "none", "IntelliMouse", "IMPS2", "pnp", 
!     "WacomGraphire", "DRMOUSE4DS", NULL};
  
  static int check_digit(char *ptr, char *digits)
  {
***************
*** 3551,3556 ****
--- 3551,3559 ----
  	    for (i = 0, tabptr = conf_mousenames; *tabptr; tabptr++, i++) {
  		if (!strcasecmp(ptr, *tabptr)) {
  		    mouse_type = i;
+ #ifdef DEBUG_DRMOUSE4DS
+ 	fprintf(stderr, "mouse type: %d: %s \n", i, conf_mousenames[i]);
+ #endif
  		    goto leave;
  		}
  	    }


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:23 IST