


MS(4M)           DEVICES AND NETWORK INTERFACES            MS(4M)



NAME
     ms - Sun mouse STREAMS module

CONFIG
     pseudo-device_m_sn

SYNOPSIS
     #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");

DESCRIPTION
     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 char-
     acter 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 sup-
     ported; 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|~_b_u_t, where _b_u_t 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  _f_i_r_m__e_v_e_n_t_s as specified by the protocol of a _V_i_r_t_u_a_l
     _U_s_e_r _I_n_p_u_t _D_e_v_i_c_e.  It understands VUIDSFORMAT, VUIDGFORMAT,
     VUIDSADDR and VUIDGADDR ioctls (see reference below).





Sun Release 4.1   Last change: 6 December 1989                  1






MS(4M)           DEVICES AND NETWORK INTERFACES            MS(4M)



IOCTLS
     ms  responds  to  the  following  _i_o_c_t_ls,  as   defined   in
     <sundev/msio.h> and <sundev/vuid_event.h>.  All other _i_o_c_t_ls
     are passed downstream.  As ms sets  the  parameters  of  the
     serial  port when it is opened, no termios(3V) _i_o_c_t_ls 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;

     _j_i_t_t_e_r__t_h_r_e_s_h is the  ``jitter  threshold''  of  the  mouse.
     Motions  of  fewer  than _j_i_t_t_e_r__t_h_r_e_s_h 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
     _j_i_t_t_e_r__t_h_r_e_s_h _u_n_i_t_s and then  moves  back  to  its  original
     position  in  less than 1/12 of a second, the motion is con-
     sidered to be ``noise'' and ignored.  If it moves fewer than
     _j_i_t_t_e_r__t_h_r_e_s_h 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.

     _s_p_e_e_d__l_a_w 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
     _s_p_e_e_d__l_i_m_i_t 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.

     VUIDSFORMAT
     VUIDGFORMAT
     VUIDSADDR
     VUIDGADDR           These are standard  _V_i_r_t_u_a_l  _U_s_e_r  _I_n_p_u_t
                         _D_e_v_i_c_e  _i_o_c_t_ls.   See  _S_u_n_V_i_e_w _1  _S_y_s_t_e_m
                         _P_r_o_g_r_a_m_m_e_r'_s _G_u_i_d_e for a description  of
                         their operation.

     MSIOGETPARMS        The argument is a pointer to a Ms_parms.
                         The  current mouse parameters are stored
                         in that structure.

     MSIOSETPARMS        The argument is a pointer to a ms_parms.
                         The  current  mouse  parameters  are set



Sun Release 4.1   Last change: 6 December 1989                  2






MS(4M)           DEVICES AND NETWORK INTERFACES            MS(4M)



                         from the values in that structure.

SEE ALSO
     mouse(4S), termios(3V), win(4S), zs(4S)

     _S_u_n_V_i_e_w _1 _S_y_s_t_e_m _P_r_o_g_r_a_m_m_e_r'_s _G_u_i_d_e

















































Sun Release 4.1   Last change: 6 December 1989                  3



