| 112 | } |
| 113 | |
| 114 | IORegistryEntry* 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 | |
| 158 | bool USBToolBox::checkClassHierarchy(IORegistryEntry* entry, const char* className) { |
| 159 | const OSSymbol* classSymbol = OSSymbol::withCString(className); |
nothing calls this directly
no outgoing calls
no test coverage detected