Git Product home page Git Product logo

os-x-bluetooth-pairing-value-to-windows-value's Introduction

OS-X-Bluetooth-Pairing-Value-To-Windows-Value

A useful script to simultaneously pair a bluetooth device to your Mac in OS X and Boot Camp Windows

OS X Bluetooth Pairing Value To Windows Value

A script to get the Windows equivalent bluetooth adress/link key pair (little endian?)

This is useful if you would like to pair a bluetooth device to both OS X and Windows (in BootCamp).

Thanks to user pacnow (Camoguy) at discussions.apple.com for doing the leg work and figuring out the algorithm

Follow these steps to get your bluetooth device working.

  • pair device with windows
  • reboot and pair with OS X
  • run this script/app
  • save the link key/s somewhere you can reach from windows
  • boot to windows
  • run regedit with admin rights
  • go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\Parameters\Keys\BD_ADDR
  • edit the key of the device
  • reboot

What this script does

  • read the link keys
up to Sierra:
sudo defaults read /private/var/root/Library/Preferences/blued.plist LinkKeys
High Sierra and onwards:
sudo defaults read /private/var/root/Library/Preferences/com.apple.bluetoothd.plist LinkKeys
  • parse the data with awk
  • display it in a window
  • export a bluetooth.reg file with all paired link keys, if desired

Here's an example link key. Instead of just typing that in you want to break it apart starting from the right, taking a pair of two characters at a time.

98 54 2f f9 88 e1 94 49 47 52 50 e1 39 43 25 5b (What is shown in OS X)

5B 25 43 39 E1 50 52 47 49 94 E1 88 F9 2F 54 98 (What you enter in Windows)

-Help from Camoguy-

Note, this script requires administrator privileges.

Your password is not saved anywhere and only known to you and your OS.

  • Adnaan Soorma

  • Twitter: @Soorma07

  • broeckelmaier

  • Twitter: @broeckelmaier

Possible Issues:

Windows /keys in registry is empty #8

shivangswain commented on Aug 23, 2020

You can fix that by setting the permissions of the /Keys folder/key. So,

  • right click on it
  • click "Permissions..."
  • click on "Add"
  • input your Windows username in the large text box
  • click on "Check Names"
  • once the text box changes into the / form press OK
  • select the "Full Control" checkbox
  • press OK
  • Now you'll be able to add and see the keys. Remember to reboot before testing.

Where is the reg file saved to? #7

It should save directly to the same folder where the script is run from.

os-x-bluetooth-pairing-value-to-windows-value's People

Contributors

marcupilami avatar soorma07 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

os-x-bluetooth-pairing-value-to-windows-value's Issues

update readme or other usage guidance to reflect detailed instructions available elsewhere on Internet

This reddit discussion contains detailed instructions for using the scripts in this repo. The details are somewhat more in depth than those provided in the README in this repo, for example describing the process of downloading and using psexec (to run regedit with admin privileges) on the Windows side.

Having those instructions integrated here would make this repo more useful, especially to new users and those unfamiliar with Windows, and provide a single authoritative reference.

Catalina Support

I can't seem to get this to work in Catalina. I get the message below.

Screen Shot 2019-10-27 at 6 40 53 PM

Multiple bluetooth device support

Hi, I notice that this code does not support multiple bluetooth devices yet. I have replaced my wifi adapter in the past for hackintosh purpose. So macOS remembers all the bluetooth device I have. To get the device I am using and also prevent this script from error, I have to select paragraphs of the linkKeys in the original script:
"set linkKeys to paragraphs 2 thru -1 of linkKeys"

I think it would helpful if you can add multi bt device support in the future. Thanks.

Where is the reg file saved to?

I successfully ran the script, but where is the reg file I requested to export? It's not documented anywhere and the script does not tell you after completing.

Monterey 12.3.1 Error - Read Only File System

running app/script produced the following error -

Error: /bin/sh: /private/var/folders/75/3wbt116951dbb23vltd8cz180000gn/T/AppTranslocation/031339C1-17F1-424A-B5CD-04361653976F/d/output.txt: Read-only file system

please advise on how to resolve

Doesn't work on BigSur.

Hi.

Your script won't work on BigSur.
There are no "LinkKeys" in the plist.

