#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 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).
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.
[a manual with the abbreviation SVSPG]
Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97