Mouse troubles, X works, selection, mousetest and 3d do not..

Mouse troubles, X works, selection, mousetest and 3d do not..

Post by Marius Kjelda » Sun, 24 Apr 1994 01:19:11



Hi. I have had Linux installed since 0.99pl13, upgraded to pl15 and
finally to Linux 1.0 when it was available. From the first day I have
had a problem with the mouse driver. My mouse has worked perfectly all
the time with X, but has never worked properly with programs outside X
that use the mouse, for instance selection, mousetest and 3d (the last
two comes with the svgalib package). In the beginning I though that
this was not so important, and hoped it would be fixed in the later
releases, however this has not happened.

Let me get one thing straight. It kind of works outside X as well, but
it's movements are jump and unpredictable and it sends "button-events"
randomly. I suspect there are some serious bugs in the psaux/ps2aux
driver. I have tried several different setups, telling the program to
use /dev/mouse (which is sym.linked to /dev/ps2aux) and /dev/ps2aux
directly, but no change in its behaviour.

My current system is Linux 1.0 installed on an AcerPower 1200 (66MHz
DX/2). As I have said, the mouse works flawlessly with X (which uses
the /dev/ps2aux device..) and DOS/Windows as well.

I am getting kind of desperate - has anybody got any clues on what I
can do to get it up and working in Linux OUTSIDE X? (And yes, I do not
try to run both X and other mouse programs simultainously..)

Thanks in advance!
--
Marius Kjeldahl, student at The Norwegian Insitute of Technology and
The University of Karlsruhe - finishing MSc late autumn 1994

        www   : http://rzstud1.rz.uni-karlsruhe.de/~ulh0

 
 
 

Mouse troubles, X works, selection, mousetest and 3d do not..

Post by Jussi Mika Antero Lahtin » Mon, 25 Apr 1994 07:31:09



Quote:>Hi. I have had Linux installed since 0.99pl13, upgraded to pl15 and
>finally to Linux 1.0 when it was available. From the first day I have
>had a problem with the mouse driver. My mouse has worked perfectly all
>the time with X, but has never worked properly with programs outside X
>that use the mouse, for instance selection, mousetest and 3d (the last
>two comes with the svgalib package). In the beginning I though that
>this was not so important, and hoped it would be fixed in the later
>releases, however this has not happened.
>Let me get one thing straight. It kind of works outside X as well, but
>it's movements are jump and unpredictable and it sends "button-events"
>randomly. I suspect there are some serious bugs in the psaux/ps2aux
>driver. I have tried several different setups, telling the program to
>use /dev/mouse (which is sym.linked to /dev/ps2aux) and /dev/ps2aux
>directly, but no change in its behaviour.
>My current system is Linux 1.0 installed on an AcerPower 1200 (66MHz
>DX/2). As I have said, the mouse works flawlessly with X (which uses
>the /dev/ps2aux device..) and DOS/Windows as well.
>I am getting kind of desperate - has anybody got any clues on what I
>can do to get it up and working in Linux OUTSIDE X? (And yes, I do not
>try to run both X and other mouse programs simultainously..)

selection 1.5 has a bug in PS/2 mouse driver. Check the selection/mouse.c
There is an array initialization which have wrong mask and id for PS/2
-mouse. Fixed init follows...

static const unsigned char proto[NR_TYPES][5] =
{
    /*  hd_mask hd_id   dp_mask dp_id   nobytes */
    {   0x40,   0x40,   0x40,   0x00,   3       },  /* MicroSoft */
    {   0xf8,   0x80,   0x00,   0x00,   3       },  /* MouseSystems 3 (Sun) */
    {   0xf8,   0x80,   0x00,   0x00,   5       },  /* MouseSystems 5 */
    {   0xe0,   0x80,   0x80,   0x00,   3       },  /* MMSeries */
    {   0xe0,   0x80,   0x80,   0x00,   3       },  /* Logitech */
    {   0xf8,   0x80,   0x00,   0x00,   5       },  /* BusMouse */
    {   0x0C,   0x08,   0x00,   0x00,   3       }   /* PS/2 */

Quote:};

