MCPcopy Create free account
hub / github.com/USBToolBox/kext / getControllerViaIteration

Method getControllerViaIteration

USBToolBox/USBToolBox.cpp:178–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178IORegistryEntry* USBToolBox::getControllerViaIteration() {
179 OSIterator* iterator = pciDevice->getChildIterator(gIOServicePlane);
180 if (!iterator) {
181 SYSTEMLOGPROV("Failed to create IOService iterator!");
182 return NULL;
183 }
184
185 IORegistryEntry* controller = NULL;
186
187 DEBUGLOGPROV("Starting iteration over IOService plane");
188 while (IORegistryEntry* entry = OSDynamicCast(IORegistryEntry, iterator->getNextObject())) {
189 // DEBUGLOGPROV("Object name is %s with class %s", entry->getName(), entry->getMetaClass()->getClassName());
190 if (checkClassHierarchy(entry, "AppleUSBHostController")) {
191 // This is it
192 DEBUGLOGPROV("%s is AppleUSBHostController instance", entry->getName());
193 // Retain before we exit iterator to prevent any races.
194 entry->retain();
195 controller = entry;
196 break;
197 }
198 }
199 DEBUGLOGPROV("Iteration over IOService plane finished");
200 OSSafeReleaseNULL(iterator);
201
202 return controller;
203}
204
205void USBToolBox::deleteProperty(IORegistryEntry* entry, const char* property) {
206 if (entry->getProperty(property)) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected