1MOUSE(4)                   Linux Programmer's Manual                  MOUSE(4)
2
3
4

NAME

6       mouse - serial mouse interface
7

CONFIGURATION

9       Serial  mice  are  connected  to  a  serial RS232/V24 dialout line, see
10       ttyS(4) for a description.
11

DESCRIPTION

13   Introduction
14       The pinout of the usual 9 pin plug as used for serial mice is:
15
16                          pin   name   used for
17                            2    RX    Data
18                            3    TX    -12 V, Imax = 10 mA
19                            4   DTR    +12 V, Imax = 10 mA
20                            7   RTS    +12 V, Imax = 10 mA
21                            5   GND    Ground
22
23       This is the specification, in fact 9 V suffices with most mice.
24
25       The mouse driver can recognize a mouse by dropping RTS to low and rais‐
26       ing  it again.  About 14 ms later the mouse will send 0x4D ('M') on the
27       data line.  After a further  63  ms,  a  Microsoft-compatible  3-button
28       mouse will send 0x33 ('3').
29
30       The relative mouse movement is sent as dx (positive means right) and dy
31       (positive means down).  Various mice can operate at  different  speeds.
32       To  select  speeds, cycle through the speeds 9600, 4800, 2400, and 1200
33       bit/s, each time writing the two characters from the  table  below  and
34       waiting  0.1  seconds.   The following table shows available speeds and
35       the strings that select them:
36
37                                   bit/s   string
38                                   9600    *q
39                                   4800    *p
40                                   2400    *o
41                                   1200    *n
42
43       The first byte of a data packet can be used  for  synchronization  pur‐
44       poses.
45
46   Microsoft protocol
47       The Microsoft protocol uses 1 start bit, 7 data bits, no parity and one
48       stop bit at the speed of 1200 bits/sec.  Data is sent to RxD in  3-byte
49       packets.  The dx and dy movements are sent as two's-complement, lb (rb)
50       are set when the left (right) button is pressed:
51
52                    byte   d6   d5    d4    d3    d2    d1    d0
53                       1   1    lb    rb    dy7   dy6   dx7   dx6
54                       2   0    dx5   dx4   dx3   dx2   dx1   dx0
55                       3   0    dy5   dy4   dy3   dy2   dy1   dy0
56
57   3-button Microsoft protocol
58       Original Microsoft mice only have two buttons.  However, there are some
59       three  button  mice which also use the Microsoft protocol.  Pressing or
60       releasing the middle button is reported by sending a packet  with  zero
61       movement  and no buttons pressed.  (Thus, unlike for the other two but‐
62       tons, the status of the middle button is not reported in each packet.)
63
64   Logitech protocol
65       Logitech serial 3-button mice use a different extension of  the  Micro‐
66       soft protocol: when the middle button is up, the above 3-byte packet is
67       sent.  When the middle button is down a 4-byte packet  is  sent,  where
68       the  4th  byte  has  value 0x20 (or at least has the 0x20 bit set).  In
69       particular, a press of the middle button is reported as 0,0,0,0x20 when
70       no other buttons are down.
71
72   Mousesystems protocol
73       The  Mousesystems protocol uses 1 start bit, 8 data bits, no parity and
74       two stop bits at the speed of 1200 bits/sec.  Data is sent  to  RxD  in
75       5-byte packets.  dx is sent as the sum of the two two's-complement val‐
76       ues, dy is send as negated sum of the two two's-complement values.   lb
77       (mb, rb) are cleared when the left (middle, right) button is pressed:
78
79             byte   d7    d6     d5     d4     d3     d2     d1     d0
80                1   1     0      0      0      0      lb     mb     rb
81                2   0    dxa6   dxa5   dxa4   dxa3   dxa2   dxa1   dxa0
82                3   0    dya6   dya5   dya4   dya3   dya2   dya1   dya0
83                4   0    dxb6   dxb5   dxb4   dxb3   dxb2   dxb1   dxb0
84                5   0    dyb6   dyb5   dyb4   dyb3   dyb2   dyb1   dyb0
85
86       Bytes  4  and  5  describe the change that occurred since bytes 2 and 3
87       were transmitted.
88
89   Sun protocol
90       The Sun protocol is the 3-byte version of the above 5-byte Mousesystems
91       protocol: the last two bytes are not sent.
92
93   MM protocol
94       The  MM protocol uses 1 start bit, 8 data bits, odd parity and one stop
95       bit at the speed of 1200 bits/sec.  Data is sent to RxD in 3-byte pack‐
96       ets.  dx and dy are sent as single signed values, the sign bit indicat‐
97       ing a negative value.  lb (mb, rb)  are  set  when  the  left  (middle,
98       right) button is pressed:
99
100                 byte   d7   d6    d5    d4    d3    d2    d1    d0
101                    1   1     0     0    dxs   dys   lb    mb    rb
102                    2   0    dx6   dx5   dx4   dx3   dx2   dx1   dx0
103                    3   0    dy6   dy5   dy4   dy3   dy2   dy1   dy0
104

FILES

106       /dev/mouse
107              A commonly used symbolic link pointing to a mouse device.
108

SEE ALSO

110       ttyS(4), gpm(8)
111

COLOPHON

113       This  page  is  part of release 5.04 of the Linux man-pages project.  A
114       description of the project, information about reporting bugs,  and  the
115       latest     version     of     this    page,    can    be    found    at
116       https://www.kernel.org/doc/man-pages/.
117
118
119
120Linux                             2016-10-08                          MOUSE(4)
Impressum