mouse(7)


mouse -- mouse device driver for bus, serial, and PS/2 mouse devices

Description

The mouse device driver supports several types of mouse devices:

The driver will support multiple mouse applications running in virtual terminal screens, both under the UNIX System and MS-DOS via SimulTask, VP/ix, Merge, or another similar product.

Support for mouse administration is also provided. See mouseadmin(1).

The following ioctl commands are supported:


MOUSEIOCMON
Used exclusively by /usr/lib/mousemgr to receive open and close commands from /dev/mouse driver.

MOUSEISOPEN
Used exclusively by mouseadmin. Returns 16-byte character array indicating which mouse devices are currently open; 1 is open, 0 is not open. The array is in the linear order established by /usr/bin/mouseadmin in building the display and device map pairs.

MOUSEIOCCONFIG
Used exclusively by mouseadmin to configure display and mouse pairs. The mse_cfg data structure is used to pass display and device mapping and map pair count information to the driver:
   struct mse_cfg {
          struct mousemap *mapping;
          unsigned    count;
   }
   struct mousemap {
          dev_t    disp_dev;
          dev_t    mse_dev;
   }
          int      type;

MOUSEIOCREAD
Read mouse position and status data. The following data structure is used to return mouse position information to a user application:

   struct mouseinfo {
          unsigned char status;
          char          xmotion:
          char          ymotion;
   }

MOUSEIOCREAD will set errno to EFAULT for failure to return a valid mouseinfo structure. The status byte contains the button state information according to the following format:

   0 Mv Lc Mc Rc L M R
where:

Mv:
is 1 if the mouse has moved since last MOUSEIOCREAD

Lc:
is 1 if Left button has changed state since last MOUSEIOCREAD

Mc:
is 1 if Middle button has changed state since last MOUSEIOCREAD

Rc:
is 1 if Right button has changed state since last MOUSEIOCREAD

L:
current state of Left button (1 == depressed)

M:
current state of Middle button

R:
current state of Right button

The Mv bit is required because the total x and y delta since the last MOUSEIOCREAD ioctl could be 0 yet the mouse may have been moved. The Lc, Mc, and Rc bits are required for a similar reason; if a button had been pushed and released since the last MOUSEIOCREAD ioctl, the current state bit would be unchanged but the application would want to know the button had been pushed.

The xmotion and ymotion fields are signed quantities relative to the previous position in the range -127 to 127. Deltas that would overflow a signed char have been truncated.


MOUSE320
Used to send commands and receive responses from the PS/2 compatible mouse devices. Failed MOUSE320 commands will return ENXIO as the errno value. The following data structure is used to pass commands, status, and position information between the driver and a user application:
   struct cmd_320 {
          int      cmd;
          int      arg1;
          int      arg2;
          int      arg3;
   }

Valid commands for the PS/2 compatible devices are as follows:


MSERESET
Reset mouse.

MSERESEND
Resend last data.

MSESETDEF
Set default status.

MSEOFF
Disable mouse.

MSEON
Enable mouse.

MSESPROMPT
Set prompt mode.

MSEECHON
Set echo mode.

MSEECHOFF
Reset echo mode.

MSESTREAM
Set stream mode.

MSESETRES
Set resolution (counts per millimeter). Valid arg1 values are as follows:

00 = 1 count/mm.
01 = 2 count/mm.
02 = 4 count/mm.
03 = 8 count/mm.


MSESCALE2
Set 2:1 scaling.

MSESCALE1
Set 1:1 scaling.

MSECHGMOD
Set sampling rate (reports per second). Valid arg1 values are as follows:

0A = 10 reports/sec.
14 = 20 reports/sec.
28 = 40 reports/sec.
3C = 60 reports/sec.
50 = 80 reports/sec.
64 = 100 reports/sec.
C8 = 200 reports/sec.


MSEGETDEV
read device type returns a zero (0) for the PS/2 compatible mouse.

MSEREPORT
Read mouse report returns three-byte mouse/button position where bytes two and three are 9-bit 2's complement relative motions with the 9th bit (sign bit) coming from byte 1.

Byte 1


b0 - left button (1 == depressed)
b1 - right button
b2 - middle button
b3 - always 1
b4 - X data sign (1 == negative)
b5 - Y data sign
b6 - X data overflow
b7 - Y data overflow


Byte 2


X axis position data


Byte 3


Y axis position data


MSESTATREQ
Status request returns three-byte report with the following format:

Byte 1


b0 - right button (1 == depressed)
b1 - middle button
b2 - left button
b3 - always 0
b4 - scaling 1:1 = 0, 2:1 = 1
b5 - disabled(0)/enabled(1)
b6 - stream(0)/prompt(1) mode
b7 - always 0


Byte 2


b0 - 6 current resolution
b7 - always 0


Byte 3


b0 - 7 current sampling rate


MSETIMEOUT
Specifies the timing window for the emulation of the middle mouse button on a 2 button mouse. The range is from 10ms to 100ms. If the user presses the left mouse button and the right mouse button within this timing window, a middle button event is generated.

Files

   /dev/mouse
   /usr/lib/mousemgr
   /usr/include/sys/mouse.h

References

mouseadmin(1)

Notices

The mouse also supports queue mode for accessing mouse input, both motion and button events; see display(7) for more information on the KDQUEMODE ioctl.


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004