Skip to content

Instantly share code, notes, and snippets.

@mon-compte-github
Created April 29, 2019 19:25
Show Gist options
  • Save mon-compte-github/bbdbc86427bb91aca70d3e0f23efbdb7 to your computer and use it in GitHub Desktop.
Save mon-compte-github/bbdbc86427bb91aca70d3e0f23efbdb7 to your computer and use it in GitHub Desktop.
Codeless KEXT pour la TomTom Runner 3

Codeless KEXT pour empêcher macos de "capturer" un appareil usb, ce qui empêche ensuite de réclamer (claim) l'interface pour dialoguer avec.

Pour pouvoir l'utiliser dans les version récentes de macos (10.09+), il faut que le driver soit signé par un compte "Mac Developer" officiel :'( mais à partir de macos 10.11, on peut désactiver le System Integrity Protection pour le tester.

Ici on veut interagir avec une montre TomTom Runner 3. Il faut d'abord chercher les "bonnes valeurs" pour matcher l'appareil :

$ lsusb -v
...
TomTom GPS Watch:
 Product ID: 0x7477    <-- besoin de ça
 Vendor ID: 0x1390     <-- et de ça
 Version: 1.00
 Serial Number: HR3366G02563
 Speed: Up to 480 Mb/sec
 Manufacturer: TomTom
 Location ID: 0xfa130000 / 5
 Current Available (mA): 500
 Current Required (mA): 100
 Extra Operating Current (mA): 0

On aura aussi besoin de bdcDevice (256), bConfigurationValue (1) et bInterfaceNumber (0) obtenus par programme ^^

Le driver doit être copié dans /System/Library/Extensions et appartenir à root:wheel. Ensuite, il faut le charger :

$ kextutil -v -t xxx.kext

Les drivers non signés afficheront les lignes :

Kext with invalid signatured (-67050) allowed: <OSKext 0x7fa489c1a190 [0x7fff8e6faa80]> { ...}
Code Signing Failure: code signature is invalid

mais se chargeront quand même ;-)

Successfully loaded /System/Library/Extensions/runner3-kext.kext.
/System/Library/Extensions/runner3-kext.kext successfully loaded (or already loaded).

liens utiles

<?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>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>KEXT</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>OSBundleLibraries</key>
<dict>
<key>com.apple.kpi.iokit</key>
<string>17.7.0</string>
</dict>
<key>IOKitDebug</key>
<integer>65536</integer>
<key>IOKitPersonalities</key>
<dict>
<key>TomTomRunner3Device</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.kpi.iokit</string>
<key>IOClass</key>
<string>IOService</string>
<key>IOProviderClass</key>
<string>IOUSBInterface</string>
<key>idVendor</key>
<integer>0x1390</integer>
<key>idProduct</key>
<integer>0x7477</integer>
<key>bcdDevice</key>
<integer>256</integer>
<key>bConfigurationValue</key>
<integer>1</integer>
<key>bInterfaceNumber</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment