RES: PS/2 mouse state machine

(1)
I hope that this help you.

http://www.computer-engineering.org/ps2mouse/

(2)
As well as I know, there is a call back that you can request to receive
the control when an interrupt on 8042 happens.
See MouFilter_IsrHook on DDK.
In this case, you must know the state machine to build a
MOUSE_INPUT_DATA
mk:4d6a.htm> structure. Otherwise, the state machine is kept only in
i8042prt.

Regards,
Fernando Roberto da Silva.

-----Mensagem original-----
De: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] Em nome de S. Drasnin
Enviada em: segunda-feira, 21 de novembro de 2005 15:48
Para: Windows System Software Devs Interest List
Assunto: [ntdev] PS/2 mouse state machine

(1) Is there any documentation besides the code in the i8042prt sample
DDK driver that describes the mouse state machine?

I’m about to look at the code in detail - my understanding so far is
that 3 bytes get received for every interrupt.

(2) One thing I’m not sure of yet (since I haven’t looked at the code in
detail) is if the state machine is only maintained in the device driver?
Does it rely on any sentinels received in the mouse data to adjust the
mouse state, or is the mouse data simply raw data? (For example, does
the mouse send a byte indicating that it’s about to send x position data
before it sends the x position data? Or does it assume that the driver
knows that the following bytes are x position data based on it
maintaining an internal state machine.)

thanks


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com</mk:>

S. Drasnin wrote:

(1) Is there any documentation besides the code in the i8042prt sample
DDK driver that describes the mouse state machine?

I’m about to look at the code in detail - my understanding so far is
that 3 bytes get received for every interrupt.

Some mice send 3-byte packets. Some send 4-byte packets. The state
machine is an implementation detail of the i8042prt driver; I don’t
think you’ll find anything written elsewhere.

(2) One thing I’m not sure of yet (since I haven’t looked at the code
in detail) is if the state machine is only maintained in the device
driver? Does it rely on any sentinels received in the mouse data to
adjust the mouse state, or is the mouse data simply raw data? (For
example, does the mouse send a byte indicating that it’s about to send
x position data before it sends the x position data? Or does it assume
that the driver knows that the following bytes are x position data
based on it maintaining an internal state machine.)

The state machine is strictly internal to the ISR within i8042prt.
There are very few state transitions; it’s almost entirely based on byte
count. There is some special code to detect resets, which causes the
state machine to start over again.

I’m curious to know why you 'd ask. This is a fairly mundane and
relatively unimportant implementation detail. What are you planning to do?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

No, you get 1 byte per interrupt, and you have to keep track of whether
it’s the first, second, or third (or maybe fourth) byte yourself. There
aren’t any reliable sentinels in the data itself, though there are some
heuristics you can use that work most of the time.

Isn’t PS/2 fun?

Actually for a mouse filter driver, though, unless you’re doing
something strange like operating a non-standard mouse-like device, you
can use the i8042prt’s InputState in your ISR to help you keep track of
the bytes. This is one of the fields passed into your ISR callback. If
it’s MouseIdle, that’s the first byte.

S. Drasnin wrote:

(1) Is there any documentation besides the code in the i8042prt sample
DDK driver that describes the mouse state machine?

I’m about to look at the code in detail - my understanding so far is
that 3 bytes get received for every interrupt.

(2) One thing I’m not sure of yet (since I haven’t looked at the code in
detail) is if the state machine is only maintained in the device driver?
Does it rely on any sentinels received in the mouse data to adjust the
mouse state, or is the mouse data simply raw data? (For example, does
the mouse send a byte indicating that it’s about to send x position data
before it sends the x position data? Or does it assume that the driver
knows that the following bytes are x position data based on it
maintaining an internal state machine.)

thanks


Ray

I’ve always thought that the ps/2 design was done by an IBM summer intern in boca raton in the early 80s :wink:

d


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
Sent: Monday, November 21, 2005 9:48 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] PS/2 mouse state machine

(1) Is there any documentation besides the code in the i8042prt sample DDK driver that describes the mouse state machine?
?
I’m about to look at the code in detail - my understanding so far is that 3 bytes get received for every interrupt.
?
(2) One thing I’m not sure of yet (since I haven’t looked at the code in detail) is if the state machine is only maintained in the device driver? Does it rely on any sentinels received in the mouse data to adjust the mouse state, or is the mouse data simply raw data? (For example, does the mouse send a byte indicating that it’s about to send x position data before it sends the x position data? Or does it assume that the driver knows that the following bytes are x position data based on it maintaining an internal state machine.)
?
thanks


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

