bool AppleUSBCDC::confirmControl(UInt8 subClass, IOUSBInterface *CInterface) { IOUSBFindInterfaceRequest req; IOUSBInterface *Comm; UInt8 intSubClass; bool driverOK = false; XTRACE(this, subClass, 0, "confirmControl"); // We need to look for CDC interfaces of the specified subclass req.bInterfaceClass = kUSBCommunicationClass; // req.bInterfaceSubClass = kIOUSBFindInterfaceDontCare; req.bInterfaceSubClass = subClass; req.bInterfaceProtocol = kIOUSBFindInterfaceDontCare; req.bAlternateSetting = kIOUSBFindInterfaceDontCare; Comm = fpDevice->FindNextInterface(NULL, &req); if (!Comm) { XTRACE(this, 0, 0, "confirmDriver - Finding the first CDC interface failed"); return false; } while (Comm) { intSubClass = Comm->GetInterfaceSubClass(); if (intSubClass == subClass) // Just to make sure... { XTRACE(this, Comm->GetInterfaceNumber(), CInterface->GetInterfaceNumber(), "confirmControl - Checking interfaces"); if (Comm == CInterface) { driverOK = true; break; } } // see if there's another CDC interface req.bInterfaceClass = kUSBCommunicationClass; // req.bInterfaceSubClass = kIOUSBFindInterfaceDontCare; req.bInterfaceSubClass = subClass; req.bInterfaceProtocol = kIOUSBFindInterfaceDontCare; req.bAlternateSetting = kIOUSBFindInterfaceDontCare; Comm = fpDevice->FindNextInterface(Comm, &req); if (!Comm) { XTRACE(this, 0, 0, "confirmControl - No more CDC interfaces"); } } return driverOK; }/* end confirmControl */
bool AppleUSBCDC::confirmDriver(UInt8 subClass, UInt8 dataInterface) { IOUSBFindInterfaceRequest req; IOUSBInterface *Comm; UInt8 intSubClass; UInt8 controlInterfaceNumber; bool driverOK = false; XTRACE(this, subClass, dataInterface, "confirmDriver"); // We need to look for CDC interfaces of the specified subclass req.bInterfaceClass = kUSBCommunicationClass; // req.bInterfaceSubClass = kIOUSBFindInterfaceDontCare; req.bInterfaceSubClass = subClass; req.bInterfaceProtocol = kIOUSBFindInterfaceDontCare; req.bAlternateSetting = kIOUSBFindInterfaceDontCare; Comm = fpDevice->FindNextInterface(NULL, &req); if (!Comm) { XTRACE(this, 0, 0, "confirmDriver - Finding the first CDC interface failed"); return false; } while (Comm) { controlInterfaceNumber = Comm->GetInterfaceNumber(); intSubClass = Comm->GetInterfaceSubClass(); if (intSubClass == subClass) // Just to make sure... { switch (intSubClass) { case kUSBAbstractControlModel: driverOK = checkACM(Comm, controlInterfaceNumber, dataInterface); break; case kUSBEthernetControlModel: driverOK = checkECM(Comm, controlInterfaceNumber, dataInterface); break; case kUSBWirelessHandsetControlModel: driverOK = checkWMC(Comm, controlInterfaceNumber, dataInterface); break; case kUSBDeviceManagementModel: driverOK = checkDMM(Comm, controlInterfaceNumber, dataInterface); break; case kUSBEthernetEmulationModel: // There's only one interface for EEM so the data and the control interface are the same // May need to revisit this if (controlInterfaceNumber == dataInterface) { driverOK = true; } break; case kUSBNetworkControlModel: driverOK = checkMBIM(Comm, controlInterfaceNumber, dataInterface); break; case kUSBMobileBroadbandInterfaceModel: driverOK = checkMBIM(Comm, controlInterfaceNumber, dataInterface); break; default: break; } } if (driverOK) { XTRACE(this, 0, 0, "confirmDriver - Interface confirmed"); break; } // see if there's another CDC interface req.bInterfaceClass = kUSBCommunicationClass; // req.bInterfaceSubClass = kIOUSBFindInterfaceDontCare; req.bInterfaceSubClass = subClass; req.bInterfaceProtocol = kIOUSBFindInterfaceDontCare; req.bAlternateSetting = kIOUSBFindInterfaceDontCare; Comm = fpDevice->FindNextInterface(Comm, &req); if (!Comm) { XTRACE(this, 0, 0, "confirmDriver - No more CDC interfaces"); } } return driverOK; }/* end confirmDriver */