{
    "content": [
        {
            "type": "text",
            "text": "# mouse(4) (man)\n\n**Summary:** mouse - serial mouse interface\n\n## See Also\n\n- ttyS(4)\n- gpm(8)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **CONFIGURATION** (2 lines)\n- **DESCRIPTION** (1 lines) — 7 subsections\n  - Introduction (29 lines)\n  - Microsoft protocol (9 lines)\n  - 3-button Microsoft protocol (5 lines)\n  - Logitech protocol (6 lines)\n  - Mousesystems protocol (14 lines)\n  - Sun protocol (3 lines)\n  - MM protocol (10 lines)\n- **FILES** (3 lines)\n- **SEE ALSO** (2 lines)\n- **COLOPHON** (7 lines)\n\n## Full Content\n\n### NAME\n\nmouse - serial mouse interface\n\n### CONFIGURATION\n\nSerial mice are connected to a serial RS232/V24 dialout line, see ttyS(4) for a description.\n\n### DESCRIPTION\n\n#### Introduction\n\nThe pinout of the usual 9 pin plug as used for serial mice is:\n\npin   name   used for\n2    RX    Data\n3    TX    -12 V, Imax = 10 mA\n4   DTR    +12 V, Imax = 10 mA\n7   RTS    +12 V, Imax = 10 mA\n5   GND    Ground\n\nThis is the specification, in fact 9 V suffices with most mice.\n\nThe mouse driver can recognize a mouse by dropping RTS to low and raising it again.  About 14\nms later the mouse will send 0x4D ('M') on the data line.  After a further 63  ms,  a  Micro‐\nsoft-compatible 3-button mouse will send 0x33 ('3').\n\nThe  relative  mouse  movement  is  sent  as dx (positive means right) and dy (positive means\ndown).  Various mice can operate at different speeds.  To select speeds,  cycle  through  the\nspeeds  9600, 4800, 2400, and 1200 bit/s, each time writing the two characters from the table\nbelow and waiting 0.1 seconds.  The following table shows available speeds  and  the  strings\nthat select them:\n\nbit/s   string\n9600    *q\n4800    *p\n2400    *o\n1200    *n\n\nThe first byte of a data packet can be used for synchronization purposes.\n\n#### Microsoft protocol\n\nThe Microsoft protocol uses 1 start bit, 7 data bits, no parity and one stop bit at the speed\nof 1200 bits/sec.  Data is sent to RxD in 3-byte packets.  The dx and dy movements  are  sent\nas two's-complement, lb (rb) are set when the left (right) button is pressed:\n\nbyte   d6   d5    d4    d3    d2    d1    d0\n1   1    lb    rb    dy7   dy6   dx7   dx6\n2   0    dx5   dx4   dx3   dx2   dx1   dx0\n3   0    dy5   dy4   dy3   dy2   dy1   dy0\n\n#### 3-button Microsoft protocol\n\nOriginal  Microsoft  mice  only  have two buttons.  However, there are some three button mice\nwhich also use the Microsoft protocol.  Pressing or releasing the middle button  is  reported\nby  sending  a packet with zero movement and no buttons pressed.  (Thus, unlike for the other\ntwo buttons, the status of the middle button is not reported in each packet.)\n\n#### Logitech protocol\n\nLogitech serial 3-button mice use a different extension of the Microsoft protocol:  when  the\nmiddle  button  is  up,  the  above  3-byte packet is sent.  When the middle button is down a\n4-byte packet is sent, where the 4th byte has value 0x20 (or at least has the 0x20 bit  set).\nIn  particular,  a press of the middle button is reported as 0,0,0,0x20 when no other buttons\nare down.\n\n#### Mousesystems protocol\n\nThe Mousesystems protocol uses 1 start bit, 8 data bits, no parity and two stop bits  at  the\nspeed of 1200 bits/sec.  Data is sent to RxD in 5-byte packets.  dx is sent as the sum of the\ntwo two's-complement values, dy is send as negated sum of the  two  two's-complement  values.\nlb (mb, rb) are cleared when the left (middle, right) button is pressed:\n\nbyte   d7    d6     d5     d4     d3     d2     d1     d0\n1   1     0      0      0      0      lb     mb     rb\n2   0    dxa6   dxa5   dxa4   dxa3   dxa2   dxa1   dxa0\n3   0    dya6   dya5   dya4   dya3   dya2   dya1   dya0\n4   0    dxb6   dxb5   dxb4   dxb3   dxb2   dxb1   dxb0\n5   0    dyb6   dyb5   dyb4   dyb3   dyb2   dyb1   dyb0\n\nBytes 4 and 5 describe the change that occurred since bytes 2 and 3 were transmitted.\n\n#### Sun protocol\n\nThe  Sun  protocol  is the 3-byte version of the above 5-byte Mousesystems protocol: the last\ntwo bytes are not sent.\n\n#### MM protocol\n\nThe MM protocol uses 1 start bit, 8 data bits, odd parity and one stop bit at  the  speed  of\n1200  bits/sec.   Data is sent to RxD in 3-byte packets.  dx and dy are sent as single signed\nvalues, the sign bit indicating a negative value.  lb (mb, rb) are set when the left (middle,\nright) button is pressed:\n\nbyte   d7   d6    d5    d4    d3    d2    d1    d0\n1   1     0     0    dxs   dys   lb    mb    rb\n2   0    dx6   dx5   dx4   dx3   dx2   dx1   dx0\n3   0    dy6   dy5   dy4   dy3   dy2   dy1   dy0\n\n### FILES\n\n/dev/mouse\nA commonly used symbolic link pointing to a mouse device.\n\n### SEE ALSO\n\nttyS(4), gpm(8)\n\n### COLOPHON\n\nThis  page  is  part  of  release  5.10 of the Linux man-pages project.  A description of the\nproject, information about reporting bugs, and the latest version of this page, can be  found\nat https://www.kernel.org/doc/man-pages/.\n\n\n\nLinux                                        2020-08-13                                     MOUSE(4)\n\n"
        }
    ],
    "structuredContent": {
        "command": "mouse",
        "section": "4",
        "mode": "man",
        "summary": "mouse - serial mouse interface",
        "synopsis": null,
        "flags": [],
        "examples": [],
        "see_also": [
            {
                "name": "ttyS",
                "section": "4",
                "url": "https://www.chedong.com/phpMan.php/man/ttyS/4/json"
            },
            {
                "name": "gpm",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/gpm/8/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "CONFIGURATION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Introduction",
                        "lines": 29
                    },
                    {
                        "name": "Microsoft protocol",
                        "lines": 9
                    },
                    {
                        "name": "3-button Microsoft protocol",
                        "lines": 5
                    },
                    {
                        "name": "Logitech protocol",
                        "lines": 6
                    },
                    {
                        "name": "Mousesystems protocol",
                        "lines": 14
                    },
                    {
                        "name": "Sun protocol",
                        "lines": 3
                    },
                    {
                        "name": "MM protocol",
                        "lines": 10
                    }
                ]
            },
            {
                "name": "FILES",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COLOPHON",
                "lines": 7,
                "subsections": []
            }
        ]
    }
}