mirror of
https://github.com/dekuNukem/USB4VC.git
synced 2025-10-31 11:26:46 -07:00
594 lines
27 KiB
HTML
594 lines
27 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en"><head>
|
||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||
<meta charset="utf-8">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
|
||
|
||
<!-- Begin Jekyll SEO tag v2.7.1 -->
|
||
<title>Serial Mice Protocols | Roborooter.com</title>
|
||
<meta name="generator" content="Jekyll v4.2.0">
|
||
<meta property="og:title" content="Serial Mice Protocols">
|
||
<meta property="og:locale" content="en_US">
|
||
<meta name="description" content="I remembered there was such a thing as a serial mouse and I wondered how they worked. A bit of googling found me this link (which as of this posting has an SSL error). I’m going to reproduce it below but I wanted to write some notes about it first.">
|
||
<meta property="og:description" content="I remembered there was such a thing as a serial mouse and I wondered how they worked. A bit of googling found me this link (which as of this posting has an SSL error). I’m going to reproduce it below but I wanted to write some notes about it first.">
|
||
<link rel="canonical" href="https://www.roborooter.com/post/serial-mice/">
|
||
<meta property="og:url" content="https://www.roborooter.com/post/serial-mice/">
|
||
<meta property="og:site_name" content="Roborooter.com">
|
||
<meta property="og:type" content="article">
|
||
<meta property="article:published_time" content="2019-06-17T00:00:00+00:00">
|
||
<meta name="twitter:card" content="summary">
|
||
<meta property="twitter:title" content="Serial Mice Protocols">
|
||
<meta name="twitter:site" content="@reconbot">
|
||
<script type="application/ld+json">
|
||
{"@type":"BlogPosting","dateModified":"2019-06-17T00:00:00+00:00","datePublished":"2019-06-17T00:00:00+00:00","headline":"Serial Mice Protocols","mainEntityOfPage":{"@type":"WebPage","@id":"https://www.roborooter.com/post/serial-mice/"},"url":"https://www.roborooter.com/post/serial-mice/","description":"I remembered there was such a thing as a serial mouse and I wondered how they worked. A bit of googling found me this link (which as of this posting has an SSL error). I’m going to reproduce it below but I wanted to write some notes about it first.","@context":"https://schema.org"}</script>
|
||
<!-- End Jekyll SEO tag -->
|
||
|
||
|
||
|
||
<!-- Site Favicon -->
|
||
<link rel="shortcut icon" href="https://www.roborooter.com/assets/images/favicon.png" type="image/png">
|
||
|
||
<!-- Font Embed Code -->
|
||
<link href="index_files/css.css" rel="stylesheet">
|
||
|
||
<!-- CSS Styles -->
|
||
<link href="index_files/style.css" rel="stylesheet">
|
||
<link rel="alternate" type="application/rss+xml" title="Roborooter.com RSS Feed" href="https://www.roborooter.com/feed/">
|
||
|
||
</head>
|
||
|
||
|
||
|
||
<body class="layout-post">
|
||
<div id="page" class="site">
|
||
<header id="masthead" class="site-header">
|
||
<div class="site-header-wrap">
|
||
<div class="site-header-inside">
|
||
|
||
<div class="site-branding">
|
||
|
||
<p class="profile">
|
||
<a href="https://roborooter.com/">
|
||
<img src="index_files/reconbot.png" alt="'s Picture" class="avatar">
|
||
</a>
|
||
</p>
|
||
<div class="site-identity">
|
||
|
||
<h1 class="site-title">
|
||
<a href="https://roborooter.com/">Roborooter.com</a>
|
||
</h1>
|
||
|
||
|
||
<p class="site-description">Hand crafted bits since Y2K</p>
|
||
|
||
</div><!-- .site-identity -->
|
||
|
||
<button id="menu-toggle" class="menu-toggle"><span class="screen-reader-text">Main Menu</span><span class="icon-menu" aria-hidden="true"></span></button>
|
||
</div><!-- .site-branding -->
|
||
|
||
<nav id="main-navigation" class="site-navigation" aria-label="Main Navigation">
|
||
<div class="site-nav-wrap">
|
||
<div class="site-nav-inside">
|
||
<ul class="menu">
|
||
|
||
|
||
|
||
<li class="menu-item "><a href="https://roborooter.com/">Home</a></li>
|
||
|
||
|
||
|
||
<li class="menu-item "><a href="https://roborooter.com/about/">About Me</a></li>
|
||
|
||
|
||
|
||
<li class="menu-item "><a href="https://roborooter.com/tag/stories/">Stories</a></li>
|
||
|
||
|
||
|
||
<li class="menu-item "><a href="https://roborooter.com/tag/open-source/">Open Source</a></li>
|
||
|
||
</ul>
|
||
|
||
<p class="social-links">
|
||
|
||
<a href="https://twitter.com/reconbot" target="_blank">
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"></path></svg>
|
||
<!--
|
||
Font Awesome Free 5.5.0 by @fontawesome - https://fontawesome.com
|
||
License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||
-->
|
||
</a>
|
||
|
||
|
||
|
||
<a href="https://github.com/reconbot" target="_blank">
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"></path></svg>
|
||
<!--
|
||
Font Awesome Free 5.5.0 by @fontawesome - https://fontawesome.com
|
||
License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||
-->
|
||
</a>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<a href="https://www.linkedin.com/in/francisgulotta" target="_blank">
|
||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"></path></svg>
|
||
<!--
|
||
Font Awesome Free 5.5.0 by @fontawesome - https://fontawesome.com
|
||
License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||
-->
|
||
</a>
|
||
|
||
|
||
|
||
|
||
<a href="https://toot.cafe/@reconbot" target="_blank">
|
||
<svg aria-hidden="true" focusable="false" data-prefix="fab" data-icon="mastodon" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" class="svg-inline--fa fa-mastodon fa-w-14 fa-2x"><path fill="currentColor" d="M433 179.11c0-97.2-63.71-125.7-63.71-125.7-62.52-28.7-228.56-28.4-290.48 0 0 0-63.72 28.5-63.72 125.7 0 115.7-6.6 259.4 105.63 289.1 40.51 10.7 75.32 13 103.33 11.4 50.81-2.8 79.32-18.1 79.32-18.1l-1.7-36.9s-36.31 11.4-77.12 10.1c-40.41-1.4-83-4.4-89.63-54a102.54 102.54 0 0 1-.9-13.9c85.63 20.9 158.65 9.1 178.75 6.7 56.12-6.7 105-41.3 111.23-72.9 9.8-49.8 9-121.5 9-121.5zm-75.12 125.2h-46.63v-114.2c0-49.7-64-51.6-64 6.9v62.5h-46.33V197c0-58.5-64-56.6-64-6.9v114.2H90.19c0-122.1-5.2-147.9 18.41-175 25.9-28.9 79.82-30.8 103.83 6.1l11.6 19.5 11.6-19.5c24.11-37.1 78.12-34.8 103.83-6.1 23.71 27.3 18.4 53 18.4 175z" class=""></path></svg>
|
||
|
||
<!--
|
||
Font Awesome Free 5.5.0 by @fontawesome - https://fontawesome.com
|
||
License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||
-->
|
||
|
||
</a>
|
||
|
||
</p>
|
||
|
||
|
||
</div><!-- .site-nav-inside -->
|
||
</div><!-- .site-nav-wrap -->
|
||
</nav><!-- .site-navigation -->
|
||
|
||
</div><!-- .site-header-inside -->
|
||
</div><!-- .site-header-wrap -->
|
||
</header><!-- .site-header -->
|
||
<div id="content" class="site-content">
|
||
<div class="inner-wide">
|
||
<main id="main" class="site-main">
|
||
<article class="post-full inner">
|
||
<header class="post-header">
|
||
<div class="post-meta">
|
||
<time class="post-date" datetime="2019-06-17">June 17,
|
||
2019</time>
|
||
</div><!-- .post-meta -->
|
||
<h1 class="post-title">Serial Mice Protocols</h1>
|
||
|
||
<div class="post-tags">
|
||
|
||
<a href="https://roborooter.com/tag/serialport/">serialport</a>
|
||
|
||
|
||
<a href="https://roborooter.com/tag/programming/">programming</a>
|
||
|
||
|
||
</div>
|
||
|
||
</header><!-- .post-header -->
|
||
|
||
|
||
<div class="post-content">
|
||
<p>I remembered there was such a thing as a serial mouse and I wondered how they worked. A bit of googling found me <a href="https://www.kryslix.com/nsfaq/Q.12.html">this link</a> (which as of this posting has an SSL error). I’m going to reproduce it below but I wanted to write some notes about it first.</p>
|
||
|
||
<ul>
|
||
<li>The Microsoft Serial Mouse was the most popular mouse as of 1997, supported by and probably copied by all.</li>
|
||
<li>The “resolution” was around 400-1000 CPI (counts per inch)
|
||
compared to a gaming mouse today of around 16,000k. This had to do with
|
||
internal buffering and the speed it updated the location of the movement
|
||
to the computer.</li>
|
||
<li>It could send 40 reports per second, where a report is a 3 byte update describing buttons and x and y changes.</li>
|
||
<li>The original packet format is similar to midi. Each packet is a
|
||
known length (3 bytes). For some unknown reason the first bit of each
|
||
byte is ignored. The second bit is used for synchronizing packets. The
|
||
first byte has the 2nd bit 1, and the following two have it 0.</li>
|
||
<li>Because each byte only has 6 bits of usable data, they split the
|
||
first two bits of each X and Y report off into the first byte. (See the
|
||
awesome ascii art in the document below.) This gives 8 bits of data for
|
||
each X and Y movement in each report (Represented as a signed integer.)</li>
|
||
<li>Logitech expanded the format to 5 bytes (without wasting space) to support their 3 button mice.</li>
|
||
<li>PS2 Also supported 3 buttons and didn’t waste space. It was a bit faster as a standard too.</li>
|
||
<li>I missed that baud rate was mentioned in the article. I guessed 40
|
||
reports a second at 3 bytes a report is 960 bps (bits per second) which
|
||
might have been (at 4 bits per baud) a baud rate of 240. But it’s
|
||
clearly stated “1200bps, 7 databits, 1 stop-bit” for the MS and Logitech
|
||
mouse and “1200bps, 8 databits, 1 stop-bit” for the Mouse Systems
|
||
mouse.</li>
|
||
</ul>
|
||
|
||
<p>This text (which is part of a “not so frequently asked questions”
|
||
section of that site, which states “The information containted in these
|
||
NSFAQ’s have no assurance of accuracy other than I would not
|
||
purposefully put up an inaccurate NSFAQ.”) was curated by Paul Borman
|
||
who copied this section from a Tomi Engdahl. URLs last only as long as
|
||
the organizations do and unfortunately many of these links predate the <a href="https://archive.org/web/web.php">wayback machine</a>. None of the references currently exist however a few were thankfully archived their links have been changed to the archives.</p>
|
||
|
||
<p>Full text of <a href="https://www.kryslix.com/nsfaq/Q.12.html">Subject: What protocol do mice use?</a> with formatting cleanup follows;</p>
|
||
|
||
<h2 id="what-protocol-do-mice-use">What protocol do mice use?</h2>
|
||
|
||
<p>Subject: What protocol do mice use?<br>
|
||
Date: 09/16/97<br>
|
||
Updated: 11/16/00</p>
|
||
|
||
<hr>
|
||
|
||
<p>This document was adapted from a web page produced by <a href="http://www.hut.fi/~then/">Tomi Engdahl <then@delta.hut.fi></a>.</p>
|
||
|
||
<hr>
|
||
|
||
<h3 id="microsoft-serial-mouse">Microsoft serial mouse</h3>
|
||
|
||
<h4 id="description">Description</h4>
|
||
|
||
<p>The Microsoft serial mouse is the most popular 2 button mouse. It is
|
||
supported by all major operating systems. The maximum tracking rate for a
|
||
Microsoft mouse is 40 reports/second * 127 counts per report, in other
|
||
words, 5080 counts per second. The most common range for mice is is 100
|
||
to 400 CPI (counts per inch) but can be up to 1000 CPI. A 100CPI mouse
|
||
can discriminate motion up to 50.8 inches/second while a 400 CPI mouse
|
||
can only discriminate motion up to 12.7 inches/second. </p>
|
||
|
||
<h4 id="pinout">Pinout</h4>
|
||
|
||
<pre><code class="language-ascii-art">9 pin 25 pin Line Comments
|
||
shell 1 GND
|
||
3 2 TD Serial data from host to mouse (only for power)
|
||
2 3 RD Serial data from mouse to host
|
||
7 4 RTS Positive voltage to mouse
|
||
8 5 CTS
|
||
6 6 DSR
|
||
5 7 SGND
|
||
4 20 DTR Positive voltage to mouse and reset/detection
|
||
|
||
RTS = Request to Send CTS = Clear to Send
|
||
DSR = Data Set Ready DTR = Data Terminal Ready
|
||
GND = Protective Ground SGND = Signal Ground
|
||
</code></pre>
|
||
|
||
<p>To function correctly, both the RTS and DTR lines must be positive.
|
||
DTR/DSR and RTS/CTS must NOT be shorted. RTS may be toggled negative for
|
||
at least 100ms to reset the mouse. (After a cold boot, the RTS line is
|
||
usually negative. This provides an automatic toggle when RTS is brought
|
||
positive). When DTR is toggled the mouse should send a single byte 0x45
|
||
(ASCII 'M'). </p>
|
||
|
||
<h4 id="serial-data-parameters">Serial data parameters:</h4>
|
||
|
||
<p>1200bps, 7 databits, 1 stop-bit<br></p>
|
||
|
||
<h4 id="data-packet-format">Data packet format:</h4>
|
||
|
||
<p>Data is sent in 3 byte packets for each event (a button is
|
||
pressed or released or the mouse moves):</p>
|
||
|
||
<pre><code class="language-ascii-art"> D7 D6 D5 D4 D3 D2 D1 D0
|
||
|
||
Byte 1 X 1 LB RB Y7 Y6 X7 X6
|
||
Byte 2 X 0 X5 X4 X3 X2 X1 X0
|
||
Byte 3 X 0 Y5 Y4 Y3 Y2 Y1 Y0
|
||
|
||
LB is the state of the left button (1 means down)
|
||
RB is the state of the right button (1 means down)
|
||
X7-X0 movement in X direction since last packet (signed byte)
|
||
Y7-Y0 movement in Y direction since last packet (signed byte)
|
||
</code></pre>
|
||
|
||
<p>The high order bit of each byte (D7) is ignored. Bit D6 indicates
|
||
the start of an event, which allows the software to synchronize with the
|
||
mouse.</p>
|
||
|
||
<h4 id="graphical-representation-of-a-packet">Graphical representation of a packet</h4>
|
||
|
||
<pre><code class="language-ascii-art"> 1st byte 2nd byte 3rd byte
|
||
================ =============== ================
|
||
- 1 ? ? Y Y X X - 0 X X X X X X - 0 Y Y Y Y Y Y
|
||
================ =============== ================
|
||
| | \ / \ / \---------/ \---------/
|
||
| | | | | |
|
||
| | | \----\ | |
|
||
| | \--------|-------|--------\ |
|
||
| | / \ /---------\ / \ /---------\
|
||
| | ================ =================
|
||
| | 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
|
||
Left Button --/ | ================ =================
|
||
Right Button ----/ X increment Y increment
|
||
</code></pre>
|
||
|
||
<h4 id="3-button-logitech-extension">3 Button Logitech extension</h4>
|
||
|
||
<p>
|
||
Logitech extended the 2 button mouse protocol to support 3 button mice
|
||
by adding a 4th byte when the middle button is pressed (and the first
|
||
packet after it is released). If a 4th byte is encountered (i.e., an
|
||
extra byte with D6 set to 0) then D5 of that byte (0x20) indicates the
|
||
status of the middle mouse button.
|
||
</p>
|
||
|
||
<h3 id="mouse-systems-mouse">Mouse systems mouse</h3>
|
||
|
||
<h4 id="serial-data-parameters-1">Serial data parameters:</h4>
|
||
|
||
<p>1200bps, 8 databits, 1 stop-bit<br></p>
|
||
|
||
<h4 id="5-byte-mouse-systems-packet">5 byte Mouse Systems packet</h4>
|
||
|
||
<pre><code class="language-ascii-art"> D7 D6 D5 D4 D3 D2 D1 D0
|
||
|
||
Byte 1 1 0 0 0 0 LB CB RB
|
||
Byte 2 X7 X6 X5 X4 X3 X2 X1 X0
|
||
Byte 3 Y7 Y6 Y5 Y4 Y3 Y4 Y1 Y0
|
||
Byte 4 X7' X6' X5' X4' X3' X2' X1' X0'
|
||
Byte 5 Y7' Y6' Y5' Y4' Y3' Y4' Y1' Y0'
|
||
|
||
LB is left button state (0=pressed, 1=released)
|
||
CB is center button state (0=pressed, 1=released)
|
||
RB is right button state (0=pressed, 1=released)
|
||
X7-X0 movement in X direction since last packet in signed byte
|
||
format (-128..+127), positive direction right
|
||
Y7-Y0 movement in Y direction since last packet in signed byte
|
||
format (-128..+127), positive direction up
|
||
X7'-X0' movement in X direction since sending of X7-X0 packet in signed byte
|
||
format (-128..+127), positive direction right
|
||
Y7'-Y0' movement in Y direction since sending of Y7-Y0 in signed byte
|
||
format (-128..+127), positive direction up
|
||
</code></pre>
|
||
|
||
<p>The last two bytes in the packet (bytes 4 and 5) contain information
|
||
about movement data changes which have occurred after data bytes 2 and 3
|
||
have been sent.</p>
|
||
|
||
<h3 id="ps2-mouse">PS/2 mouse</h3>
|
||
|
||
<p>The standard PS/2 mouse (such as the Logitech mouse) defaults to 160
|
||
CPI and can be switched to 40, 80, 160 or 320 CPI via software. The
|
||
Microsoft mouse driver for Windows 3.x and Windows 95 defaults to 160
|
||
counts per inch. The maximum tracking rate for PS/2 mouse is 40
|
||
reports/second * 255 counts per report, or 10200 counts per second. A
|
||
100 CPI mouse could discriminate motion up to 102 inches per second
|
||
while a 400 CPI mouse could discriminate motion up to 25.2 inches per
|
||
second.</p>
|
||
|
||
<h4 id="connector-pinout">Connector pinout</h4>
|
||
|
||
<pre><code class="language-ascii-art">Pin Wire Name
|
||
1 DATA
|
||
2 Reserved
|
||
3 Ground
|
||
4 +5V Supply
|
||
5 CLK
|
||
6 Reserved
|
||
Shield Chassis
|
||
</code></pre>
|
||
|
||
<h4 id="packet-format">Packet Format</h4>
|
||
|
||
<pre><code class="language-ascii-art"> D7 D6 D5 D4 D3 D2 D1 D0
|
||
Byte 1 XV XV YS XS 1 M R L
|
||
Byte 2 X7 X6 X5 X4 X3 X2 X1 X0
|
||
Byte 3 Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
|
||
|
||
L Left button state (1 = pressed down)
|
||
M Middle button state (1 = pressed down)
|
||
R Right button state (1 = pressed down)
|
||
X0-X7 Movement in X direction
|
||
Y0-Y7 Movement in Y direction
|
||
XS,YS Movement data sign bits (1 = negative)
|
||
XV,YV Movement data overflow bits (1 = overflow has occurred)
|
||
</code></pre>
|
||
|
||
<h4 id="physical-connector">Physical connector</h4>
|
||
|
||
<p>The PS/2 mouse connector has the following pinout when looking at the connector on the back of the computer:</p>
|
||
|
||
<pre><code class="language-ascii-art"> 4 u 6
|
||
1 . 2
|
||
3 5
|
||
|
||
1. GND
|
||
2. +5V
|
||
3. DATA
|
||
4. CLOCK
|
||
5. Not used
|
||
6. Not used
|
||
</code></pre>
|
||
|
||
<p>Bi-directional transmission is controlled by the CLK and DATA lines.
|
||
Both are fed by an open collector device which lets either host or
|
||
mouse force the line to "0". During non-transmission, CLK is at "1" and
|
||
DATA can be at "0" or "1".</p>
|
||
|
||
<p>The host can inhibit mouse transmission by forcing CLK to "0". If the
|
||
host inhibits the mouse while it is transmitting, the byte must be
|
||
retransmitted (if the inhibit state arrived before the 11th clock). </p>
|
||
|
||
<p>Receiving data: Check 'clock'. If inactive, there is a bit on the
|
||
'data' line. Each transmission unit is one start bit, eight data bits,
|
||
odd parity and one stop bit. Start bits are low, stop bits high. Each
|
||
clock active or inactive period is 30 to 50 microseconds. Data
|
||
transition to falling edge of clock is 5 to 25 microseconds.</p>
|
||
|
||
<p>Sending: Check that both clock and data are high. Pull down
|
||
data for start bit, and start clocking.</p>
|
||
|
||
<p> NOTE: Logitech has made the extension to this protocol to allow three buttons (the M bit is always 0 on 2 button mice).</p>
|
||
|
||
<h2 id="references">References</h2>
|
||
|
||
<ul>
|
||
<li><a href="https://web.archive.org/web/20040611215222/http://www.hut.fi/~then/mytexts/mouse.html">Original PC mouse info page by Tomi Engdahl</a></li>
|
||
<li>PC Magazine May 28, 1991</li>
|
||
<li><a href="ftp://x2ftp.oulu.fi/pub/msdos/programming/docs/gmouse.doc">Programmer's Reference to Genius Mouse</a></li>
|
||
<li><a href="ftp://ftp.logitech.com/pub/TechSupport/MOUSE/HELP/1410.txt">Logitech Pointing Device Hardware Information Product Support Document # 1410</a></li>
|
||
<li><a href="http://box.argonet.co.uk/users/4qd/meece.html">Mice: How do they work?</a> by <a href="mailto:4qd@argonet.co.uk">Richard Torrens</a></li>
|
||
<li>In Pursuit Of The Perfect Portable Pointer by Intelink Electronics from <a href="http://www.ednprodmag.com/">EDN Products Edition</a> April 16, 1977 pages 43-45</li>
|
||
<li><a href="https://web.archive.org/web/20090328235100/http://www.geocities.com/SiliconValley/2151/mouse.html">Programming the Microsoft Mouse</a></li>
|
||
</ul>
|
||
|
||
</div>
|
||
<footer class="post-footer">
|
||
|
||
</footer>
|
||
|
||
</article>
|
||
|
||
<section class="read-next inner">
|
||
<h2 class="read-next-title">Read Next</h2>
|
||
|
||
<article class="post">
|
||
<header class="post-header">
|
||
<div class="post-meta">
|
||
<time class="published" datetime="June 1, 2019">June 1, 2019</time>
|
||
</div>
|
||
<h3 class="post-title"><a href="https://roborooter.com/post/linux-laptops/">Linux Laptops</a></h3>
|
||
<p class="post-tags">
|
||
|
||
|
||
|
||
<a href="https://roborooter.com/tag/programming/">Programming</a>
|
||
|
||
|
||
|
||
<a href="https://roborooter.com/tag/tech/">Tech</a>
|
||
|
||
|
||
|
||
</p>
|
||
</header>
|
||
</article>
|
||
|
||
|
||
<article class="post">
|
||
<header class="post-header">
|
||
<div class="post-meta">
|
||
<time class="published" datetime="June 20, 2019">June 20, 2019</time>
|
||
</div>
|
||
<h3 class="post-title"><a href="https://roborooter.com/post/Serialport-States/">Serialport States</a></h3>
|
||
<p class="post-tags">
|
||
|
||
|
||
|
||
<a href="https://roborooter.com/tag/serialport/">Serialport</a>
|
||
|
||
|
||
|
||
<a href="https://roborooter.com/tag/programming/">Programming</a>
|
||
|
||
|
||
|
||
</p>
|
||
</header>
|
||
</article>
|
||
|
||
</section><!-- .read-next -->
|
||
|
||
<!-- Create a sorted array of tags -->
|
||
|
||
<section class="tagcloud inner">
|
||
<h2 class="tagcloud-title">Tags</h2>
|
||
<div class="tag-links">
|
||
|
||
<a href="https://roborooter.com/tag/noc/">NOC</a>
|
||
|
||
<a href="https://roborooter.com/tag/the-%20internet-%20i-%20wish-%20we-%20had/">The Internet I Wish We Had</a>
|
||
|
||
<a href="https://roborooter.com/tag/books/">books</a>
|
||
|
||
<a href="https://roborooter.com/tag/comic/">comic</a>
|
||
|
||
<a href="https://roborooter.com/tag/cool/">cool</a>
|
||
|
||
<a href="https://roborooter.com/tag/decentnet/">decentnet</a>
|
||
|
||
<a href="https://roborooter.com/tag/dreams/">dreams</a>
|
||
|
||
<a href="https://roborooter.com/tag/food/">food</a>
|
||
|
||
<a href="https://roborooter.com/tag/freedoms/">freedoms</a>
|
||
|
||
<a href="https://roborooter.com/tag/friends/">friends</a>
|
||
|
||
<a href="https://roborooter.com/tag/funny/">funny</a>
|
||
|
||
<a href="https://roborooter.com/tag/geek/">geek</a>
|
||
|
||
<a href="https://roborooter.com/tag/home/">home</a>
|
||
|
||
<a href="https://roborooter.com/tag/journalism/">journalism</a>
|
||
|
||
<a href="https://roborooter.com/tag/life/">life</a>
|
||
|
||
<a href="https://roborooter.com/tag/livestream/">livestream</a>
|
||
|
||
<a href="https://roborooter.com/tag/love/">love</a>
|
||
|
||
<a href="https://roborooter.com/tag/movies/">movies</a>
|
||
|
||
<a href="https://roborooter.com/tag/music/">music</a>
|
||
|
||
<a href="https://roborooter.com/tag/nodebots/">nodebots</a>
|
||
|
||
<a href="https://roborooter.com/tag/open-source/">open-source</a>
|
||
|
||
<a href="https://roborooter.com/tag/photos/">photos</a>
|
||
|
||
<a href="https://roborooter.com/tag/politics/">politics</a>
|
||
|
||
<a href="https://roborooter.com/tag/programming/">programming</a>
|
||
|
||
<a href="https://roborooter.com/tag/project/">project</a>
|
||
|
||
<a href="https://roborooter.com/tag/school/">school</a>
|
||
|
||
<a href="https://roborooter.com/tag/serialport/">serialport</a>
|
||
|
||
<a href="https://roborooter.com/tag/stories/">stories</a>
|
||
|
||
<a href="https://roborooter.com/tag/tech/">tech</a>
|
||
|
||
<a href="https://roborooter.com/tag/tibet/">tibet</a>
|
||
|
||
<a href="https://roborooter.com/tag/work/">work</a>
|
||
|
||
<a href="https://roborooter.com/tag/writing/">writing</a>
|
||
|
||
</div><!-- .tag-links -->
|
||
</section><!-- .tagcloud -->
|
||
|
||
</main><!-- .site-main -->
|
||
|
||
|
||
|
||
|
||
|
||
<footer id="colophon" class="site-footer">
|
||
<p class="site-info inner">
|
||
<a href="https://roborooter.com/">Roborooter.com</a> © 2021.
|
||
<br>
|
||
Powered by <a target="_blank" href="https://jekyllrb.com/">Jekyll</a> and <a target="_blank" href="https://github.com/features/actions">GitHub
|
||
Actions</a>.
|
||
</p>
|
||
<a id="back-to-top" class="back-to-top" href="#page">
|
||
<span class="icon-arrow-up" aria-hidden="true"></span>
|
||
<span class="screen-reader-text">Back to top</span>
|
||
</a>
|
||
</footer>
|
||
|
||
</div><!-- .inner-wide -->
|
||
</div><!-- .site-content -->
|
||
</div><!-- .site -->
|
||
|
||
|
||
<!-- Javascript Assets -->
|
||
<script src="index_files/jquery-3.js"></script>
|
||
<script src="index_files/plugins.js"></script>
|
||
<script src="index_files/custom.js"></script>
|
||
|
||
|
||
|
||
|
||
</body></html> |