You know, for many years I thought I had invented that joke (well, ok,
my version was “from a community college” rather than “in boca raton”,
but hey same idea).

Then I met a guy claiming to have been the summer intern that actually
*did* design the PS/2 interface, so I’m guessing I just heard it
somewhere (I don’t remember who it was, but I ran into him at WinHEC
this last year).

I’m even more amazed by the fact that someone would actually admit to it
:-).

Doron Holan wrote:

I’ve always thought that the ps/2 design was done by an IBM summer intern in boca raton in the early 80s :wink:

d


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
Sent: Monday, November 21, 2005 9:48 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] PS/2 mouse state machine

(1) Is there any documentation besides the code in the i8042prt sample DDK driver that describes the mouse state machine?

I’m about to look at the code in detail - my understanding so far is that 3 bytes get received for every interrupt.

(2) One thing I’m not sure of yet (since I haven’t looked at the code in detail) is if the state machine is only maintained in the device driver? Does it rely on any sentinels received in the mouse data to adjust the mouse state, or is the mouse data simply raw data? (For example, does the mouse send a byte indicating that it’s about to send x position data before it sends the x position data? Or does it assume that the driver knows that the following bytes are x position data based on it maintaining an internal state machine.)

thanks


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


Ray

Thanks to everybody who responded (including biting humor). I figured out what I needed for the situation when the interrupts are firing and mouse data was coming across - not a big hairy state machine to deal with for that case. First byte is a status byte (has overflow bits in it and mouse button flags) and the 2nd and 3rd were the x and y positions.

thanks again…

----- Original Message -----
From: Ray Trentmailto:xxxxx
Newsgroups: ntdev
To: Windows System Software Devs Interest Listmailto:xxxxx
Sent: Monday, November 21, 2005 5:32 PM
Subject: Re:[ntdev] PS/2 mouse state machine

You know, for many years I thought I had invented that joke (well, ok,
my version was “from a community college” rather than “in boca raton”,
but hey same idea).

Then I met a guy claiming to have been the summer intern that actually
did design the PS/2 interface, so I’m guessing I just heard it
somewhere (I don’t remember who it was, but I ran into him at WinHEC
this last year).

I’m even more amazed by the fact that someone would actually admit to it
:-).

Doron Holan wrote:
> I’ve always thought that the ps/2 design was done by an IBM summer intern in boca raton in the early 80s :wink:
>
> d
>
> ________________________________________
> From: xxxxx@lists.osr.commailto:xxxxx [mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
> Sent: Monday, November 21, 2005 9:48 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] PS/2 mouse state machine
>
> (1) Is there any documentation besides the code in the i8042prt sample DDK driver that describes the mouse state machine?
>
> I’m about to look at the code in detail - my understanding so far is that 3 bytes get received for every interrupt.
>
> (2) One thing I’m not sure of yet (since I haven’t looked at the code in detail) is if the state machine is only maintained in the device driver? Does it rely on any sentinels received in the mouse data to adjust the mouse state, or is the mouse data simply raw data? (For example, does the mouse send a byte indicating that it’s about to send x position data before it sends the x position data? Or does it assume that the driver knows that the following bytes are x position data based on it maintaining an internal state machine.)
>
> thanks
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256http:
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.commailto:xxxxx
>
>


Ray


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256http:

You are currently subscribed to ntdev as: xxxxx@msn.commailto:xxxxx
To unsubscribe send a blank email to xxxxx@lists.osr.commailto:xxxxx</mailto:xxxxx></mailto:xxxxx></http:></mailto:xxxxx></http:></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>

You are guaranteed to have to handle a mismatch between the state machine and the bytes received. Bytes will get dropped and other weird issues. The logic is not hairy, but not so simple either.

d


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
Sent: Monday, November 21, 2005 8:25 PM
To: Windows System Software Devs Interest List
Subject: Re: Re:[ntdev] PS/2 mouse state machine

Thanks to everybody who responded (including biting humor). I figured out what I needed for the situation when the interrupts are firing and?mouse data was coming across?- not a big hairy state machine to deal with for that case. First?byte is a status byte (has overflow bits in it and mouse button flags) and the 2nd and 3rd were the x and y positions.
?
thanks again…
?
?
?
?
----- Original Message -----
From: Ray Trent
Newsgroups: ntdev
To: Windows System Software Devs Interest List
Sent: Monday, November 21, 2005 5:32 PM
Subject: Re:[ntdev] PS/2 mouse state machine

