Skip to content

Commit

Permalink
fix issue with registering of services matched by property name "RM,…
Browse files Browse the repository at this point in the history
…deliverNotifications" - #1415
  • Loading branch information
lvs1974 committed Jan 8, 2021
1 parent fbd15f0 commit dc35712
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 17 deletions.
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
VoodooPS2 Changelog
============================
#### 2.2.1
- Fix issue with registering of services matched by property name "RM,deliverNotifications". It solves issue with broadcasting timestamp for the last pressed key and handling of QuietTimeAfterTyping [see bug #1415](https://github.com/acidanthera/bugtracker/issues/1415)

#### 2.2.0
- Added VoodooRmi compatibility to allow external touchpad resets
Expand Down
38 changes: 23 additions & 15 deletions VoodooPS2Controller/VoodooPS2Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,20 +603,22 @@ bool ApplePS2Controller::start(IOService * provider)

propertyMatch = propertyMatching(_deliverNotification, kOSBooleanTrue);
if (propertyMatch != NULL) {
IOServiceMatchingNotificationHandler notificationHandler = OSMemberFunctionCast(IOServiceMatchingNotificationHandler, this, &ApplePS2Controller::notificationHandler);
IOServiceMatchingNotificationHandler notificationHandlerPublish = OSMemberFunctionCast(IOServiceMatchingNotificationHandler, this, &ApplePS2Controller::notificationHandlerPublish);

//
// Register notifications for availability of any IOService objects wanting to consume our message events
//
_publishNotify = addMatchingNotification(gIOFirstPublishNotification,
propertyMatch,
notificationHandler,
notificationHandlerPublish,
this,
0, 10000);

IOServiceMatchingNotificationHandler notificationHandlerTerminate = OSMemberFunctionCast(IOServiceMatchingNotificationHandler, this, &ApplePS2Controller::notificationHandlerTerminate);

_terminateNotify = addMatchingNotification(gIOTerminatedNotification,
propertyMatch,
notificationHandler,
notificationHandlerTerminate,
this,
0, 10000);

Expand Down Expand Up @@ -1972,23 +1974,29 @@ void ApplePS2Controller::uninstallPowerControlAction( PS2DeviceType deviceType )

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

void ApplePS2Controller::notificationHandlerGated(IOService * newService, IONotifier * notifier)
void ApplePS2Controller::notificationHandlerPublishGated(IOService * newService, IONotifier * notifier)
{
if (notifier == _publishNotify) {
IOLog("%s: Notification consumer published: %s\n", getName(), newService->getName());
_notificationServices->setObject(newService);
}

if (notifier == _terminateNotify) {
IOLog("%s: Notification consumer terminated: %s\n", getName(), newService->getName());
_notificationServices->removeObject(newService);
}
IOLog("%s: Notification consumer published: %s\n", getName(), newService->getName());
_notificationServices->setObject(newService);
}

bool ApplePS2Controller::notificationHandler(void * refCon, IOService * newService, IONotifier * notifier)
bool ApplePS2Controller::notificationHandlerPublish(void * refCon, IOService * newService, IONotifier * notifier)
{
assert(_cmdGate != nullptr);
_cmdGate->runAction(OSMemberFunctionCast(IOCommandGate::Action, this, &ApplePS2Controller::notificationHandlerGated), newService, notifier);
_cmdGate->runAction(OSMemberFunctionCast(IOCommandGate::Action, this, &ApplePS2Controller::notificationHandlerPublishGated), newService, notifier);
return true;
}

void ApplePS2Controller::notificationHandlerTerminateGated(IOService * newService, IONotifier * notifier)
{
IOLog("%s: Notification consumer terminated: %s\n", getName(), newService->getName());
_notificationServices->removeObject(newService);
}

bool ApplePS2Controller::notificationHandlerTerminate(void * refCon, IOService * newService, IONotifier * notifier)
{
assert(_cmdGate != nullptr);
_cmdGate->runAction(OSMemberFunctionCast(IOCommandGate::Action, this, &ApplePS2Controller::notificationHandlerTerminateGated), newService, notifier);
return true;
}

Expand Down
7 changes: 5 additions & 2 deletions VoodooPS2Controller/VoodooPS2Controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,11 @@ class EXPORT ApplePS2Controller : public IOService
static void interruptHandlerMouse(OSObject*, void* refCon, IOService*, int);
static void interruptHandlerKeyboard(OSObject*, void* refCon, IOService*, int);

void notificationHandlerGated(IOService * newService, IONotifier * notifier);
bool notificationHandler(void * refCon, IOService * newService, IONotifier * notifier);
void notificationHandlerPublishGated(IOService * newService, IONotifier * notifier);
bool notificationHandlerPublish(void * refCon, IOService * newService, IONotifier * notifier);

void notificationHandlerTerminateGated(IOService * newService, IONotifier * notifier);
bool notificationHandlerTerminate(void * refCon, IOService * newService, IONotifier * notifier);

void dispatchMessageGated(int* message, void* data);

Expand Down

0 comments on commit dc35712

Please sign in to comment.