hi!
i added some plug'n'pray mouse support to svgalib 1.3.1. it's based on
gpm code and is simply ms driver w/o some stuff (don't change speed,
just leave it at 1200bps). it should work where `gpm -t ms` doesn't and
`gpm -t pnp` does. at least it works with my mouse (A4 TECH somthing ...
), set to use only 2 buttons.
i had to give r/w permisions for everyone to /dev/ttyS1 (where my mouse
is connected, and /dev/mouse points to) to use mouse when running as
oridinary user setuid binaries. (it's normal, isn't it ?)
i don't know if pnp mouse support isn't already in svgalib, but if not,
i hope it may be useful.
philosophical reflection: what one can do to play quake ? ;))))
maybe you'll want to have a look at my image viewer based on svgalib ?
it should be on linuxberg in few days (if they accept it ;) but for now:
http://malekith.topnet.pl/, see resources link. it's called gallery.
if anyone want to answer me -- please at <[EMAIL PROTECTED]> ==
i don't have enough access to internet to read any mailing list ...
sorry ...
patch follows ...
may the Tao of programmin' be w/ ya ...
malekith <[EMAIL PROTECTED]>
===========================================================================
diff -u -r svgalib-1.3.1-orig/libvga.config svgalib-1.3.1/libvga.config
--- svgalib-1.3.1-orig/libvga.config Tue Jul 7 21:42:45 1998
+++ svgalib-1.3.1/libvga.config Sun Dec 5 00:59:06 1999
@@ -18,6 +18,7 @@
# mouse Spaceball # Spacetec Spaceball
# mouse IntelliMouse # Microsoft IntelliMouse or Logitech MouseMan+ on serial port
# mouse IMPS2 # Microsoft IntelliMouse or Logitech MouseMan+ on PS/2 port
+# mouse pnp # plug'n'pray
# mouse none # None
mouse Microsoft
diff -u -r svgalib-1.3.1-orig/src/mouse/mouse.c svgalib-1.3.1/src/mouse/mouse.c
--- svgalib-1.3.1-orig/src/mouse/mouse.c Tue May 19 22:31:26 1998
+++ svgalib-1.3.1/src/mouse/mouse.c Sun Dec 5 00:40:11 1999
@@ -45,7 +45,7 @@
if (m_type == MOUSE_NONE)
return -1;
- if (m_type < MOUSE_MICROSOFT || m_type > MOUSE_IMPS2)
+ if (m_type < MOUSE_MICROSOFT || m_type > MOUSE_LAST)
return -1;
if (ms_init())
return -1;
diff -u -r svgalib-1.3.1-orig/src/mouse/ms.c svgalib-1.3.1/src/mouse/ms.c
--- svgalib-1.3.1-orig/src/mouse/ms.c Fri Jul 24 17:08:28 1998
+++ svgalib-1.3.1/src/mouse/ms.c Sun Dec 5 00:45:05 1999
@@ -75,6 +75,7 @@
0, /* Dummy entry for MOUSE_NONE
*/
(CS7 | CREAD | CLOCAL | HUPCL), /* IntelliMouse (Serial) */
CS7, /* IntelliMouse (PS/2)
*/
+ (CS7 | CREAD | CLOCAL | HUPCL), /* plug'n'pray */
};
static const unsigned char proto[][5] =
@@ -92,6 +93,7 @@
{0, 0, 0, 0, 0}, /* Dummy entry for MOUSE_NONE */
{0xc0, 0x40, 0xc0, 0x00, 4}, /* IntelliMouse (Serial) */
{0xc8, 0x08, 0x00, 0x00, 4}, /* IntelliMouse (PS/2) */
+ {0x40, 0x40, 0x40, 0x00, 3}, /* pnp */
};
static void ms_setspeed(const int old, const int new,
@@ -502,6 +504,20 @@
} 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) {
+ /* Need to do this termios stuff here, by hand, ms_setspeed won't
+ work with pnp */
+ struct termios tty;
+ m_baud = 1200;
+ tcgetattr(__svgalib_mouse_fd, &tty);
+ tty.c_iflag = IGNBRK | IGNPAR;
+ tty.c_oflag = 0;
+ tty.c_lflag = 0;
+ tty.c_line = 0;
+ tty.c_cc[VTIME] = 0;
+ tty.c_cc[VMIN] = 1;
+ tty.c_cflag = cflag[m_type] | B1200;
+ tcsetattr(__svgalib_mouse_fd, TCSAFLUSH, &tty);
} else if (m_type != MOUSE_BUSMOUSE && m_type != MOUSE_PS2) {
ms_setspeed(9600, m_baud, cflag[m_type]);
ms_setspeed(4800, m_baud, cflag[m_type]);
@@ -695,6 +711,7 @@
switch (m_type) {
case MOUSE_MICROSOFT: /* Microsoft */
case MOUSE_LOGIMAN: /* MouseMan / TrackMan */
+ case MOUSE_PNP:
default:
but = (but & 2) | ((buf[i] & 0x20) >> 3) | ((buf[i] & 0x10) >> 4);
dx = (char) (((buf[i] & 0x03) << 6) | (buf[i + 1] & 0x3F));
diff -u -r svgalib-1.3.1-orig/src/mouse/vgamouse.h svgalib-1.3.1/src/mouse/vgamouse.h
--- svgalib-1.3.1-orig/src/mouse/vgamouse.h Tue May 19 22:30:14 1998
+++ svgalib-1.3.1/src/mouse/vgamouse.h Sun Dec 5 00:41:18 1999
@@ -21,6 +21,8 @@
#define MOUSE_NONE 9 /* Some special number for a non supported/existing
mouse */
#define MOUSE_INTELLIMOUSE 10
#define MOUSE_IMPS2 11
+#define MOUSE_PNP 12
+#define MOUSE_LAST MOUSE_PNP
#define MOUSE_ORIENTATION_VERTICAL 0
#define MOUSE_ORIENTATION_HORIZONTAL 1
diff -u -r svgalib-1.3.1-orig/src/vga.c svgalib-1.3.1/src/vga.c
--- svgalib-1.3.1-orig/src/vga.c Sat Sep 19 08:59:12 1998
+++ svgalib-1.3.1/src/vga.c Sun Dec 5 00:40:46 1999
@@ -3075,7 +3075,7 @@
static char *conf_mousenames[] =
{
"Microsoft", "MouseSystems", "MMSeries", "Logitech", "Busmouse", "PS2",
- "MouseMan", "gpm", "Spaceball", "none", "IntelliMouse", "IMPS2", NULL};
+ "MouseMan", "gpm", "Spaceball", "none", "IntelliMouse", "IMPS2", "pnp", NULL};
static int check_digit(char *ptr, char *digits)
{
===========================================================================