You know, for many years I thought I had invented that joke (well, ok,
my version was “from a community college” rather than “in boca raton”,
but hey same idea).

Then I met a guy claiming to have been the summer intern that actually
*did* design the PS/2 interface, so I’m guessing I just heard it
somewhere (I don’t remember who it was, but I ran into him at WinHEC
this last year).

I’m even more amazed by the fact that someone would actually admit to it
:-).

Doron Holan wrote:

I’ve always thought that the ps/2 design was done by an IBM summer intern in boca raton in the early 80s :wink:

d


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
Sent: Monday, November 21, 2005 9:48 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] PS/2 mouse state machine

(1) Is there any documentation besides the code in the i8042prt sample DDK driver that describes the mouse state machine?
?
I’m about to look at the code in detail - my understanding so far is that 3 bytes get received for every interrupt.
?
(2) One thing I’m not sure of yet (since I haven’t looked at the code in detail) is if the state machine is only maintained in the device driver? Does it rely on any sentinels received in the mouse data to adjust the mouse state, or is the mouse data simply raw data? (For example, does the mouse send a byte indicating that it’s about to send x position data before it sends the x position data? Or does it assume that the driver knows that the following bytes are x position data based on it maintaining an internal state machine.)
?
thanks


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@listsosr.com


Ray


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@msn.com
To unsubscribe send a blank email to xxxxx@listsosr.com


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Actually, given the vintage of the PS/2 interface - 1987 if I’m not mistaken, before the PCI bus, hardly after Multibus hit the world, at a time where ISA and EISA were the only PC alternatives, it was quite an improvement. Some of you may have worked with the old IBM PC keyboard, so, you will note the difference. Moreover, the PS/2 was an impressive line of machines, and it was the first time in personal computing where the hardware was described by configuration files (I forget the name of those little files!) and access to it was done through a set of configuration i/o port addresses specifically allocated for the purpose. The interface was so flexible for the time that (1) few if any changes to the 8042 microcode were needed, (2) a simple connector bridged between old and new keyboard interfaces, (3) the changes to the keyboard driver were also minimal, and (4) a very simple extension allowed to connect a mouse to the system using the very same connector interface.

That interface was also the first time that people used a level-triggered interrupt standard, which was a great improvement to the old level-triggered (and hence inflexible) IBM PC and AT interrupts. Some of you guys may remember the battle for interrupt lines, dma channels, and what not, well, not to mention on-board jumpers. True, USB is cool, but the concept already existed in the late sixties and early seventies: you may be able to find some information on the Univac Uniscopes, which used a synchronous multi-drop polling protocol that kind of reminds of USB, and of course the IBM 3270 which came some time later. Le plus ca change, le plus c’est la meme chose!

The PS/2 interface was an example of something that I believe we lost today: simplicity. No PnP. No power management. No bells and whistles. Just plug it in and take it for granted. The only drawback of the interface was, and still is a drawback of most PC protocols, that there’s a huge translation layer between the keyboard and the OS, and that layer obviously belongs in the embedded microprocessor and not in a driver. But that’s a general cancer that we’re not going to get rid of anytime soon, and it may prove to be the undoing of the whole architecture: a huge amount of what we call “device driver” today really belongs in the hardware, specially today after the advances of hardware definition languages.

This brings me good memories. I was working for Wang Microsystems back in 1987 when the PS/2 came to live, and we queued up early morning at the local computer store waiting for it to open so that we could get our hands on the very first machines. We bought a Model 60 and (if my memory doesn’t fail me) a model 80, and took them to the lab. The packaging was absolutely innovative, so much so that even today no existing machine can match it - and we made a little contest among the engineers to see who could unassemble and reassemble the PC in least time.

The whole microchannel concept was very nice and rather innovative, too bad it died such an early death.
----- Original Message -----
From: S. Drasnin
To: Windows System Software Devs Interest List
Sent: Monday, November 21, 2005 11:25 PM
Subject: Re: Re:[ntdev] PS/2 mouse state machine

Thanks to everybody who responded (including biting humor). I figured out what I needed for the situation when the interrupts are firing and mouse data was coming across - not a big hairy state machine to deal with for that case. First byte is a status byte (has overflow bits in it and mouse button flags) and the 2nd and 3rd were the x and y positions.

