IOReturn CLASS::message(UInt32 type, IOService* provider, void* argument) { IOReturn rc; uint8_t controller; rc = super::message(type, provider, argument); switch (type) { case kIOUSBMessageHubPortDeviceDisconnected: if (m_invalid_regspace || (gUSBStackDebugFlags & kUSBDisableMuxedPortsMask) || !_device || isInactive() || !(_errataBits & kErrataIntelPortMuxing)) return rc; HCSelectWithMethod(static_cast<char const*>(argument)); return rc; case kIOUSBMessageMuxFromEHCIToXHCI: controller = 1U; break; case kIOUSBMessageMuxFromXHCIToEHCI: controller = 0U; break; default: return kIOReturnUnsupported; } if (m_invalid_regspace || (gUSBStackDebugFlags & kUSBDisableMuxedPortsMask) || !_device || isInactive() || !(_errataBits & kErrataIntelPortMuxing)) return rc; HCSelect(static_cast<uint8_t>(reinterpret_cast<size_t>(argument)), controller); return rc; }
//====================================================================== // Subscriber: BITSubscriber / ATLSubscriber / WIFISubscriber //====================================================================== bool Subscriber::forMe(Notification ¬ification) { if (NULL != notification.rcver) { return equals(notification.rcver); } else { return Notification::BROADCAST_ALL == notification.groupID || (Notification::BROADCAST_ACTIVE == notification.groupID && !isInactive()) || (Notification::BROADCAST_INACTIVE == notification.groupID && isInactive()); } }
IOReturn FakeSMCKeyStoreUserClient::clientClose(void) { if( !isInactive()) terminate(); return kIOReturnSuccess; }
void TranslucencyEffect::prePaintWindow(EffectWindow* w, WindowPrePaintData& data, int time) { // We keep track of the windows that was last active so we know // which one to fade out and which ones to paint as fully inactive if (w == active && w != current) { previous = current; current = w; } moveresize_timeline.setCurrentTime(moveresize_timeline.currentTime() + time); activeinactive_timeline.setCurrentTime(activeinactive_timeline.currentTime() + time); if (decoration != 1.0 && w->hasDecoration()) { data.mask |= PAINT_WINDOW_TRANSLUCENT; // don't clear PAINT_WINDOW_OPAQUE, contents are not affected data.clip &= w->contentsRect().translated(w->pos()); // decoration cannot clip } if (inactive != 1.0 && (isInactive(w) || activeinactive_timeline.currentValue() < 1.0)) data.setTranslucent(); else if (moveresize != 1.0 && (w->isUserMove() || w->isUserResize() || w == fadeout)) { data.setTranslucent(); } else if (dialogs != 1.0 && w->isDialog()) { data.setTranslucent(); } else if ((dropdownmenus != 1.0 && w->isDropdownMenu()) || (popupmenus != 1.0 && w->isPopupMenu()) || (tornoffmenus != 1.0 && w->isMenu()) || (comboboxpopups != 1.0 && w->isComboBox())) { data.setTranslucent(); } effects->prePaintWindow(w, data, time); }
IOReturn AppleFusedKernelRamdiskBlockDevice::doAsyncReadWrite(IOMemoryDescriptor *buffer, UInt64 block, UInt64 nblks, IOStorageAttributes *attributes, IOStorageCompletion *completion) { IODirection direction; IOByteCount actualByteCount; // Return errors for incoming I/O if we have been terminated if (isInactive() != false ) return kIOReturnNotAttached; direction = buffer->getDirection(); if ((direction != kIODirectionIn) && (direction != kIODirectionOut)) return kIOReturnBadArgument; if ((block + nblks) > _blockCount) return kIOReturnBadArgument; if (direction == kIODirectionIn) actualByteCount = _provider->performRead(buffer, (block*kDiskBlockSize), (nblks*kDiskBlockSize)); else actualByteCount = _provider->performWrite(buffer, (block*kDiskBlockSize), (nblks*kDiskBlockSize)); (completion->action)(completion->target, completion->parameter, kIOReturnSuccess, actualByteCount); return kIOReturnSuccess; }
IOReturn USERCLIENT_KEXT_CLASSNAME::callback_notification_from_kext(OSAsyncReference64 asyncReference) { KEXT_NAMESPACE::GlobalLock::ScopedLock lk; if (! lk) return kIOReturnCannotLock; if (provider_ == NULL || isInactive()) { // Return an error if we don't have a provider. This could happen if the user process // called callback_notification_from_kext without calling IOServiceOpen first. // Or, the user client could be in the process of being terminated and is thus inactive. IOLOG_ERROR("UserClient_kext::callback_notification_from_kext kIOReturnNotAttached\n"); return kIOReturnNotAttached; } if (! provider_->isOpen(this)) { // Return an error if we do not have the driver open. This could happen if the user process // did not call callback_open before calling this function. IOLOG_ERROR("UserClient_kext::callback_notification_from_kext kIOReturnNotOpen\n"); return kIOReturnNotOpen; } // ---------------------------------------- bcopy(asyncReference, asyncref_, sizeof(OSAsyncReference64)); notification_enabled_ = true; return kIOReturnSuccess; }
IOReturn org_pqrs_driver_PCKeyboardHack_UserClient_kext::callback_synchronized_communication(const BridgeUserClientStruct* inputdata) { if (! inputdata) { IOLOG_ERROR("UserClient_kext::callback_synchronized_communication kIOReturnBadArgument\n"); return kIOReturnBadArgument; } if (provider_ == NULL || isInactive()) { // Return an error if we don't have a provider. This could happen if the user process // called callback_synchronized_communication without calling IOServiceOpen first. // Or, the user client could be in the process of being terminated and is thus inactive. IOLOG_ERROR("UserClient_kext::callback_synchronized_communication kIOReturnNotAttached\n"); return kIOReturnNotAttached; } if (! provider_->isOpen(this)) { // Return an error if we do not have the driver open. This could happen if the user process // did not call callback_open before calling this function. IOLOG_ERROR("UserClient_kext::callback_synchronized_communication kIOReturnNotOpen\n"); return kIOReturnNotOpen; } // -------------------------------------------------- org_pqrs_driver_PCKeyboardHack::setConfiguration(*inputdata); return kIOReturnSuccess; }
IOReturn ACPIProbeUserClient::clientClose(void) { if( !isInactive()) terminate(); return kIOReturnSuccess; }
IOReturn SoftU2FUserClient::sendFrame(U2FHID_FRAME *frame, size_t frameSize) { SoftU2FDevice *device = nullptr; IOMemoryDescriptor *report = nullptr; if (isInactive()) return kIOReturnOffline; if (frameSize != HID_RPT_SIZE) return kIOReturnBadArgument; device = OSDynamicCast(SoftU2FDevice, getClient()); if (!device) return kIOReturnNotAttached; report = IOBufferMemoryDescriptor::inTaskWithOptions(kernel_task, 0, HID_RPT_SIZE); if (!report) return kIOReturnNoResources; report->writeBytes(0, frame, frameSize); if (device->handleReport(report) != kIOReturnSuccess) { report->release(); return kIOReturnError; } report->release(); return kIOReturnSuccess; }
void IOAudioPort::deactivateAudioControls() { OSCollectionIterator *iterator; if (!audioControls) { return; } iterator = OSCollectionIterator::withCollection(audioControls); if (iterator) { IOAudioControl *control; while ( (control = (IOAudioControl *)iterator->getNextObject()) ) { // Should we check to see if we're the provider? if (!isInactive()) { control->terminate(); } } iterator->release(); } audioControls->flushCollection(); }
void Xbox360Peripheral::SerialReadComplete(void *parameter, IOReturn status, UInt32 bufferSizeRemaining) { if (padHandler != NULL) // avoid deadlock with release { LockRequired locker(mainLock); bool reread = !isInactive(); switch (status) { case kIOReturnOverrun: IOLog("read (serial) - kIOReturnOverrun, clearing stall\n"); if (serialInPipe != NULL) serialInPipe->ClearStall(); // Fall through case kIOReturnSuccess: serialHeard = true; if (serialInBuffer != NULL) SerialMessage(serialInBuffer, serialInBuffer->getCapacity() - bufferSizeRemaining); break; case kIOReturnNotResponding: IOLog("read (serial) - kIOReturnNotResponding\n"); reread = false; break; default: reread = false; break; } if (reread) QueueSerialRead(); } }
IOReturn CodecCommanderClient::clientClose(void) { if (!isInactive()) terminate(); return kIOReturnSuccess; }
IOReturn IOAccelerationUserClient::clientClose( void ) { if( !isInactive()) terminate(); return( kIOReturnSuccess ); }
IOReturn IOAudioControlUserClient::registerNotificationPort(mach_port_t port, UInt32 type, // No longer used now that we have the generic sendChangeNotification routine UInt32 refCon) { IOReturn result = kIOReturnSuccess; if (!isInactive()) { if (notificationMessage == 0) { notificationMessage = (IOAudioNotificationMessage *)IOMallocAligned(sizeof(IOAudioNotificationMessage), sizeof (IOAudioNotificationMessage *)); if (!notificationMessage) { return kIOReturnNoMemory; } } notificationMessage->messageHeader.msgh_bits = MACH_MSGH_BITS(MACH_MSG_TYPE_COPY_SEND, 0); notificationMessage->messageHeader.msgh_size = sizeof(IOAudioNotificationMessage); notificationMessage->messageHeader.msgh_remote_port = port; notificationMessage->messageHeader.msgh_local_port = MACH_PORT_NULL; notificationMessage->messageHeader.msgh_reserved = 0; notificationMessage->messageHeader.msgh_id = 0; // notificationMessage->type = type; // ignored now that we have the generic sendChangeNotification routine notificationMessage->ref = refCon; } else { result = kIOReturnNoDevice; } return result; }
IOReturn IOHIDEventSystemUserClient::destroyEventQueue(void*p1,void*p2,void*,void*,void*,void*) { IOReturn status = kIOReturnSuccess; if (!isInactive() && commandGate) { status = commandGate->runAction(OSMemberFunctionCast(IOCommandGate::Action, this, &IOHIDEventSystemUserClient::destroyEventQueueGated),p1, p2); } return status; }
IOReturn SoftU2FUserClient::externalMethod(uint32_t selector, IOExternalMethodArguments *arguments, IOExternalMethodDispatch *dispatch, OSObject *target, void *reference) { if (isInactive()) return kIOReturnOffline; ExternalMethodGatedArguments gatedArguments = {selector, arguments, dispatch, target, reference}; return _commandGate->runAction(OSMemberFunctionCast(IOCommandGate::Action, this, &SoftU2FUserClient::externalMethodGated), &gatedArguments); }
IOReturn IOHIDLibUserClient::clientClose(void) { if ( !isInactive() && fGate ) { fGate->runAction(OSMemberFunctionCast(IOCommandGate::Action, this, &IOHIDLibUserClient::cleanupGated)); terminate(); } return kIOReturnSuccess; }
IOReturn SamplePCIUserClientClassName::clientClose(void) { IOLog("%s[%p]::%s()\n", getName(), this, __FUNCTION__); if( !isInactive()) terminate(); return kIOReturnSuccess; }
IOReturn MACJackUserClient::open(void) { WLLogInfo("MACJackUserClient::open()\n"); if (isInactive()) return kIOReturnNotAttached; if (!_provider->open(this)) return kIOReturnExclusiveAccess; return kIOReturnSuccess; }
IOReturn AudioUserClient::DeviceOk() { if (iDevice == 0 || isInactive()) { return kIOReturnNotAttached; } else if (!iDevice->isOpen(this)) { return kIOReturnNotOpen; } else { return kIOReturnSuccess; } }
IOReturn USER_CLIENT_CLASS_NAME::openUserClient() { IOLog("%s[%p]::%s()\n", getName(), this, __FUNCTION__); if (provider_ == NULL || isInactive()) { return kIOReturnNotAttached; } else if (!provider_->open(this)) { return kIOReturnExclusiveAccess; } return kIOReturnSuccess; }
IOReturn AudioUserClient::DoOpen() { if (iDevice == 0 || isInactive()) { IOLog("Songcast AudioUserClient[%p]::Open() not attached\n", this); return kIOReturnNotAttached; } else if (!iDevice->open(this)) { IOLog("Songcast AudioUserClient[%p]::Open() exclusive access\n", this); return kIOReturnExclusiveAccess; } IOLog("Songcast AudioUserClient[%p]::Open() ok\n", this); return kIOReturnSuccess; }
IOReturn SoftU2FUserClient::externalMethodGated(ExternalMethodGatedArguments *arguments) { if (isInactive()) return kIOReturnOffline; if (arguments->selector >= (uint32_t)kNumberOfMethods) return kIOReturnBadArgument; arguments->dispatch = (IOExternalMethodDispatch *)&sMethods[arguments->selector]; if (!arguments->target) arguments->target = this; return super::externalMethod(arguments->selector, arguments->arguments, arguments->dispatch, arguments->target, arguments->reference); }
IOReturn USERCLIENT_KEXT_CLASSNAME::callback_open(uint64_t bridge_version_app, uint64_t* outputdata) { KEXT_NAMESPACE::GlobalLock::ScopedLock lk; if (! lk) return kIOReturnCannotLock; if (! outputdata) { IOLOG_ERROR("UserClient_kext::callback_open kIOReturnBadArgument\n"); return kIOReturnBadArgument; } *outputdata = BRIDGE_USERCLIENT_OPEN_RETURN_ERROR_GENERIC; if (provider_ == NULL || isInactive()) { // Return an error if we don't have a provider. This could happen if the user process // called callback_open without calling IOServiceOpen first. Or, the user client could be // in the process of being terminated and is thus inactive. IOLOG_ERROR("UserClient_kext::callback_open kIOReturnNotAttached\n"); return kIOReturnNotAttached; } if (! provider_->open(this)) { // The most common reason this open call will fail is because the provider is already open // and it doesn't support being opened by more than one client at a time. IOLOG_ERROR("UserClient_kext::callback_open kIOReturnExclusiveAccess\n"); return kIOReturnExclusiveAccess; } // ------------------------------------------------------------ *outputdata = BRIDGE_USERCLIENT_OPEN_RETURN_SUCCESS; // ---------------------------------------- // Checking bridge_versions: // // Note: // We need to return kIOReturnSuccess in order to return outputdata to userspace. // (If we return error such as kIOReturnError, outputdata in userspace will not be changed.) uint64_t bridge_version_kext = #include "../../../src/bridge/output/include.bridge_version.h" ; if (bridge_version_kext != bridge_version_app) { IOLOG_ERROR("UserClient_kext::callback_open BRIDGE_USERCLIENT_OPEN_RETURN_ERROR_BRIDGE_VERSION_MISMATCH kext:0x%llx != app:0x%llx\n", bridge_version_kext, bridge_version_app); *outputdata = BRIDGE_USERCLIENT_OPEN_RETURN_ERROR_BRIDGE_VERSION_MISMATCH; } // ---------------------------------------- return kIOReturnSuccess; }
IOReturn IOAudioControlUserClient::clientClose() { audioDebugIOLog(3, "+ IOAudioControlUserClient[%p]::clientClose()\n", this); if (audioControl) { if (!audioControl->isInactive () && !isInactive()) { audioControl->clientClosed(this); } audioControl->release(); audioControl = 0; } audioDebugIOLog(3, "- IOAudioControlUserClient[%p]::clientClose() returns 0x%lX\n", this, (long unsigned int)kIOReturnSuccess ); return kIOReturnSuccess; }
IOExternalMethod * SATSMARTUserClient::getTargetAndMethodForIndex ( IOService ** target, UInt32 index ) { DEBUG_LOG("%s[%p]::%s index %d\n", getClassName(), this, __FUNCTION__, (int)index); if ( index >= kIOATASMARTMethodCount ) return NULL; if ( isInactive ( ) ) return NULL; *target = this; return &sMethods[index]; }
Goal<ZeldaEntity>::Status Goal_MoveToPosition::process(const sf::Time& dt) { if (isInactive()) { activate(); } setStatus(processSubgoals(dt)); if (hasFailed()) { activate(); } return getStatus(); }
IOReturn USER_CLIENT_CLASS_NAME::setControlModifierKey(bool isActive) { IOLog("%s[%p]::%s(isActive = %d)\n" , getName() , this , __FUNCTION__ , int(isActive)); if (provider_ == NULL || isInactive()) { return kIOReturnNotAttached; } else if (!provider_->isOpen(this)) { return kIOReturnNotOpen; } else { return provider_->setControlModifierKey(isActive); } }
IOReturn SoftU2FUserClient::notifyFrame(io_user_reference_t *ref, uint32_t refCount) { if (isInactive()) return kIOReturnOffline; if (_notifyRef) { IOFree(_notifyRef, sizeof(OSAsyncReference64)); _notifyRef = nullptr; } _notifyRef = (OSAsyncReference64 *)IOMalloc(sizeof(OSAsyncReference64)); if (!_notifyRef) return kIOReturnNoMemory; bzero(_notifyRef, sizeof(OSAsyncReference64)); memcpy(_notifyRef, ref, sizeof(io_user_reference_t) * refCount); return kIOReturnSuccess; }
// defining and selecting our external user client methods IOReturn SamplePCIUserClientClassName::externalMethod( uint32_t selector, IOExternalMethodArguments* arguments, IOExternalMethodDispatch * dispatch, OSObject * target, void * reference ) { IOReturn result; if (fDriver == NULL || isInactive()) { // Return an error if we don't have a provider. This could happen if the user process // called either method without calling IOServiceOpen first. Or, the user client could be // in the process of being terminated and is thus inactive. result = kIOReturnNotAttached; } else if (!fDriver->isOpen(this)) { // Return an error if we do not have the driver open. This could happen if the user process // did not call openUserClient before calling this function. result = kIOReturnNotOpen; } IOReturn err; IOLog("The Leopard and later way to route external methods\n"); switch (selector) { case kSampleMethod1: err = method1( (UInt32 *) arguments->structureInput, (UInt32 *) arguments->structureOutput, arguments->structureInputSize, (IOByteCount *) &arguments->structureOutputSize ); break; case kSampleMethod2: err = method2( (SampleStructForMethod2 *) arguments->structureInput, (SampleResultsForMethod2 *) arguments->structureOutput, arguments->structureInputSize, (IOByteCount *) &arguments->structureOutputSize ); break; default: err = kIOReturnBadArgument; break; } IOLog("externalMethod(%d) 0x%x", selector, err); return (err); }