Filter bad mouse data. This prevents random jumping of the cursor, as observed on some systems.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20904 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
14342a6767
commit
f7c789146d
@ -219,10 +219,33 @@ mouse_handle_int(ps2_dev *dev)
|
||||
const uint8 data = dev->history[0].data;
|
||||
|
||||
if (cookie->packet_index == 0 && !(data & 8)) {
|
||||
TRACE("ps2: bad mouse data, trying resync\n");
|
||||
INFO("ps2: bad mouse data, trying resync\n");
|
||||
return B_HANDLED_INTERRUPT;
|
||||
}
|
||||
|
||||
// Workarounds for active multiplexing keyboard controllers
|
||||
// that lose data or send them to the wrong port.
|
||||
if (cookie->packet_index == 0 && (data & 0xc0)) {
|
||||
INFO("ps2: strange mouse data, x/y overflow, trying resync\n");
|
||||
return B_HANDLED_INTERRUPT;
|
||||
}
|
||||
if (cookie->packet_index == 1) {
|
||||
int xDelta = ((cookie->packet_buffer[0] & 0x10) ? 0xFFFFFF00 : 0) | data;
|
||||
if (xDelta < -100 || xDelta > 100) {
|
||||
INFO("ps2: strange mouse data, x-delta %d, trying resync\n", xDelta);
|
||||
cookie->packet_index = 0;
|
||||
return B_HANDLED_INTERRUPT;
|
||||
}
|
||||
}
|
||||
if (cookie->packet_index == 2) {
|
||||
int yDelta = ((cookie->packet_buffer[0] & 0x20) ? 0xFFFFFF00 : 0) | data;
|
||||
if (yDelta < -100 || yDelta > 100) {
|
||||
INFO("ps2: strange mouse data, y-delta %d, trying resync\n", yDelta);
|
||||
cookie->packet_index = 0;
|
||||
return B_HANDLED_INTERRUPT;
|
||||
}
|
||||
}
|
||||
|
||||
cookie->packet_buffer[cookie->packet_index++] = data;
|
||||
|
||||
if (cookie->packet_index != cookie->packet_size) {
|
||||
|
Loading…
Reference in New Issue
Block a user