Fog Creek Software
g
Discussion Board




Looking for a mouse and finding a can of worms

I've just encountered a nasty problem to which I don't have an answer, so I thought I'd put it to the armoured might of JoS.

My employers make a piece of measuring equipment which can connect to a PC via various interfaces, one of which is RS-232. The equipment normally runs 24/7 (it comes with a 24-hour uptime UPS). If the attached PC is rebooted for any reason (or if the hardware wizard is run), the equipment is detected as a serial mouse. This is bad enough, but this 'mouse' is then selected in preference to any existing PS/2 mouse. The data stream coming from the equipment is interpreted as a strange and confusing equence of mouse messages, rendering the system unusable.

Does anybody know how to prevent Windows (currently 2000, maybe XP in the future) from scanning a particular serial port for mice? Or how to 'nail' the mouse to the PS/2 port? Any solution would need to persist through a cold reboot.

In the worst case, does anybody know what probe sequence is used, so we can modify the equipment firmware to ignore it?

Thanks!

Max Hadley
Monday, November 24, 2003

Theres an FAQ here for a similar problem.  Don't know if it helps at all.

http://www.acsw.com/docum/faqdoc/serialpc.html

Ged Byrne
Monday, November 24, 2003

Maybe this helps. From: http://instruct1.cit.cornell.edu/courses/ee476/FinalProjects/s2002/pw33/ece476finalweb.htm

"DTR = Data Transmit Ready, RTS = Request To Send, DSR = Data Set Ready, CTS = Clear To Send

When Windows tries to detect for new hardware on the serial port, it would toggle the DTR and RTS lines in synchronous. In order for a serial mouse to be detected, it needs to respond with an ASCII "M" or 0x4d in hexadecimal.  The RTS line would toggle 3 times, and the mouse would need to respond with the ASCII ‘M’ each time RTS toggles in order to Windows to confirm that a Microsoft Serial Mouse has been detected. Once the mouse is successfully detected, DTR and RTS go high to +7 V and these lines can power the on-board microcontroller of a serial mouse. "

Just me (Sir to you)
Monday, November 24, 2003

I have no idea how to do this, but I suggest that the proper solution is to respond to Windows and get it to detect "Measuring Device" rather than avoiding the detection. This will then last through iterations of hardware and software.

Dominic Fitzpatrick
Monday, November 24, 2003

Here's one to try: switch the computer over to using a USB mouse instead of a serial one, then turn off the serial mouse driver in windows. It does mean you can't ever use a serial mouse at all, but USB mice are cheap enough these days that unless your product is REALLY price-sensitive, you should be able to afford them.

This has the nice effect of being something you can put in place in about 10 minutes, instead of requiring an update to your device.

Michael Kohne
Monday, November 24, 2003

Just me,

Thanks for the tip: I'll explore the possibilities.

Michael,

We are using a PS/2 mouse: but I take your point. However, how do I 'turn off' the serial mouse driver so that Windows won't try to use it next time it scans for hardware? That's the meat of the problem.

Thanks to everybody

Max Hadley
Monday, November 24, 2003

Hmmm. Good question. Under NT4 (which is all I have in front of me) I go under Control Panel:Devices, select 'serial mouse driver' and set it's startup to 'manual'. Note that this still allows a PS/2 mouse to work (since NT4 didn't support USB). Therefore, assuming you can do similar, you may not even find the need to change out the mouse on the end-user PC at all.

I frankly can't remember WHY I had to do this to this machine - I've got a number of serial devices hooked up, and I think I had something similar going on (in my case, I believe NT thought it found a defective mouse and started complaining loudly about it)

I also can't get more specific on your OS, as I don't have it in front of me.

Good luck!

Michael Kohne
Monday, November 24, 2003

You need to change the hardware.  If Windows is detecting it as a mouse, then the hardware isn't designed properly.

Talk to the HW eng.

Worst case, you'll need to put some kind of PLD between the serial interface chip and the outside world.

Myron A. Semack
Monday, November 24, 2003

Max,

You can disable Window's automatic detection of serial-port mice using the "noserialmice" switch inside your system's boot.ini file.  See the following website for more information:

http://www.sysinternals.com/ntw2k/info/bootini.shtml

Norbert Burger
Monday, November 24, 2003

We're having the same problem at work. Our clients attach a GPS device to their computer via the serial port. When the GPS sends it NMEA-data while Windows (2000 or XP) boots, Windows thinks a serial mouse is detected.

Workaround at that point is to disconnect the GPS, or switch it off, go to the device manager and disable the detected mouse (seems to be Microsoft Serial BallPoint most of the time). I'm working on a solution to prevent autodetection of serial devices, based on MS KB article 283063 ( http://support.microsoft.com/default.aspx?scid=kb;en-us;283063 ). COMDisable from KB article 819036 ( http://support.microsoft.com/default.aspx?scid=kb;en-us;819036 ) would work too, but the EULA doesn't allow us to redistribute it.

The BOOT.INI suggestion looks very promising, I will surely study that one too.

Roel Schroeven
Monday, November 24, 2003

Norbert,

The BOOT.INI switch was new to me, but it appears we have tried this in the past. The problem is the setting is ignored by the 'add new hardware' wizard.

Roel,

The registry key approach looks promising, but the MSKB explanation is as clear as mud. What value do you have to set the SkipEnumerations DWORD to so that the port is not enumerated (for mice) but is enabled (for use by our hardware)? The COMDisable program seems only to offer the ability to turn a COM port on or off.

Another question: are USB serial ports enumerated for mice?


Thanks again, everybody

Max Hadley
Tuesday, November 25, 2003

Well, we tried the registry key approach & it worked. We guessed on oxfffffffe as the key value, & it seems to be OK through both a reboot, and an 'add new hardware'.

The PC we tried was running W2KSP4, and does have an ACPI bios. YMMV!

Thanks again

Max Hadley
Tuesday, November 25, 2003

Max:

- The value in SkipEnumerations is the number of times the port is skipped when detecting hardware. For example, suppose you put a 5 there. When the system boots, an enumeration is done but the port is skipped. If you do a rescan in Device Management, idem dito. After a few times, the port is not skipped, so a mouse is detected. When the system is rebooted, the count restarts from the SkipEnumerations value. Safest is to use the maximum, 0xffffffff.

- This does not disable the port in any way, it only disables detection of attached hardware. The same goes for COMDisabled, though I know the documentation makes it sound like it disables the com port instead of the enumeration.

- Yes, USB serial ports are enumerated. If I attach a GPS device (well, I used a fake one: another computer + null modem cable + small program to send NMEA) via a USB/Serial convertor (I have, my laptop doesn't have a COM port), Windows detects a mouse ("HID Mouse").

FYI, all the COM ports are listed in the registry, in HKLM\SYSTEM\CurrentControlSet\Services\Serial\Enum; there you can see where to find the settings for each COM port. Just attach the value after 0, 1 etc. to HKLM\SYSTEM\CurrentControlSet\Enum.

Roel Schroeven
Tuesday, November 25, 2003

*  Recent Topics

*  Fog Creek Home