Bug 257867

Summary: Mouse 4D+ erratic move (psm.c and moused.c)
Product: Base System Reporter: Franz E. Arnold <franz.arnold>
Component: kernAssignee: freebsd-multimedia (Nobody) <multimedia>
Status: New ---    
Severity: Affects Many People    
Priority: ---    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description Franz E. Arnold 2021-08-15 17:51:58 UTC
Mouse 4D+ is erratic when moving backward (negative X or negative Y). Cursor jumps instantly to position (0,0) under a GUI (Graphic User Interface).

Mouse move could go even crazier when it is enabled for terminal text, selecting and doing things under no clearly understandable reason.

This seems to be affecting both Free BSD and DragonFly BSD I've tested so far (the late two main releases of both OS).

In both case, after forcing the boot probe to ignore actual mouse or forcing mouse protocol to be a regular PS/2 mouse, it seemed to work (move cursor) as expected.

I've researched several Discussion Groups and Forums for months without finding useful solution. Also have researched both OS Source Code and found something interesting that might be related to that strange behavior.

First issue:

In the psm.c, searching for the keyword MOUSE_MODEL_4DPLUS, on line 5103, we can find "if ((x < 16 - 256) && (y < 16 - 256))".

But in moused.c, searching for the same MOUSE_MODEL_4DPLUS, on line 2289, we can find "if ((act->dx < 16 - 256) && (act->dy > 256 - 16))".

Why would there be a different calculation for testing and decision regarding mouse move?

Second issue:

In both source codes (psm.c line 5103; moused.c line 2290) we can find "x = y = 0" and "act->dx = act->dy = 0" respectively.

What is happening actually? What is being interpreted as backward mouse move? Is it correct for the 4D+ Mouse protocol?

I am not experienced in hardware communication protocol, which applies PS/2 mouse protocol. Hope this finding could useful, specially other users trying BSD with old hardware like myself (which is not a bad idea).

Please, could someone more knowledgeable about PS/2 mouse and binary protocol check this?

Many thanks in advance.