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

Method getControllerViaMatching

USBToolBox/USBToolBox.cpp:114–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114IORegistryEntry* USBToolBox::getControllerViaMatching() {
115 PE_parse_boot_argn(bootargMatchWait, &matchWait, sizeof(matchWait));
116
117 if (OSObject* matchWaitProperty = pciDevice->getProperty(propertyMatchWait)) {
118 if (OSNumber* matchWaitNumber = OSDynamicCast(OSNumber, matchWaitProperty)) {
119 matchWait = matchWaitNumber->unsigned64BitValue();
120 } else {
121 DEBUGLOGPROV("Provider match wait property is incorrect type");
122 }
123 }
124
125 if (OSObject* matchWaitProperty = getProperty(propertyMatchWait)) {
126 if (OSNumber* matchWaitNumber = OSDynamicCast(OSNumber, matchWaitProperty)) {
127 matchWait = matchWaitNumber->unsigned64BitValue();
128 } else {
129 DEBUGLOGPROV("Match wait property is incorrect type");
130 }
131 }
132
133 if (matchWait > MAX_WAIT) {
134 SYSTEMLOGPROV("Match wait is too high, ignoring");
135 matchWait = DEFAULT_WAIT;
136 }
137
138 OSDictionary* matchingDict = createMatchingDictionary();
139
140 if (!matchingDict) {
141 SYSTEMLOGPROV("Failed to create matching dict!");
142 return NULL;
143 }
144
145 DEBUGLOGPROV("Starting waitForMatchingService");
146 IOService* controller = IOService::waitForMatchingService(matchingDict, matchWait * NANOSECONDS);
147
148 OSSafeReleaseNULL(matchingDict);
149
150 if (controller) {
151 DEBUGLOGPROV("waitForMatchingService successful");
152 } else {
153 SYSTEMLOGPROV("waitForMatchingService failed or timed out, will try different method");
154 }
155 return controller;
156}
157
158bool USBToolBox::checkClassHierarchy(IORegistryEntry* entry, const char* className) {
159 const OSSymbol* classSymbol = OSSymbol::withCString(className);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected