diff options
author | Luke <luke.wilde@live.co.uk> | 2020-08-25 05:51:15 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-25 09:43:51 +0200 |
commit | b58ca7cf3d73152e8e049df4ddd43912030ab4ea (patch) | |
tree | 5a718789f44915b86542f2fc56a50218618c221c /Kernel/Devices | |
parent | 8b166e57dfbcaa353752f3327b1f34b819deceb7 (diff) | |
download | serenity-b58ca7cf3d73152e8e049df4ddd43912030ab4ea.zip |
Kernel: Scroll wheel amount on Intellimouse is 4 bits instead of 8
When trying to scroll up on virtualizers that don't use the VMware
backdoor and instead use PS2MouseDevice, it would actually scroll
down rapidly.
Looking into it, the mouse delta for scrolling down was 1 and 15
for scrolling up. 15 is suspiciously -1 for a nibble.
According to https://isdaman.com/alsos/hardware/mouse/ps2interface.htm
the Z is actually 4 bits for Intellimouse.
This fixes scrolling up on virtualizers such as VirtualBox.
Diffstat (limited to 'Kernel/Devices')
-rw-r--r-- | Kernel/Devices/PS2MouseDevice.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Kernel/Devices/PS2MouseDevice.cpp b/Kernel/Devices/PS2MouseDevice.cpp index e4461abaad..47f876515b 100644 --- a/Kernel/Devices/PS2MouseDevice.cpp +++ b/Kernel/Devices/PS2MouseDevice.cpp @@ -136,8 +136,15 @@ void PS2MouseDevice::parse_data_packet() int x = m_data[1]; int y = m_data[2]; int z = 0; - if (m_has_wheel) - z = (char)m_data[3]; + if (m_has_wheel) { + // FIXME: For non-Intellimouse, this is a full byte. + // However, for now, m_has_wheel is only set for Intellimouse. + z = (char)(m_data[3] & 0x0f); + + // -1 in 4 bits + if (z == 15) + z = -1; + } bool x_overflow = m_data[0] & 0x40; bool y_overflow = m_data[0] & 0x80; bool x_sign = m_data[0] & 0x10; |