From 01cc1806d71f5cc64c464851b9f4811a3e7b4791 Mon Sep 17 00:00:00 2001 From: zxystd <1051244836@qq.com> Date: Wed, 18 Sep 2024 07:47:35 +0800 Subject: [PATCH] IntelBTPatcher: reduce side effect for systems before Sequoia. --- IntelBTPatcher/IntelBTPatcher.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/IntelBTPatcher/IntelBTPatcher.cpp b/IntelBTPatcher/IntelBTPatcher.cpp index 72ab0f5..0f0993a 100644 --- a/IntelBTPatcher/IntelBTPatcher.cpp +++ b/IntelBTPatcher/IntelBTPatcher.cpp @@ -165,12 +165,14 @@ IOReturn CIntelBTPatcher::newHostDeviceRequest(void *that, IOService *provider, char hciBuf[MAX_HCI_BUF_LEN] = {0}; if (data == nullptr) { - if (descriptor != nullptr && !descriptor->prepare(kIODirectionOut)) { + if (descriptor != nullptr && + (getKernelVersion() < KernelVersion::Sequoia || !descriptor->prepare(kIODirectionOut))) { if (descriptor->getLength() > 0) { descriptor->readBytes(0, hciBuf, min(descriptor->getLength(), MAX_HCI_BUF_LEN)); hdrLen = (uint32_t)min(descriptor->getLength(), MAX_HCI_BUF_LEN); } - descriptor->complete(kIODirectionOut); + if (getKernelVersion() >= KernelVersion::Sequoia) + descriptor->complete(kIODirectionOut); } hdr = (HciCommandHdr *)hciBuf; if (hdr->opcode == HCI_OP_LE_SET_SCAN_PARAM) {