Example plist:
{ MagicCloudPairingMasterHint = {length = 16, bytes = 0x4403d3b5169e5473c765485effb30529}; MagicCloudPairingMasterKey = {length = 16, bytes = 0x462d449501ea434587270f34e0070d5f}; SMPCloudLocalNonce = {length = 16, bytes = 0x220db209e97706dff1bf0d2ac397d4ba}; SMPCloudLocalPrivateKey = {length = 96, bytes = 0x6ce14d11 584a296b 9c2f3c56 635d06f9 ... 3225558f 98d3f754 }; SMPCloudLocalPublicKey = {length = 64, bytes = 0x6ce14d11 584a296b 9c2f3c56 635d06f9 ... 7e9e47fb c372f752 }; SMPDistributionKeys = { "48-d7-05-b3-b3-c6" = { "f7-fb-12-d0-e6-5e" = { Address = {length = 6, bytes = 0xf7fb12d0e65e}; AddressType = 1; EDIV = {length = 2, bytes = 0x293d}; IRK = {length = 16, bytes = 0xcb00f4dc3fdefea2ad3910f2af21f3ad}; LTK = {length = 16, bytes = 0x6a9202ccaa1f7221aab756de2eb797a2}; LTKLength = {length = 1, bytes = 0x10}; MITMProtection = 0; OriginalAddressType = 1; RAND = {length = 8, bytes = 0x91c77c4ed0cb027f}; }; }; }; }

There's also another plist on /Library/Preferences/

{ BluetoothStats = { ClassicConnectionTimeout = 0; CommandTimeouts = 0; CoreDump = 0; HardReset = 0; HardwareError = 0; LongRangeDisconnects = 0; LowEnergy3ETimeout = 4; LowEnergyConnectionTimeout = 1; MediumRangeDisconnects = 0; NearRangeDisconnects = 0; SlowEnqueueData = 0; SlowEnqueueDataTimeMicroseconds = 0; USBPipeStall = 0; kLowEnergyMICError = 0; }; ControllerPowerState = 1; CoreBluetoothCache = { "26136684-FEE7-4C2E-AAD2-E5CD800320D6" = { DeviceAddress = "f7-fb-12-d0-e6-5e"; DeviceAddressType = 1; ServiceChangedHandle = 65535; ServiceChangedSubscribed = 0; ServiceDiscoveryComplete = 1; Services = {length = 3925, bytes = 0x62706c69 73743030 d4000100 02000300 ... 00000000 00000b95 }; }; }; DeviceCache = { "8c-79-f5-aa-ab-9d" = { ClassOfDevice = 525372; EIRData = {length = 240, bytes = 0x09100100 e8048080 00000d09 5b54565d ... 00000000 00000000 }; LastNameUpdate = "2021-01-02 14:06:44 +0000"; Name = "[TV] TV Sala"; ProductID = 32896; VendorID = 1256; VendorIDSource = 1; }; "f7-fb-12-d0-e6-5e" = { HeySiriEnabled = 0; LMPSubversion = 99; LMPVersion = 7; LastNameUpdate = "2021-01-03 11:23:04 +0000"; LowEnergyPointer = 1; Manufacturer = 89; Name = BluetoothMouse3600; ProductID = 2326; VendorID = 1118; }; }; InsecureDevices = ( ); LEPairedDevices = ( "f7-fb-12-d0-e6-5e" ); PairedDevices = ( "f7-fb-12-d0-e6-5e" ); SystemLowEnergyDevices = ( "26136684-FEE7-4C2E-AAD2-E5CD800320D6" ); }
com.apple.bluetoothd.zip
com.apple.Bluetooth.zip

Could not select item 2 from ....

Thanks for this script! It’s exactly what I needed, but I did encounter a small issue:

In the past this OS install was restored from a time machine backup from another machine, which caused my bluetooth plist to contain multiple bluetooth adapters which completely broke the script.

The solution to this for me was to just delete the plist and reboot, then re-pair all of my devices. After this, only one bluetooth adapter was shown and the script worked fine. Hope this workaround helps someone!

Can't get item 2 macOS Mojave

The "Can't get item 2" bug from issue #1 has made a return in macOS Mojave. The symptoms are the exact same as in the previous issue. They persist even after changing the permissions of the relevant folders, which are by default set to only allow the system account access.

Does not work for macOS Ventura

Issue #10 suggests using the file /Library/Preferences/com.apple.Bluetooth.plist. While this file exists it does not contain the expected content when converted to xml using plutil (some values partially redacted):

<plist version="1.0">
<dict>
	<key>BluetoothAutoSeekKeyboard</key>
	<true/>
	<key>BluetoothAutoSeekPointingDevice</key>
	<true/>
	<key>HID15msWithHeadsetEnabled</key>
	<false/>
	<key>PersistentPorts</key>
	<dict>
		<key>AC:BF:71:**:**:**</key>
		<dict>
			<key>BSDName</key>
			<string>BoseQC45</string>
			<key>BTAddress</key>
			<data>
			rL9x****
			</data>
			<key>RFCOMMChannel</key>
			<integer>8</integer>
		</dict>
	</dict>
	<key>SpatialSoundProfileAllowed</key>
	<true/>
</dict>
</plist>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.