up | Inhaltsverzeichniss | Kommentar

Manual page for MS(4M)

ms - Sun mouse STREAMS module




#include <sys/types.h>
#include <sys/time.h>
#include <sys/stream.h>
#include <sys/stropts.h>
#include <sundev/vuid_event.h>
#include <sundev/msio.h>
ioctl(fd, I_PUSH, "ms");


The ms STREAMS module processes byte streams generated by mice attached to a CPU serial or parallel port. When this module is pushed onto a stream, it sends a TCSETSF ioctl downstream, setting the baud rate to 1200 baud and the character size to 8 bits, and enabling the receiver. All other flag words are cleared. It assumes only that the termios.3v functions provided by the zs.4s driver are supported; no other functions need be supported.

The mouse is expected to generate a stream of bytes encoding mouse motions and changes in the state of the buttons.

Each mouse sample in the byte stream consists of three bytes: the first byte gives the button state with value 0x87|~but, where but is the low three bits giving the mouse buttons, where a 0 (zero) bit means that a button is pressed, and a 1 (one) bit means a button is not pressed. Thus if the left button is down the value of this sample is 0x83, while if the right button is down the byte is 0x86.

The next two bytes of each sample give the x and y deltas of this sample as signed bytes. The mouse uses a lower-left coordinate system, so moves to the right on the screen yield positive x values and moves down the screen yield negative y values.

The beginning of a sample is identifiable because the delta's are constrained to not have values in the range 0x80-0x87.

A stream with ms pushed onto it can be used as a device that emits firm_events as specified by the protocol of a Virtual User Input Device. It understands VUIDSFORMAT, VUIDGFORMAT, VUIDSADDR and VUIDGADDR ioctls (see reference below).


ms responds to the following ioctls, as defined in <sundev/msio.h> and <sundev/vuid_event.h>. All other ioctls are passed downstream. As ms sets the parameters of the serial port when it is opened, no termios.3v ioctls should be performed on a stream with ms on it, as ms expects the device parameters to remain as it set them.

The MSIOGETPARMS and MSIOSETPARMS calls use a structure of type Ms_parms, which is a structure defined in <sundev/msio.h>:

typedef struct {
int             jitter_thresh;
int             speed_law;
int             speed_limit;
}               Ms_parms;

jitter_thresh is the ``jitter threshold'' of the mouse. Motions of fewer than jitter_thresh units along both axes that occur in less than 1/12 second are treated as ``jitter'' and ignored. Thus, if the mouse moves fewer than jitter_thresh units and then moves back to its original position in less than 1/12 of a second, the motion is considered to be ``noise'' and ignored. If it moves fewer than jitter_thresh units and continues to move so that it has not returned to its original position after 1/12 of a second, the motion is considered to be real and is reported.

speed_law indicates whether extremely large motions are to be ignored. If it is 1, a ``speed limit'' is applied to mouse motions; motions along either axis of more than speed_limit units are discarded.

Note: these parameters are global; if they are set for any mouse on a workstation, they apply to any other mice attached to that workstation as well.

These are standard Virtual User Input Device ioctls. See [a manual with the abbreviation SVSPG] for a description of their operation.
The argument is a pointer to a Ms_parms. The current mouse parameters are stored in that structure.
The argument is a pointer to a ms_parms. The current mouse parameters are set from the values in that structure.


mouse.4s termios.3v win.4s zs.4s

[a manual with the abbreviation SVSPG]

index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).

Last modified 21/April/97