From ef8e8ff7ae9a51e781575c6b99b30bb4e4dd9276 Mon Sep 17 00:00:00 2001 From: Fredrik Gustafsson Date: Mon, 8 May 2017 23:17:18 -0400 Subject: [PATCH] add clientClose to properly temrinate userclient --- foohid/foohid_userclient.cpp | 11 +++++++++++ foohid/foohid_userclient.h | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/foohid/foohid_userclient.cpp b/foohid/foohid_userclient.cpp index 8395b70..8cf6764 100644 --- a/foohid/foohid_userclient.cpp +++ b/foohid/foohid_userclient.cpp @@ -46,6 +46,17 @@ void it_unbit_foohid_userclient::stop(IOService *provider) { super::stop(provider); } +IOReturn it_unbit_foohid_userclient::clientClose(void) +{ + bool success = terminate(); + if (!success) { + return kIOReturnDeviceError; + } + + return kIOReturnSuccess; +} + + /** * A dispatch table for this User Client interface, used by 'it_unbit_foohid_userclient::externalMethod()'. * The fields of the IOExternalMethodDispatch type follows: diff --git a/foohid/foohid_userclient.h b/foohid/foohid_userclient.h index b6796c8..6d26291 100644 --- a/foohid/foohid_userclient.h +++ b/foohid/foohid_userclient.h @@ -28,7 +28,8 @@ class it_unbit_foohid_userclient : public IOUserClient { virtual bool start(IOService *provider) override; virtual void stop(IOService *provider) override; - + virtual IOReturn clientClose(void) override; + virtual IOReturn externalMethod(uint32_t selector, IOExternalMethodArguments *arguments, IOExternalMethodDispatch *dispatch,