The switch contacts in my mouse are going, and rather than open it up yet again and clean them or try to hunt down a replacement switch (or buy a new mouse) I would like to solve this problem via software.Is there a way I can tell the Linux input system to watch the current state of the mouse button, and only send a press/release event when the average value over the last few milliseconds has gone to one extreme?This way when the mouse button is held down, the very short button release pulses from the failing switch would be ignored, so I could drag and drop without any problems.  Likewise clicking once should be slow enough that it won't get processed as a double-click.I would be happy with a udev/evdev or Xorg solution, as being a mouse it only needs to work in Xorg.
Ignore brief mouse click/releases
xorg;mouse;input