Skip to content

Commit

Permalink
Fixed handleClose not being called by VoodooInput (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
1Revenger1 committed Mar 4, 2023
1 parent f7735a2 commit 6ff8271
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 10 deletions.
3 changes: 2 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
VoodooPS2 Changelog
============================
#### v2.3.4
- Fixed device count detection when `ps2rst=0` is set.
- Fixed device count detection when `ps2rst=0` is set
- Fixed handleClose not being called by VoodooInput

#### v2.3.3
- Fixed rapidly opening pages in browsers while scrolling with the trackpoint
Expand Down
15 changes: 12 additions & 3 deletions VoodooPS2Trackpad/VoodooPS2ALPSGlidePoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,21 @@ bool ApplePS2ALPSGlidePoint::handleOpen(IOService *forClient, IOOptionBits optio

return true;
}
return super::handleOpen(forClient, options, arg);
return false;
}

bool ApplePS2ALPSGlidePoint::handleIsOpen(const IOService *forClient) const {
if (forClient == nullptr) {
return voodooInputInstance != nullptr;
} else {
return voodooInputInstance == forClient;
}
}

void ApplePS2ALPSGlidePoint::handleClose(IOService *forClient, IOOptionBits options) {
OSSafeReleaseNULL(voodooInputInstance);
super::handleClose(forClient, options);
if (forClient == voodooInputInstance) {
OSSafeReleaseNULL(voodooInputInstance);
}
}

bool ApplePS2ALPSGlidePoint::start( IOService * provider ) {
Expand Down
1 change: 1 addition & 0 deletions VoodooPS2Trackpad/VoodooPS2ALPSGlidePoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ class EXPORT ApplePS2ALPSGlidePoint : public IOService {
bool resetMouse();
bool handleOpen(IOService *forClient, IOOptionBits options, void *arg) override;
void handleClose(IOService *forClient, IOOptionBits options) override;
bool handleIsOpen(const IOService *forClient) const override;
PS2InterruptResult interruptOccurred(UInt8 data);
void packetReady();
virtual bool deviceSpecificInit();
Expand Down
15 changes: 12 additions & 3 deletions VoodooPS2Trackpad/VoodooPS2Elan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,21 @@ bool ApplePS2Elan::handleOpen(IOService *forClient, IOOptionBits options, void *
return true;
}

return super::handleOpen(forClient, options, arg);
return false;
}

bool ApplePS2Elan::handleIsOpen(const IOService *forClient) const {
if (forClient == nullptr) {
return voodooInputInstance != nullptr;
} else {
return voodooInputInstance == forClient;
}
}

void ApplePS2Elan::handleClose(IOService *forClient, IOOptionBits options) {
OSSafeReleaseNULL(voodooInputInstance);
super::handleClose(forClient, options);
if (forClient == voodooInputInstance) {
OSSafeReleaseNULL(voodooInputInstance);
}
}

bool ApplePS2Elan::start(IOService *provider) {
Expand Down
1 change: 1 addition & 0 deletions VoodooPS2Trackpad/VoodooPS2Elan.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ class EXPORT ApplePS2Elan : public IOHIPointing {

bool handleOpen(IOService *forClient, IOOptionBits options, void *arg) override;
void handleClose(IOService *forClient, IOOptionBits options) override;
bool handleIsOpen(const IOService *forClient) const override;

void setParamPropertiesGated(OSDictionary *dict);
void injectVersionDependentProperties(OSDictionary *dict);
Expand Down
15 changes: 12 additions & 3 deletions VoodooPS2Trackpad/VoodooPS2SynapticsTouchPad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,21 @@ bool ApplePS2SynapticsTouchPad::handleOpen(IOService *forClient, IOOptionBits op
return true;
}

return super::handleOpen(forClient, options, arg);
return false;
}

bool ApplePS2SynapticsTouchPad::handleIsOpen(const IOService *forClient) const {
if (forClient == nullptr) {
return voodooInputInstance != nullptr;
} else {
return voodooInputInstance == forClient;
}
}

void ApplePS2SynapticsTouchPad::handleClose(IOService *forClient, IOOptionBits options) {
OSSafeReleaseNULL(voodooInputInstance);
super::handleClose(forClient, options);
if (forClient == voodooInputInstance) {
OSSafeReleaseNULL(voodooInputInstance);
}
}

bool ApplePS2SynapticsTouchPad::start( IOService * provider )
Expand Down
1 change: 1 addition & 0 deletions VoodooPS2Trackpad/VoodooPS2SynapticsTouchPad.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ class EXPORT ApplePS2SynapticsTouchPad : public IOService

bool handleOpen(IOService *forClient, IOOptionBits options, void *arg) override;
void handleClose(IOService *forClient, IOOptionBits options) override;
bool handleIsOpen(const IOService *forClient) const override;

void setPropertiesGated(OSDictionary* dict);
void injectVersionDependentProperties(OSDictionary* dict);
Expand Down

0 comments on commit 6ff8271

Please sign in to comment.