diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6bc2b1e --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# macOS +.DS_Store +*.swp +*~ + +# Xcode / Build artifacts +build/ +DerivedData/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata/ +*.xccheckout +*.moved-aside +*.hmap +*.ipa +*.xcuserstate + +# Compiled Kexts +*.kext/ diff --git a/QualcommWireless/QualcommWifi.cpp b/QualcommWireless/QualcommWifi.cpp index 57f544d..729d918 100644 --- a/QualcommWireless/QualcommWifi.cpp +++ b/QualcommWireless/QualcommWifi.cpp @@ -37,7 +37,25 @@ void QualcommWifi::free(void) { } IOService *QualcommWifi::probe(IOService *provider, SInt32 *score) { - return super::probe(provider, score); + if (!super::probe(provider, score)) { + return nullptr; + } + + IOPCIDevice *pciDev = OSDynamicCast(IOPCIDevice, provider); + if (!pciDev) { + return nullptr; + } + + UInt16 vendorId = pciDev->configRead16(kIOPCIConfigVendorID); + UInt16 deviceId = pciDev->configRead16(kIOPCIConfigDeviceID); + + if (vendorId == 0x17cb && deviceId == 0x1107) { + IOLog("QualcommWifi: Controleur Wi-Fi 7 Qualcomm WCN7850 detecte (0x%04x:0x%04x) !\n", vendorId, deviceId); + *score += 20000; + return this; + } + + return nullptr; } UInt32 QualcommWifi::read32(UInt32 offset) { @@ -858,6 +876,56 @@ SInt32 QualcommWifi::apple80211Request(unsigned int req_type, int req_val, IO802 case APPLE80211_IOC_SCAN_RESULT: { return 0; } + case APPLE80211_IOC_POWER: { + apple80211_power_data *pwr = (apple80211_power_data *)req_data; + if (pwr) { + pwr->version = APPLE80211_VERSION; + pwr->num_radios = 1; + if (req_val == 0 || req_val == 1) { + fLinkActive = (req_val == 1); + IOLog("QualcommWifi: Bascule alimentation radio Wi-Fi demandee : %s\n", fLinkActive ? "ACTIVE" : "COUPEE"); + } + pwr->power_state[0] = fLinkActive ? 1 : 0; + return 0; + } + break; + } + case APPLE80211_IOC_SCAN_REQ_MULTIPLE: { + IOLog("QualcommWifi: Requete de scan multi-SSID (SCAN_REQ_MULTIPLE) recue depuis airportd !\n"); + fScanInProgress = true; + return 0; + } + case APPLE80211_IOC_COUNTRY_CODE: { + apple80211_country_code_data *cc = (apple80211_country_code_data *)req_data; + if (cc) { + cc->version = APPLE80211_VERSION; + cc->cc[0] = 'F'; + cc->cc[1] = 'R'; + cc->cc[2] = 0; + return 0; + } + break; + } + case APPLE80211_IOC_LOCALE: { + apple80211_locale_data *loc = (apple80211_locale_data *)req_data; + if (loc) { + loc->version = APPLE80211_VERSION; + loc->locale = APPLE80211_LOCALE_ETSI; + return 0; + } + break; + } + case APPLE80211_IOC_DRIVER_VERSION: { + apple80211_version_data *vd = (apple80211_version_data *)req_data; + if (vd) { + vd->version = APPLE80211_VERSION; + const char *verStr = "Qualcomm FastConnect 7800 Wi-Fi 7 (v1.0.2)"; + vd->string_len = (u_int16_t)strlen(verStr); + strlcpy(vd->string, verStr, sizeof(vd->string)); + return 0; + } + break; + } case APPLE80211_IOC_ASSOCIATE: { apple80211_assoc_data *assoc = (apple80211_assoc_data *)req_data; if (assoc) {