For SVGALIB: I think that svgalib has no ps/2 -mouse support but if it have
it may contain the same bug as selection...

>Thanks in advance!
>--
>Marius Kjeldahl, student at The Norwegian Insitute of Technology and
>The University of Karlsruhe - finishing MSc late autumn 1994

>    www   : http://rzstud1.rz.uni-karlsruhe.de/~ulh0

Hope this helps...



 
 
 

Mouse troubles, X works, selection, mousetest and 3d do not..

Post by Marius Kjelda » Tue, 26 Apr 1994 19:51:50



>   Path: ira.uka.de!xlink.net!howland.reston.ans.net!pipex!sunic!news.funet.fi!nntp.hut.fi!nntp!jem

>   Newsgroups: comp.os.linux.help
>   Date: 23 Apr 1994 21:26:35 GMT
>   Organization: Helsinki University of Technology, Finland

>   There have been several reports that selection does not work with PS/2
>   mice. I once tried it myself, and could also not get it to work. I
>   don't use selection, so I didn't bother looking into it.

>   However, H J Lu posted the following patch to selection some time
>   ago. Good luck.

Thanks for replying. Although I have not tried this patch, I doubt
that this is where the problem lies. My reason for this is that other
programs which use the mouse (outside of X) show the similar behaviour
that selection do (eg. some of the testprograms that comes with
svgalib).

--
Marius Kjeldahl, student at The Norwegian Insitute of Technology and
The University of Karlsruhe - finishing MSc late autumn 1994

        www   : http://rzstud1.rz.uni-karlsruhe.de/~ulh0

 
 
 

Mouse troubles, X works, selection, mousetest and 3d do not..

Post by Mark Ort » Thu, 05 May 1994 08:47:21


: Let me get one thing straight. It kind of works outside X as well, but
: it's movements are jump and unpredictable and it sends "button-events"
: randomly. I suspect there are some serious bugs in the psaux/ps2aux
: driver. I have tried several different setups, telling the program to
: use /dev/mouse (which is sym.linked to /dev/ps2aux) and /dev/ps2aux
: directly, but no change in its behaviour.

: My current system is Linux 1.0 installed on an AcerPower 1200 (66MHz
: DX/2). As I have said, the mouse works flawlessly with X (which uses
: the /dev/ps2aux device..) and DOS/Windows as well.

: I am getting kind of desperate - has anybody got any clues on what I
: can do to get it up and working in Linux OUTSIDE X? (And yes, I do not
: try to run both X and other mouse programs simultainously..)

I had the same problem until I found a little piece of code called
MCONV that converts PS2 mouse data to serial mouse data. It works with
selection, all the SVGALib tests and X as well. You fire it up with
mconv /dev/ps2aux /dev/mouse & and it just churns away. Much thanks
to Johan for a handy solution.

/*
 * Microsoft serial mouse emulator for PS/2 mouse using a named pipe.
 *
 * This program reads packets from a PS/2 mouse, transforms them
 * into the corresponding Microsoft serial mouse packets and writes
 * them to a named pipe (fifo). Application programs not supporting
 * the PS/2 mouse protocol (e.g. X11) can then read the packets from
 * the fifo, which to them looks like a serial port with a Microsoft
 * mouse on it.
 *
 * Create a named pipe with suitable permissions with mkfifo,
 * for instance
 *
 *      mkfifo -m 666 /dev/mouse
 *
 * Make sure you have an entry in /dev for the PS/2 pointing device.
 * If not, create with
 *
 *      mknod /dev/psaux c 10 1
 *
 * Start up the conversion program with:
 *
 *      mconv /dev/psaux /dev/mouse &
 *
 * The program takes two arguments: the real mouse device and the
 * name of the fifo.
 *
 * In Xconfig, fool X into thinking you have a Microsoft mouse
 * on /dev/mouse (or whatever you called it):
 *
 * Microsoft "/dev/mouse"
 *
 * Johan Myreen

 */

#include <fcntl.h>
#include <stdio.h>
#include <signal.h>
#include <errno.h>