thanks again…

----- Original Message -----
From: Ray Trent
Newsgroups: ntdev
To: Windows System Software Devs Interest List
Sent: Monday, November 21, 2005 5:32 PM
Subject: Re:[ntdev] PS/2 mouse state machine

You know, for many years I thought I had invented that joke (well, ok,
my version was “from a community college” rather than “in boca raton”,
but hey same idea).

Then I met a guy claiming to have been the summer intern that actually
*did* design the PS/2 interface, so I’m guessing I just heard it
somewhere (I don’t remember who it was, but I ran into him at WinHEC
this last year).

I’m even more amazed by the fact that someone would actually admit to it
:-).

Doron Holan wrote:
> I’ve always thought that the ps/2 design was done by an IBM summer intern in boca raton in the early 80s :wink:
>
> d
>
> ________________________________________
> From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
> Sent: Monday, November 21, 2005 9:48 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] PS/2 mouse state machine
>
> (1) Is there any documentation besides the code in the i8042prt sample DDK driver that describes the mouse state machine?
>
> I’m about to look at the code in detail - my understanding so far is that 3 bytes get received for every interrupt.
>
> (2) One thing I’m not sure of yet (since I haven’t looked at the code in detail) is if the state machine is only maintained in the device driver? Does it rely on any sentinels received in the mouse data to adjust the mouse state, or is the mouse data simply raw data? (For example, does the mouse send a byte indicating that it’s about to send x position data before it sends the x position data? Or does it assume that the driver knows that the following bytes are x position data based on it maintaining an internal state machine.)
>
> thanks
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> To unsubscribe send a blank email to xxxxx@listsosr.com
>
>


Ray


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@msn.com
To unsubscribe send a blank email to xxxxx@listsosr.com


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Alberto Moreira wrote:

