This commit is contained in:
Echo
2019-12-16 20:18:34 +08:00
parent 9249e28066
commit ebb83d2bbd
78 changed files with 5388 additions and 1637 deletions
File diff suppressed because it is too large Load Diff
+21
View File
@@ -1,3 +1,24 @@
DW1820A: 00JT494 (Lenovo)
WiFi: pci14e4,43a3
bluetooth: 0a5c:6414
I've found out that using BrcmBluetoothInjector.kext inject bluetooth id will cause bluetooth unstable and unable to connect devices. And inject wifi id might also cause wifi no speed. It may look like drivers has been correctly loaded, but they just won't work.
The only way to make wifi and bluetooth work perfectly seems to be modify IO80211Family.kext and IOBluetoothFamily.kext, So I made this app to automatically modify and backup your IO80211Family.kext and IOBluetoothFamily.kext, I've only tested this on my computer, and it works fine.
Execute replace.sh script, it will use AddDW1820A.app to automatically modify and replace S/L/E/ IO80211Family.kext and IOBluetoothFamily.kext.
Wifi and Bluetooth id listed in AddDW1820A.app/Contents/Resources/Data.plist
Hope this works.
我发现用BrcmBluetoothInjector.kext注入蓝牙的id之后,蓝牙虽然能驱动。但是不稳定,而且会出现无法连接设备的情况,类似于注入无线网卡之后出现的没有网速的问题。
在我这里,修改系统里的IO80211Family.kex和IOBluetoothFamily.kext,在里边加入你的id可以完美驱动无线网卡和蓝牙。
所以,我用Python写了个小脚本,打包成了AddDW1820A.app,用来备份和修改你系统里的IO80211Family.kex和IOBluetoothFamily.kext。
蓝牙id和无线id可以加入到AddDW1820A.app/Contents/Resources/Data.plist里。
运行install.command来自动处理,或者运行AddDW1820A.app之后手动将IO80211Family.kex和IOBluetoothFamily.kext替换到S/L/E,然后重建缓存,修复权限。
@@ -1,65 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>18A391</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>FakePCIID</string>
<key>CFBundleIdentifier</key>
<string>org.rehabman.driver.FakePCIID</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>FakePCIID</string>
<key>CFBundlePackageType</key>
<string>KEXT</string>
<key>CFBundleShortVersionString</key>
<string>1.3.15</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1.3.15</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>9F2000</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>10M2518</string>
<key>DTSDKName</key>
<string>macosx10.6</string>
<key>DTXcode</key>
<string>0941</string>
<key>DTXcodeBuild</key>
<string>9F2000</string>
<key>OSBundleCompatibleVersion</key>
<string>1.3.15</string>
<key>OSBundleLibraries</key>
<dict>
<key>com.apple.iokit.IOPCIFamily</key>
<string>1.0.0b1</string>
<key>com.apple.kpi.bsd</key>
<string>8.0.0</string>
<key>com.apple.kpi.iokit</key>
<string>8.0.0</string>
<key>com.apple.kpi.libkern</key>
<string>8.0.0</string>
<key>com.apple.kpi.mach</key>
<string>8.0.0</string>
<key>com.apple.kpi.unsupported</key>
<string>8.0.0</string>
</dict>
<key>OSBundleRequired</key>
<string>Root</string>
<key>Source Code</key>
<string>https://github.com/RehabMan/FakePCIID</string>
</dict>
</plist>
Binary file not shown.
@@ -1,114 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>18A391</string>
<key>CFBundleIdentifier</key>
<string>org.rehabman.injector.FakePCIID-Broadcom-WiFi</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>FakePCIID_Broadcom_WiFi</string>
<key>CFBundlePackageType</key>
<string>KEXT</string>
<key>CFBundleShortVersionString</key>
<string>1.3.15</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1.3.15</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>9F2000</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>10M2518</string>
<key>DTSDKName</key>
<string>macosx10.6</string>
<key>DTXcode</key>
<string>0941</string>
<key>DTXcodeBuild</key>
<string>9F2000</string>
<key>IOKitPersonalities</key>
<dict>
<key>Airport_Brcm4360</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.driver.AirPort.Brcm4360</string>
<key>IOClass</key>
<string>AirPort_Brcm4360</string>
<key>IOMatchCategory</key>
<string>IODefaultMatchCategory</string>
<key>IONameMatch</key>
<array>
<string>pci14e4,4353</string>
<string>pci14e4,43a3</string>
<string>pci14e4,4357</string>
<string>pci14e4,43b1</string>
<string>pci14e4,43b2</string>
</array>
<key>IOProbeScore</key>
<integer>1110</integer>
<key>IOProviderClass</key>
<string>IOPCIDevice</string>
<key>TruePowerOff</key>
<true/>
</dict>
<key>Broadcom FakePCIID WiFi no device-id</key>
<dict>
<key>CFBundleIdentifier</key>
<string>org.rehabman.driver.FakePCIID</string>
<key>FakeProperties</key>
<dict>
<key>RM,subsystem-id</key>
<data>
NAEAAA==
</data>
<key>RM,subsystem-vendor-id</key>
<data>
axAAAA==
</data>
</dict>
<key>IOClass</key>
<string>FakePCIID</string>
<key>IOMatchCategory</key>
<string>FakePCIID</string>
<key>IONameMatch</key>
<array>
<string>pci14e4,4357</string>
<string>pci14e4,43b1</string>
<string>pci14e4,43a0</string>
<string>pci14e4,4331</string>
<string>pci14e4,4353</string>
<string>pci14e4,432b</string>
<string>pci14e4,43ba</string>
<string>pci14e4,43a3</string>
<string>pci106b,4e</string>
<string>pci14e4,4311</string>
<string>pci14e4,4312</string>
<string>pci14e4,4313</string>
<string>pci14e4,4318</string>
<string>pci14e4,4319</string>
<string>pci14e4,431a</string>
<string>pci14e4,4320</string>
<string>pci14e4,4324</string>
<string>pci14e4,4325</string>
<string>pci14e4,4328</string>
<string>pci14e4,432c</string>
<string>pci14e4,432d</string>
</array>
<key>IOProviderClass</key>
<string>IOPCIDevice</string>
</dict>
</dict>
<key>OSBundleRequired</key>
<string>Network-Root</string>
<key>Source Code</key>
<string>https://github.com/RehabMan/FakePCIID</string>
</dict>
</plist>
@@ -0,0 +1 @@
Versions/Current/Python
@@ -0,0 +1 @@
Versions/Current/Resources
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>Python</string>
<key>CFBundleGetInfoString</key>
<string>Python Runtime and Library</string>
<key>CFBundleIdentifier</key>
<string>org.python.python</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Python</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.7.5, (c) 2001-2019 Python Software Foundation.</string>
<key>CFBundleLongVersionString</key>
<string>3.7.5, (c) 2001-2019 Python Software Foundation.</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>3.7.5</string>
</dict>
</plist>
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>AddDW1820A</string>
<key>CFBundleExecutable</key>
<string>AddDW1820A</string>
<key>CFBundleIconFile</key>
<string>PythonApplet.icns</string>
<key>CFBundleIdentifier</key>
<string>org.pythonmac.unspecified.AddDW1820A</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>AddDW1820A</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.0.0</string>
<key>LSHasLocalizedDisplayName</key>
<false/>
<key>NSAppleScriptEnabled</key>
<false/>
<key>NSHumanReadableCopyright</key>
<string>Copyright not specified</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>PyMainFileNames</key>
<array>
<string>__boot__</string>
</array>
<key>PyOptions</key>
<dict>
<key>alias</key>
<false/>
<key>argv_emulation</key>
<false/>
<key>emulate_shell_environment</key>
<false/>
<key>no_chdir</key>
<false/>
<key>prefer_ppc</key>
<false/>
<key>site_packages</key>
<false/>
<key>use_faulthandler</key>
<false/>
<key>use_pythonpath</key>
<false/>
<key>verbose</key>
<false/>
</dict>
<key>PyResourcePackages</key>
<array/>
<key>PyRuntimeLocations</key>
<array>
<string>@executable_path/../Frameworks/Python.framework/Versions/3.7/Python</string>
</array>
<key>PythonInfoDict</key>
<dict>
<key>PythonExecutable</key>
<string>/Users/echo/Documents/Development/Projects/Scripts/venv/bin/python</string>
<key>PythonLongVersion</key>
<string>3.7.5 (default, Nov 1 2019, 02:16:23)
[Clang 11.0.0 (clang-1100.0.33.8)]</string>
<key>PythonShortVersion</key>
<string>3.7</string>
<key>py2app</key>
<dict>
<key>alias</key>
<false/>
<key>template</key>
<string>app</string>
<key>version</key>
<string>0.19</string>
</dict>
</dict>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
APPL????
@@ -0,0 +1,49 @@
import os
from biplist import *
airports = bts = None
try:
data = readPlist("./Data.plist")
airports = data["Airport"]
bts = data["Bluetooth"]
except InvalidPlistException as e:
print("Error:", e)
os.chdir("../../../")
os.system("cp -r /System/Library/Extensions/IO80211Family.kext ./")
os.system("cp -r /System/Library/Extensions/IOBluetoothFamily.kext ./")
os.system("cp -r ./IO80211Family.kext ./IO80211Family_Backup.kext")
os.system("cp -r ./IOBluetoothFamily.kext ./IOBluetoothFamily_Backup.kext")
airport_plist = "./IO80211Family.kext/Contents/PlugIns/AirPortBrcm4360.kext/Contents/Info.plist"
bt_plist = "./IOBluetoothFamily.kext/Contents/PlugIns/BroadcomBluetoothHostControllerUSBTransport.kext/Contents/Info.plist"
try:
# add wifi info
airport = readPlist(airport_plist)
for data in airports:
airport["IOKitPersonalities"]["Broadcom 802.11 PCI"]["IONameMatch"].append(f"pci{data}")
writePlist(airport, airport_plist)
# add bt info
bluetooth = readPlist(bt_plist)
for bt in bts:
vid_hex_str, pid_hex_str = bt.split(',')
vid = int(vid_hex_str, 16)
pid = int(pid_hex_str, 16)
vid_hex = ("%#X" % vid)[2:]
pid_hex = ("%#X" % pid)[2:]
bluetooth["IOKitPersonalities"][f"PID {pid} 0x{pid_hex} VID {vid} 0x{vid_hex}"] = \
{'CFBundleIdentifier': 'com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport',
'IOClass': 'BroadcomBluetoothHostControllerUSBTransport',
'IOProviderClass': 'IOUSBHostDevice',
'LMPLoggingEnabled': True,
'idProduct': pid,
'idVendor': vid}
writePlist(bluetooth, bt_plist)
except (InvalidPlistException, NotBinaryPlistException) as e:
print("Error:", e)
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Airport</key>
<array>
<string>14e4,43a3</string>
</array>
<key>Bluetooth</key>
<array>
<string>0a5c,6412</string>
<string>0a5c,6413</string>
<string>0a5c,6414</string>
</array>
</dict>
</plist>
@@ -0,0 +1,98 @@
def _reset_sys_path():
# Clear generic sys.path[0]
import sys
import os
resources = os.environ['RESOURCEPATH']
while sys.path[0] == resources:
del sys.path[0]
_reset_sys_path()
def _chdir_resource():
import os
os.chdir(os.environ['RESOURCEPATH'])
_chdir_resource()
def _disable_linecache():
import linecache
def fake_getline(*args, **kwargs):
return ''
linecache.orig_getline = linecache.getline
linecache.getline = fake_getline
_disable_linecache()
import re
import sys
cookie_re = re.compile(b"coding[:=]\s*([-\w.]+)")
if sys.version_info[0] == 2:
default_encoding = 'ascii'
else:
default_encoding = 'utf-8'
def guess_encoding(fp):
for i in range(2):
ln = fp.readline()
m = cookie_re.search(ln)
if m is not None:
return m.group(1).decode('ascii')
return default_encoding
def _run():
global __file__
import os
import site # noqa: F401
sys.frozen = 'macosx_app'
base = os.environ['RESOURCEPATH']
argv0 = os.path.basename(os.environ['ARGVZERO'])
script = SCRIPT_MAP.get(argv0, DEFAULT_SCRIPT) # noqa: F821
path = os.path.join(base, script)
sys.argv[0] = __file__ = path
if sys.version_info[0] == 2:
with open(path, 'rU') as fp:
source = fp.read() + "\n"
else:
with open(path, 'rb') as fp:
encoding = guess_encoding(fp)
with open(path, 'r', encoding=encoding) as fp:
source = fp.read() + '\n'
BOM = b'\xef\xbb\xbf'.decode('utf-8')
if source.startswith(BOM):
source = source[1:]
exec(compile(source, path, 'exec'), globals(), globals())
def _setup_ctypes():
from ctypes.macholib import dyld
import os
frameworks = os.path.join(os.environ['RESOURCEPATH'], '..', 'Frameworks')
dyld.DEFAULT_FRAMEWORK_FALLBACK.insert(0, frameworks)
dyld.DEFAULT_LIBRARY_FALLBACK.insert(0, frameworks)
_setup_ctypes()
DEFAULT_SCRIPT='AddDW1820A.py'
SCRIPT_MAP={}
_run()
@@ -0,0 +1,19 @@
#!/bin/sh
#
# This is the default apptemplate error script
#
if ( test -n "$2" ) ; then
echo "$1 Error"
echo "An unexpected error has occurred during execution of the main script"
echo ""
echo "$2: $3"
echo ""
echo "See the Console for a detailed traceback."
else
echo "$1 Error"
# Usage: ERRORURL <anURL> <a button label>, this is used by the
# bundle runner to put up a dialog.
#echo "ERRORURL: http://www.python.org/ Visit the Python Website
# echo "ERRORURL: http://homepages.cwi.nl/~jack/macpython/index.html Visit the MacPython Website"
fi
File diff suppressed because it is too large Load Diff
@@ -0,0 +1 @@
../../site.pyc
-48
View File
@@ -6,38 +6,6 @@
<dict>
<key>Add</key>
<array>
<dict>
<key>BundlePath</key>
<string>FakePCIID.kext</string>
<key>Comment</key>
<string>FakePCIID</string>
<key>Enabled</key>
<true/>
<key>ExecutablePath</key>
<string>Contents/MacOS/FakePCIID</string>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>BundlePath</key>
<string>FakePCIID_Broadcom_WiFi.kext</string>
<key>Comment</key>
<string>FakePCIID Wifi</string>
<key>Enabled</key>
<true/>
<key>ExecutablePath</key>
<string></string>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>BundlePath</key>
<string>AirportBrcmFixup.kext</string>
@@ -86,22 +54,6 @@
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>BundlePath</key>
<string>BrcmBluetoothInjector.kext</string>
<key>Comment</key>
<string>Bluetooth</string>
<key>Enabled</key>
<true/>
<key>ExecutablePath</key>
<string></string>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
</array>
</dict>
<key>NVRAM</key>
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
cd "${0%/*}"
open ./Install/AddDW1820A.app
sudo rm -r /System/Library/Extensions/IO80211Family.kext
sudo rm -r /System/Library/Extensions/IOBluetoothFamily.kext
sudo cp -r IO80211Family.kext /System/Library/Extensions
sudo cp -r IOBluetoothFamily.kext /System/Library/Extensions
sudo rm /System/Library/PrelinkedKernels/prelinkedkernel
sudo rm /System/Library/Caches/com.apple.kext.caches/Startup/kernelcache
sudo chmod -R 755 /System/Library/Extensions
sudo chmod -R 755 /Library/Extensions
sudo chown -R root:wheel /System/Library/Extensions
sudo chown -R root:wheel /Library/Extensions
sudo touch /System/Library/Extensions
sudo touch /Library/Extensions
sudo kextcache -i /