So here's a question that came up in an earlier thread and I had to do some research:
How in the Glorious Fuck do these work?
Specifically, these are PS/2 to DB-9 Serial connectors that used to ship with PS/2 mice.
So these exist because for a long while, PCs did not have mouse ports. They just didn't exist.
The PC had a dedicated keyboard port (the DIN-5 PC/XT), and then another one that was the same connector but a different protocol (The DIN-5 AT). But no Mouse Port.
So there were two ways to add a mouse to your PC before there was ever a Mouse Port.
One way was the Bus Mouse.
This is where you have an ISA card that implements most of the mouse inside the computer, and it hooks up with a proprietary interface to a proprietary mouse.
The other way was the Serial Mouse.
Not all PCs had serial ports, but they were quite common and standardized, so a serial port mouse was and obvious way to go, either DB-25 or DB-9.
This requires more Smarts in your mouse to be able to talk serial, and you've got the issue that some serial ports are DB-25 and some are DB-9, and hey, what if users are already using their serial port?
But it worked. And as single-chip solutions were developed these became cheaper and more common...

And then IBM decided this was all stupid and introduced a mouse port: The PS/2 port, named after the computer line.
This mouse port was smaller and simplified and used the same sort of simple protocol that the AT keyboard was already using.
(And alongside the PS/2 mouse port, IBM introduced the PS/2 keyboard port, which was just the AT keyboard port but with a smaller connector)
But the PC industry wasn't controlled by IBM anymore in 1987 when they introduced the PS/2, and it was the PS/2 that made that completely clear:
The PS/2 was supposed to be a way for IBM to take back the reins of this platform, and it really really failed at that.
So there's really no reason why all the PC clone makers had to follow the lead of IBM.
They could keep shipping PCs with AT keyboard ports and serial ports (for mice) and ignore this PS/2 connector nonsense.
And for a long while, they did.
Eventually clones did switch over to PS/2, although sometimes they did it in parts:
There are motherboards that have an AT keyboard port and a PS/2 mouse port!
But eventually the PS/2 ports won out. A lot of other stuff from PS/2 got left behind, but the ports didn't.
Your modern PC might have a PS/2 port (many gaming PCs do!) but it definitely won't have a Microchannel Bus.
HOWEVER in the long transitional period that was "most of the 90s", some PCs had PS/2 mouse ports, and some just had serial ports. So you had to support both.
(Well, you didn't HAVE to support both: pretty much all users who had a PS/2 port also had a serial port, so you could have just used the serial port... but if you have a PS/2 mouse port, why not use it?)
Anyway, the brilliant idea of a mouse that could do both connectors arrived: You simply ship a mouse with a PS/2 connector, and a little adapter that turns it into a serial connector for users who need it. Simple! Easy!
Except no, it's not remotely easy.
So the first thing you need to know about these adapters is that they do not convert the PS/2 mouse protocol to a serial mouse protocol. That is 100% not what they do. That would not be possible in that form factor, at the time.
So they're not PS/2 to Serial converters.
Instead they're physical adapters, which signal the mouse itself to change how it communicates with the PC.
Basically, the mouse can speak either PS/2 or Serial, and it just makes sure it speaks the right protocol to the right connector
And part of why this is is that the PS/2 and RS232 Serial protocols are very, very different.
PS/2 uses a single "data" pin, with a separate clock pin, and it has a separate +5V pin to power the microcontroller in the mouse/keyboard.
Serial, on the other hand, has separate "Receive Data" and "Transmit Data" pins, with no clock pins (but optional RTS/CTS handshaking), and no power pins.
Speaking of power:
The voltages of these two connections are completely different! They're both digital, meaning they're only sending 1s and 0s... but how do you define what's a 1 or a 0? You define it as a voltage level. And they do not agree in the slightest.
So PS/2 uses the 5V signaling common to the PC.
Basically a low signal pulls it close to 0v, and a high signal pulls it close to 5V. So your PS/2 data/signal lines are going back and forth between 0v and 5V as data is sent
(It's actually a little more complicated because this is an open-collector pulled-high setup because it's got to be able to be driven by either the mouse or the computer, but that's not important here)
RS232 on the other hand, is very, very different.
So to send a 0, the line has to be between +3 and +15 volts, and to send a 1, it has to be between -3 and -15 volts.

Yeah. SLIGHTLY different.
So having a converter-box-adapter that translates between these would not be simple or easy and would require a bunch of voltage regulation and such, so that's not what mice do.
Instead they have circuitry in the mouse itself that is designed to be able to handle both protocols and both voltages, and it detects the adapter and switches its output accordingly.
So it may be "natively PS/2" but when it sees the adapter plugged in, it switches to RS232.
But there's still one big problem:

WHERE DOES THE MOUSE GET THE POWER?
Computer mice are electronic devices. They need power. They can't switch to an RS/232 protocol if THEY ARE TURNED OFF. And PS/2 has a +5v pin, and... RS232 does not!
You've got a bunch of signal pins here and a ground. None of these is a "power" pin. Do you have to plug in your mouse, now?
And that's a real possibility, not a joke.
One of the first makers of optical mice was Mouse Systems, and many of their serial mice required a separate power supply to work.
But these PS/2 or Serial swappable mice do not, in fact, require a separate power supply. How?
CHEATING! or being clever. Depends how you think about it, really...
If you look up how these adapters are wired, it's actually commoning a bunch of wires together.
The 4 pin on the PS/2 adapter is hooked up to DTR, RTS, and RI.
That's Data Terminal Ready, Request To Send, and Ring Indicator.
And it turns out those three pins are exactly where the power is coming from. Those are signals used to control when things like modems and printers pick up and hang up the line or stop printing, but a mouse doesn't need that kind of info.
How do you tell your mouse to answer the phone, anyway?
(well, you use a MOUSEPHONE, but ignore that)
So it turns out the serial mouse driver (remember the good ol' days when you had to run the MOUSE command to enable mice to work on DOS?) doesn't just translate mouse commands: it also forces your serial port's DTR and RTS lines to be set high at all times.
(That's high in the voltage sense, not the logical sense)
So now there's always between 3 and 15 volts on that combination of pins, and now the mouse can use that + ground to get power. Now it's just got to convert that to whatever the microcontroller runs on.
given the era, that's probably a 5v 8051/clone.

And it turns out this trick isn't specific to the PS/2-to-serial adapter mice: Regular serial mice (at least those that don't have a separate power box) use the same trick.
SO, what does this all mean, practically?

Well, mostly nothing, it's 2020 and you're using a wireless or USB mouse, who cares about PS/2 ports or serial ports.
HOWEVER, if you're retrocomputing...
You need to watch out. Remember, these adapters are only physical adapters that tell the mouse to Do The Magic Stuff.
They do not convert PS/2 to Serial, they just let a PS/2/Serial hybrid mouse switch modes.
And the practical impact of that is that you can't treat these connectors as generic connectors, or you'll risk dumping RS232 voltages into a mouse expecting PS/2 voltages, and it may never work again.
There's also a possibility that two makers of hybrid PS/2/Serial mice designed adapters that are wired differently.
So even knowing the mouse is a hybrid isn't enough: You've also got to be sure it's the matching adapter for the mouse.
So yeah. Don't mix and match your PS/2-to-serial-adapters (because that's not what they do) or try them on mice you don't know are hybrids.
BONUS ROUND BEFORE I SHUT UP:
There are other hybrid mice, from a later era... PS/2 and USB!
These adapters have an easier job.
PS/2 and USB are both 5V protocols, and they both have a dedicated +5V line.
Great!
But they are pulling the exact same trick: They're not adapting, they're just telling a hybrid mouse to switch mode.
The USB connector has two data lines, not one, and they're used for differential signalling: each is the voltage opposite of the other. This helps avoid interference.
So you similarly couldn't easily build an adapter that converts between the two protocols.
You certainly CAN, they exist, they're just bigger.
But these USB/PS/2 adapters just tell the mouse to switch protocols. They don't do any conversion themselves, they just physically adapt the two different connectors.
The mouse figures out (somehow!) that the adapter is in use, and stops speaking USB and starts speaking PS/2
Anyway I have to go now. If you enjoy me rambling about old computer things, feel free to send me a dollar or two on my ko-fi as thanks. https://ko-fi.com/fooneturing 
BTW: Serial Mice are still supported as of Windows 10, including over USB-to-serial adapters (and it's still possible to get native serial ports on your motherboard: I've got one!)
You probably would only know this because sometimes it completely breaks.
it turns out the protocol for detecting a serial mouse is really terrible.
For PS/2 the only thing you can plug into a PS/2 mouse port is a mouse, so no detection is needed.
For USB, there's vendor/device IDs and device class metadata.
Serial has nothing.
So there's a protocol for detecting if a given device is a serial mouse:
The OS does some signalling with the control lines (DTR,RTS=0, wait 100 ms, DTR=1, wait 100 ms, flush the buffer, RTS=1) and then listens for a few hundred milliseconds on the serial port.
if it gets an M, it assumes "yep, that's a mouse!" and sets up the driver.
There's some additional detection for Special Mice (which'll send extra bytes) but generally the protocol is just "after doing some signaling, did you get an 'M'?"
The problem is that you could have any number of weird serial devices hooked up that send all kinds of bytes at your serial port, and maybe they don't care about the control-line signalling. Maybe they respond the same or maybe they ignore it, either way, they might send bytes
and if you're unlucky, that byte might be an M! and now your Weird Serial Thing is officially A Mouse, and you can't use windows because your cursor is flying all over the place.
this is why when you google "serial mouse detection" you get an entire page of results of "HOW TO DISABLE SERIAL MOUSE DETECTION?"
Like this one:
https://www.taltech.com/support/entry/windows_2000_nt_serial_mice_and_missing_com_port
because anyone with an arduino or a GPS device or whatever hooked up to their serial port will eventually win the serial-mouse-detection lottery and have a bad day.
basically the protocol has the problem of coming from a time when this problem would only occur if you had a badly specified MOUSE.EXE command in your autoexec.bat and the technical support reply back then was "don't do that then".
so it's a protocol that was only designed for the most basic kind of autodetection when installing mice regularly required you to understand how to edit some system startup files, so they weren't really worried about making it resilient to accidental mis-detect errors
and then windows had to continue supporting that protocol because of backwards compatibility so now your windows 10 system can periodically become unusable because your serial port got a spurious M at the wrong time
It's just a guess, but I'm betting the reason they haven't removed this (or just disabling it by default) is POS terminals.
A lot of those use serial-port "mouse" devices for the touchscreens.
I'm sure there's newer ones with USB/internal touchscreens, but serial has historically been used so I'm sure there's some company out there who has 200,000 POS terminals deployed and wouldn't upgrade to Windows 10 if it dropped serial mouse support.
You can follow @Foone.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.