*/Actually, given the vintage of the PS/2 interface - 1987 if I’m not
mistaken, before the PCI bus, hardly after Multibus hit the world, at
a time where ISA and EISA were the only PC alternatives, it was quite
an improvement./*

The IBM PS/2 and the Micro Channel Architecture bus were introduced in 1987.

At the time, ISA was the ONLY alternative. EISA was created in response
to MCA, and VLB in response to that. PCI work did not begin until 1990.

However, the PS/2 keyboard and mouse interfaces are unrelated to MCA,
except that they first appeared on the same systems. The PS/2 keyboard
interface is identical to the AT keyboard interface (except that the
connector has one additional pin), and the PS/2 mouse interface was
little more than a wrapper around a serial port.

*/ Some of you may have worked with the old IBM PC keyboard, so, you
will note the difference. Moreover, the PS/2 was an impressive line of
machines, and it was the first time in personal computing where the
hardware was described by configuration files (I forget the name of
those little files!) and access to it was done through a set of
configuration i/o port addresses specifically allocated for the purpose./*

EISA called them, oddly enough, “configuration files”, with a .CFG
extension.

*/The PS/2 interface was an example of something that I believe we
lost today: simplicity. No PnP. No power management. No bells and
whistles./*

You mean “Micro Channel” interface, not “PS/2” interface, right? The
PS/2 keyboard and mouse interfaces were anything but revolutionary.
They were just a repackaged version of what already existed.

I’m not actually sure what you’re trying to say here. PnP is a software
thing, and I doubt there is a single person who would argue that
hardware power management is a bad thing. It’s tricky to manage in
software, but it would have been tricky with Micro Channel as well.

*/This brings me good memories. I was working for Wang
Microsystems back in 1987 when the PS/2 came to live, and we queued
up early morning at the local computer store waiting for it to open so
that we could get our hands on the very first machines. We bought a
Model 60 and (if my memory doesn’t fail me) a model 80, and took them
to the lab. The packaging was absolutely innovative, so much so that
even today no existing machine can match it - and we made a little
contest among the engineers to see who could unassemble and reassemble
the PC in least time./*

I think your memory is enhancing things a bit. Micro Channel boards
were easy to remove, because they had a big plastic handle at one end,
but there are lots of machines today with cases that are much easier to
disassemble than the PS/2.

*/ /*
*/The whole microchannel concept was very nice and rather innovative,
too bad it died such an early death./*

It died because of predatory licensing demands by IBM, not because of
any serious design flaws.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

I’m not quite sure what you’re suggesting he do here. The i8042prt
driver doesn’t recover from lost bytes either unless you have a wheel
mouse (and even then it’s really more recovering from dropping back into
3-byte mode).

KBCs are often buggy, especially in laptops (believe me, I have the
scars), but a properly functioning KBC can reasonably be relied upon to
deliver all the bytes it receives.

Doron Holan wrote:

You are guaranteed to have to handle a mismatch between the state machine and the bytes received. Bytes will get dropped and other weird issues. The logic is not hairy, but not so simple either.

d


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
Sent: Monday, November 21, 2005 8:25 PM
To: Windows System Software Devs Interest List
Subject: Re: Re:[ntdev] PS/2 mouse state machine

Thanks to everybody who responded (including biting humor). I figured out what I needed for the situation when the interrupts are firing and mouse data was coming across - not a big hairy state machine to deal with for that case. First byte is a status byte (has overflow bits in it and mouse button flags) and the 2nd and 3rd were the x and y positions.

thanks again…

----- Original Message -----
From: Ray Trent
Newsgroups: ntdev
To: Windows System Software Devs Interest List
Sent: Monday, November 21, 2005 5:32 PM
Subject: Re:[ntdev] PS/2 mouse state machine

You know, for many years I thought I had invented that joke (well, ok,
my version was “from a community college” rather than “in boca raton”,
but hey same idea).

Then I met a guy claiming to have been the summer intern that actually
*did* design the PS/2 interface, so I’m guessing I just heard it
somewhere (I don’t remember who it was, but I ran into him at WinHEC
this last year).

I’m even more amazed by the fact that someone would actually admit to it
:-).

Doron Holan wrote:
> I’ve always thought that the ps/2 design was done by an IBM summer intern in boca raton in the early 80s :wink:
>
> d
>
> ________________________________________
> From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
> Sent: Monday, November 21, 2005 9:48 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] PS/2 mouse state machine
>
> (1) Is there any documentation besides the code in the i8042prt sample DDK driver that describes the mouse state machine?
>
> I’m about to look at the code in detail - my understanding so far is that 3 bytes get received for every interrupt.
>
> (2) One thing I’m not sure of yet (since I haven’t looked at the code in detail) is if the state machine is only maintained in the device driver? Does it rely on any sentinels received in the mouse data to adjust the mouse state, or is the mouse data simply raw data? (For example, does the mouse send a byte indicating that it’s about to send x position data before it sends the x position data? Or does it assume that the driver knows that the following bytes are x position data based on it maintaining an internal state machine.)
>
> thanks
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> To unsubscribe send a blank email to xxxxx@listsosr.com
>
>


Ray

The problems with the PS/2 “bus” are too numerous to list completely. It
was a clever hack, granted, but a more experienced bus designer would
have avoided the race conditions and weird limitations. Here are just a
few of the many problems with PS/2:

  1. The use of the same pair of I/O ports for the keyboard and mouse was
    incredibly gratuitous. It would have cost almost nothing to have mice
    use a different pair of I/O ports (modern KBCs use ports 62 and 66 for
    battery management, for example), which would have allowed you to have 2
    separate drivers for mice and keyboards that you could be pretty sure
    wouldn’t interfere with each other. That would have saved me about $500
    in ibuprofen alone (and let’s not talk about the anti-depressants :-).

  2. The number of races conditions present in the specification is large.
    For example, there’s no safe way to talk to the device during operation,
    (for certain in polled mode, and maybe not using interrupts either),
    because there’s no way to be guaranteed not to drop one or more device
    bytes in the process. Luckily, for most simple uses you only need to
    talk to it at initialization, but it’s a really annoying limitation.

  3. Admittedly, this next one is simply a bad design decision in the
    original i8042 firmware, but sending a byte to the KBC that requires a
    KBC response (e.g. asking for the command byte so you can disable
    interrupts safely) will trash any byte from a device that happens to be
    in the output buffer (because they didn’t have any place else to store
    it, apparently). Interestingly, as far as I know all subsequent
    implementations of the PS/2 KBC have slavishly copied this broken
    behavior, which is one of the major sources of race conditions.

  4. I don’t even want to talk about how many headaches the inability of
    even later generations of PS/2 KBC designers to add an inherent PnP
    mechanism has cost me. Yes, there are kludgy workarounds that you can
    put into the BIOS, but geez.

  5. There’s no out-of-band packet synchronization mechanism. Every
    possible byte is valid for any location in any packet. This means that
    you either have to resort to flaky heuristics or just rely on the KBC
    (and device) to be 100% reliable at sending every byte or your screwed.

  6. There’s are no safe and reliable mechanisms for sending non-standard
    commands over PS/2. This has led to people inventing numerous “knock
    sequences” where people have had to guess that their particular magic
    list of PS/2 commands won’t turn on someone’s PS/2 industrial lathe (I
    really hope that one is a myth, but I have a sinking feeling it’s real).

  7. Don’t get me started on the PS/2 command set either. Bleah. And it’s
    non-extensible too.

Yes, it was in 1987, and therefore relatively early days for PC
architecture. If it were anyone other than IBM, I might give them more
slack, but they had no real excuse for not knowing how to design a bus.
We’re talking, here, about the people that came up with the IBM 370
virtual machine architecture in the late 60s, for Eris’ sake.

Alberto Moreira wrote:

*/Actually, given the vintage of the PS/2 interface - 1987 if I’m not
mistaken, before the PCI bus, hardly after Multibus hit the world, at a
time where ISA and EISA were the only PC alternatives, it was quite an
improvement. Some of you may have worked with the old IBM PC keyboard,
so, you will note the difference. Moreover, the PS/2 was an impressive
line of machines, and it was the first time in personal computing where
the hardware was described by configuration files (I forget the name of
those little files!) and access to it was done through a set of
configuration i/o port addresses specifically allocated for the purpose.
The interface was so flexible for the time that (1) few if any changes
to the 8042 microcode were needed, (2) a simple connector bridged
between old and new keyboard interfaces, (3) the changes to the keyboard
driver were also minimal, and (4) a very simple extension allowed to
connect a mouse to the system using the very same connector interface. /*
*//*
*/That interface was also the first time that people used a
level-triggered interrupt standard, which was a great improvement to the
old level-triggered (and hence inflexible) IBM PC and AT interrupts.
Some of you guys may remember the battle for interrupt lines, dma
channels, and what not, well, not to mention on-board jumpers. True, USB
is cool, but the concept already existed in the late sixties and early
seventies: you may be able to find some information on the Univac
Uniscopes, which used a synchronous multi-drop polling protocol that
kind of reminds of USB, and of course the IBM 3270 which came some time
later. Le plus ca change, le plus c’est la meme chose! /*
*//*
*/The PS/2 interface was an example of something that I believe we lost
today: simplicity. No PnP. No power management. No bells and whistles.
Just plug it in and take it for granted. The only drawback of the
interface was, and still is a drawback of most PC protocols, that
there’s a huge translation layer between the keyboard and the OS, and
that layer obviously belongs in the embedded microprocessor and not in a
driver. But that’s a general cancer that we’re not going to get rid of
anytime soon, and it may prove to be the undoing of the whole
architecture: a huge amount of what we call “device driver” today really
belongs in the hardware, specially today after the advances of hardware
definition languages. /*
*//*
*/This brings me good memories. I was working for Wang Microsystems back
in 1987 when the PS/2 came to live, and we queued up early morning at
the local computer store waiting for it to open so that we could get our
hands on the very first machines. We bought a Model 60 and (if my memory
doesn’t fail me) a model 80, and took them to the lab. The packaging was
absolutely innovative, so much so that even today no existing machine
can match it - and we made a little contest among the engineers to see
who could unassemble and reassemble the PC in least time. /*
*//*
*/The whole microchannel concept was very nice and rather innovative,
too bad it died such an early death. /*

----- Original Message -----
*From:* S. Drasnin mailto:xxxxx
> To: Windows System Software Devs Interest List
> mailto:xxxxx
> Sent: Monday, November 21, 2005 11:25 PM
> Subject: Re: Re:[ntdev] PS/2 mouse state machine
>
> Thanks to everybody who responded (including biting humor). I
> figured out what I needed for the situation when the interrupts are
> firing and mouse data was coming across - not a big hairy state
> machine to deal with for that case. First byte is a status byte (has
> overflow bits in it and mouse button flags) and the 2nd and 3rd were
> the x and y positions.
>
> thanks again…
>
>
>
>
>
> ----- Original Message -----
> From: Ray Trent mailto:xxxxx
> Newsgroups: ntdev
> To: Windows System Software Devs Interest List
> mailto:xxxxx
> Sent: Monday, November 21, 2005 5:32 PM
> Subject: Re:[ntdev] PS/2 mouse state machine
>
> You know, for many years I thought I had invented that joke
> (well, ok,
> my version was “from a community college” rather than “in boca
> raton”,
> but hey same idea).
>
> Then I met a guy claiming to have been the summer intern that
> actually
> did design the PS/2 interface, so I’m guessing I just heard it
> somewhere (I don’t remember who it was, but I ran into him at
> WinHEC
> this last year).
>
> I’m even more amazed by the fact that someone would actually
> admit to it
> :-).
>
> Doron Holan wrote:
> > I’ve always thought that the ps/2 design was done by an IBM
> summer intern in boca raton in the early 80s :wink:
> >
> > d
> >
> > ________________________________________
> > From: xxxxx@lists.osr.com
> mailto:xxxxx
> [mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
> > Sent: Monday, November 21, 2005 9:48 AM
> > To: Windows System Software Devs Interest List
> > Subject: [ntdev] PS/2 mouse state machine
> >
> > (1) Is there any documentation besides the code in the
> i8042prt sample DDK driver that describes the mouse state machine?
> >
> > I’m about to look at the code in detail - my understanding so
> far is that 3 bytes get received for every interrupt.
> >
> > (2) One thing I’m not sure of yet (since I haven’t looked at
> the code in detail) is if the state machine is only maintained
> in the device driver? Does it rely on any sentinels received in
> the mouse data to adjust the mouse state, or is the mouse data
> simply raw data? (For example, does the mouse send a byte
> indicating that it’s about to send x position data before it
> sends the x position data? Or does it assume that the driver
> knows that the following bytes are x position data based on it
> maintaining an internal state machine.)
> >
> > thanks
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: unknown lmsubst tag
> argument: ‘’
> > To unsubscribe send a blank email to
> xxxxx@listsosr.com
> mailto:xxxxx
> >
> >
>
> –
> Ray
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@msn.com
> mailto:xxxxx
> To unsubscribe send a blank email to
> xxxxx@listsosr.com
> mailto:xxxxx
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag
> argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com


Ray</mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>

Actually I do mean PS/2, not microchannel. I once wrote a
keyboard driver for DOS, and the interface itself was a piece of
cake. The point of the PS/2 interface wasn’t revolution but
compatibility. But there’s more to an interface than an API or a
register access discipline: here you are hearing from someone
who has being quite active on the hardware side of the fence,
so, I look at the packaging and wiring too, not just at what the
programmer sees. To me who was actively desigining PCs back in
1987, PS/2 was the whole thing: microchannel, the new keyboard,
the new machine packaging, and so on. Had IBM not being so
jealous about protecting the microchannel as their intellectual
property, we might have seen the microchannel bus standard
depart from its PS/2 roots; but it didn’t.

And the PS/2 mouse, well, it’s still in use today.

About PnP, I don’t think it’s that much of a good thing, at
least not the way it’s set up today. First, it inverts the
natural order of things: software should be written for
hardware, not the other way around. Second, hardware standards
should be industrywide and not wielded by software companies,
so, any kind of PnP standard should come built in inside specs
such as the PCI bus and so on. PnP, actually, should be a
hardware thing and not a software thing, and it should not be
driven by a software company but by a consortium of hardware
providers. Now, power is wildly overrated, and here again, it
should be a hardware standard.

Power management belongs in the Bios, and it should be totally
and completely OS-independent: the OS has no business overriding
the Bios. In fact, I strongly believe that low level engines
such as dispatching processes and such should be included in the
Bios, not in the OS. About 10 years ago, power was handled by
power management chips that worked in tight cooperation with the
Bios; and if the idea of a protected mode Bios had established
itself (like for example IBM’s ABIOS), much of that
functionality would be implemented at hardware and firmware
level and it would be common to any OS.

This is, in fact, the key to what I’ve said: I believe that a
good part of today’s OS functionality in Windows (and Linux!)
belongs in the hardware and in the bios, not in the OS. As I see
it, today’s OS’s are big, fat, inflated matrons, trying to
emulate amoebas and gobble up everything around them. Also, OS’s
should come in removable memories and no OS component should
require to be installed in a hard drive: hard drives should be
for user data alone. Oh, don’t get me started on this, today’s
OS’s are vintage 1970 at best, and there’s no sign of any
relevant innovation anywhere in the horizon.

As for the original PS/2, if I remember correctly it had not
cables and no screws to fiddle with: everything snapped in and
out. I also remember much of it being plastic and not metal. It
took about one or two minutes, if I remember, to take the whole
machine apart, and another minute or so to put it back together,
because everything snapped in, again, no cables and no screws,
no jumpers, no twisting hands and arms to reach a hard-to-get-to
place in the motherboard, nothing but snap-in.

Alberto.

----- Original Message -----
From: “Tim Roberts”
To: “Windows System Software Devs Interest List”

Sent: Tuesday, November 22, 2005 1:44 PM
Subject: Re: [ntdev] PS/2 mouse state machine

> Alberto Moreira wrote:
>
>> /Actually, given the vintage of the PS/2 interface - 1987 if
>> I’m not mistaken, before the PCI bus, hardly after Multibus
>> hit the world, at a time where ISA and EISA were the only PC
>> alternatives, it was quite an improvement./

>
>
> The IBM PS/2 and the Micro Channel Architecture bus were
> introduced in 1987.
>
> At the time, ISA was the ONLY alternative. EISA was created
> in response to MCA, and VLB in response to that. PCI work did
> not begin until 1990.
>
> However, the PS/2 keyboard and mouse interfaces are unrelated
> to MCA, except that they first appeared on the same systems.
> The PS/2 keyboard interface is identical to the AT keyboard
> interface (except that the connector has one additional pin),
> and the PS/2 mouse interface was little more than a wrapper
> around a serial port.
>
>> / Some of you may have worked with the old IBM PC keyboard,
>> so, you will note the difference. Moreover, the PS/2 was an
>> impressive line of machines, and it was the first time in
>> personal computing where the hardware was described by
>> configuration files (I forget the name of those little
>> files!) and access to it was done through a set of
>> configuration i/o port addresses specifically allocated for
>> the purpose./

>
>
> EISA called them, oddly enough, “configuration files”, with a
> .CFG extension.
>
>> /The PS/2 interface was an example of something that I
>> believe we lost today: simplicity. No PnP. No power
>> management. No bells and whistles./

>
>
> You mean “Micro Channel” interface, not “PS/2” interface,
> right? The PS/2 keyboard and mouse interfaces were anything
> but revolutionary. They were just a repackaged version of
> what already existed.
>
> I’m not actually sure what you’re trying to say here. PnP is
> a software thing, and I doubt there is a single person who
> would argue that hardware power management is a bad thing.
> It’s tricky to manage in software, but it would have been
> tricky with Micro Channel as well.
>
>> /This brings me good memories. I was working for Wang
>> Microsystems back in 1987 when the PS/2 came to live, and we
>> queued up early morning at the local computer store waiting
>> for it to open so that we could get our hands on the very
>> first machines. We bought a Model 60 and (if my memory
>> doesn’t fail me) a model 80, and took them to the lab. The
>> packaging was absolutely innovative, so much so that even
>> today no existing machine can match it - and we made a little
>> contest among the engineers to see who could unassemble and
>> reassemble the PC in least time./

>
>
> I think your memory is enhancing things a bit. Micro Channel
> boards were easy to remove, because they had a big plastic
> handle at one end, but there are lots of machines today with
> cases that are much easier to disassemble than the PS/2.
>
>> / /
>> /The whole microchannel concept was very nice and rather
>> innovative, too bad it died such an early death./

>
>
> It died because of predatory licensing demands by IBM, not
> because of any serious design flaws.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@ieee.org
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com

A college dorm-mate of mine worked as an IBM summer intern in Boca Raton in
the early 80s. So I might know who did it.

  • Dan.

At 02:42 PM 11/21/2005 -0800, you wrote:

I’ve always thought that the ps/2 design was done by an IBM summer intern
in boca raton in the early 80s :wink:

d


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
Sent: Monday, November 21, 2005 9:48 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] PS/2 mouse state machine

(1) Is there any documentation besides the code in the i8042prt sample DDK
driver that describes the mouse state machine?

I’m about to look at the code in detail - my understanding so far is that
3 bytes get received for every interrupt.

(2) One thing I’m not sure of yet (since I haven’t looked at the code in
detail) is if the state machine is only maintained in the device driver?
Does it rely on any sentinels received in the mouse data to adjust the
mouse state, or is the mouse data simply raw data? (For example, does the
mouse send a byte indicating that it’s about to send x position data
before it sends the x position data? Or does it assume that the driver
knows that the following bytes are x position data based on it maintaining
an internal state machine.)

thanks


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com