static char *fifo_name, *prog_name;
static int fifo, mouse;

void handler()
{
  fprintf(stderr, "\n%s: Mouse killed!\n", prog_name);
  close(fifo);
  close(mouse);
  exit(0);

Quote:}

void sigpipe_handler()
{
  close(fifo);
  fifo = open(fifo_name, O_WRONLY);
  if (fifo < 0) {
    fprintf(stderr, "%s: Error reopening fifo.\n", prog_name);
    close(mouse);
    exit(1);
  }
  signal(SIGPIPE, sigpipe_handler);

Quote:}

unsigned char getbyte(void)
{
  static unsigned char buf[1024];
  static unsigned char *bp = buf, *ep = buf;
  int n;

  if (bp == ep) {
    bp = ep = buf;
    n = read(mouse, buf, 1024);
    if (n>0) {
      ep += n;
    }
  }
  return *bp++;

Quote:}

void track_mouse(void)
{
  unsigned char byte1, byte2, byte3, out[3], outbyte;
  int ret;

  while (1) {
    byte1 = getbyte();
    if (byte1 & 0xc0)
      continue;                         /* Resynchronize */
    byte2 = getbyte();
    byte3 = getbyte();
    byte3 = -byte3;
    outbyte = 0x40;
    outbyte |= ((byte2 >> 6)&0x03);
    outbyte |= ((byte3 >> 4)&0x0c);
    outbyte |= (byte1&0x01) << 5;     /* Left button */
    outbyte |= (byte1&0x02) << 3;     /* Right button */
    out[0] = outbyte;
    out[1] = (byte2)&0x3f;
    out[2] = (byte3)&0x3f;
    ret = write(fifo, out, 3);
    if (ret < 0 && errno != EPIPE)
      return;
  }

Quote:}

int main(int argc, char **argv)
{

  prog_name = argv[0];
  if (argc < 3) {
    fprintf(stderr, "Usage: %s <mouse dev> <fifo>\n", argv[0]);
    exit(1);
  }

  mouse = open(argv[1], O_RDONLY);

  if (mouse < 0) {
    fprintf(stderr, "%s: error %d opening mouse. Exiting.\n", prog_name, errno);
    close(fifo);
    exit(1);
  }

  fifo_name = argv[2];
  fifo = open(fifo_name, O_WRONLY);

  if (fifo < 0) {
    fprintf(stderr, "%s: error %d opening fifo. Exiting.\n", prog_name, errno);
    exit(1);
  }

  signal(SIGTERM, handler);
  signal(SIGINT, handler);
  signal(SIGHUP, handler);
  signal(SIGPIPE, sigpipe_handler);

  track_mouse();

  fprintf(stderr, "%s: error %d reading or writing.\n", prog_name, errno);
  close(fifo);
  close(mouse);

Quote:}

.
 
 
 

1. Weird serial mouse behaviour with selection, mousetest, X

My hardware: ASUS SP3 with on-board UART 16550A com ports
             Microsoft compatible 2 button mouse on com1
My software: Linux 1.1.45
             /dev/mouse -> ttyS0
My problem:  whatever program I try (see above) the mouse either doesnt
             react at all or it moves really weird: jumps, random button
             presses, lag, whatever
My struggle: I tried setting /dev/ttyS0 to uart 8250 with setserial in order
             to disable the fifo: no effect
             I tried different mouse types with selection: no effect
             The mouse works fine under DOS
My question: do I have to modify my rc.serial or what ?

Thanx for your help,  Florian

2. Hardware choice?

3. mouse works with X11, but not selection ???

4. Professional Notes on HTML Available

5. German keyboard and selection not working when working remote

6. Convert IP Name Address to Numeric Address

7. Disk Selection Not responding to selection under 2.5

8. Alpha 433a PWS

9. Selection dosen't work with ps2 mouse

10. does Selection work for ps/2 mouse ?

11. mouse OK in X but not selection???

12. Mouse Systems PC Mouse 3D/6D Bus Mouse driver?

13. How to use a Mouse Systems Mouse with Selection