mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:07:45 +00:00
Kernel: Prevent VMWareMouseDevice from handling invalid mouse packets
Bit 3 is set here:
c5b2f55981/hw/input/ps2.c (L736)
Spurious mouse packets can be received without this bit set, for
example when double-clicking and keeping the mouse button depressed
instead of releasing it the second time (i.e. mousedown > mouseup >
mousedown). We should not process such packets.
This makes interaction with our buttons much smoother!
Fixes #5881.
This commit is contained in:
parent
8b3232121b
commit
4131b35851
1 changed files with 8 additions and 1 deletions
|
@ -25,10 +25,11 @@ UNMAP_AFTER_INIT RefPtr<VMWareMouseDevice> VMWareMouseDevice::try_to_initialize(
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void VMWareMouseDevice::irq_handle_byte_read(u8)
|
void VMWareMouseDevice::irq_handle_byte_read(u8 byte)
|
||||||
{
|
{
|
||||||
VERIFY(VMWareBackdoor::the());
|
VERIFY(VMWareBackdoor::the());
|
||||||
VERIFY(VMWareBackdoor::the()->vmmouse_is_absolute());
|
VERIFY(VMWareBackdoor::the()->vmmouse_is_absolute());
|
||||||
|
|
||||||
// We won't receive complete packets with the backdoor enabled,
|
// We won't receive complete packets with the backdoor enabled,
|
||||||
// we will only get one byte for each event, which we'll just
|
// we will only get one byte for each event, which we'll just
|
||||||
// discard. If we were to wait until we *think* that we got a
|
// discard. If we were to wait until we *think* that we got a
|
||||||
|
@ -36,6 +37,12 @@ void VMWareMouseDevice::irq_handle_byte_read(u8)
|
||||||
// because we wouldn't read the appropriate number of mouse
|
// because we wouldn't read the appropriate number of mouse
|
||||||
// packets from VMWareBackdoor.
|
// packets from VMWareBackdoor.
|
||||||
auto mouse_packet = VMWareBackdoor::the()->receive_mouse_packet();
|
auto mouse_packet = VMWareBackdoor::the()->receive_mouse_packet();
|
||||||
|
|
||||||
|
// Only process packets with bit 3 set.
|
||||||
|
// Note that this needs to happen _after_ invoking receive_mouse_packet() above
|
||||||
|
if (!(byte & 0x8))
|
||||||
|
return;
|
||||||
|
|
||||||
if (mouse_packet.has_value()) {
|
if (mouse_packet.has_value()) {
|
||||||
m_entropy_source.add_random_event(mouse_packet.value());
|
m_entropy_source.add_random_event(mouse_packet.value());
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue