CTCaer / hekate

hekate - A GUI based Nintendo Switch Bootloader
GNU General Public License v2.0
6.73k stars 574 forks source link

[feature request] dump Bluetooth pairing keys for audio devices from HOS to import them to andorid/Linux #865

Open zekromisblack opened 1 year ago

zekromisblack commented 1 year ago

This would be a incredible feature for people like me who has earbuds and don't wanna have to repair them every time I switch my OS

impeeza commented 1 year ago

the bluetooth database do not include them?

OrGoN3 commented 1 year ago

You can dump the hos title, https://gbatemp.net/threads/pairing-the-joy-con-on-emunand-and-sysnand.562519/, not sure if that's enough.

impeeza commented 1 year ago

Wait one moment.

Since version 1.5.1, Atmosphère have a new setting enable_external_bluetooth_db = u8!0x1 on SD:/atmosphere/system_settings.ini file:

Once you enable that setting the first instance of atmosphère you run will copy the actual Bluetooth sync database to the file SD:/atmosphere/bluetooth_devices.db then on all instances of Atmosphère you run and if you set the value en on System_Setting.ini file will use the database on the dump file instead of the one on EmuMMC or SysMMC so, all your instances will share the same bluetooth database, including headsets and controllers.

And if you use MissionControl you can even spoof any mac from controllers synced with other consoles or PCs and you don't need to lose your sync with external devices.

More information on:

https://github.com/Atmosphere-NX/Atmosphere/releases/tag/1.5.1

zekromisblack commented 1 year ago

Wait one moment.

Since version 1.5.1, Atmosphère have a new setting enable_external_bluetooth_db = u8!0x1 on SD:/atmosphere/system_settings.ini file:

Once you enable that setting the first instance of atmosphère you run will copy the actual Bluetooth sync database to the file SD:/atmosphere/bluetooth_devices.db then on all instances of Atmosphère you run and if you set the value en on System_Setting.ini file will use the database on the dump file instead of the one on EmuMMC or SysMMC so, all your instances will share the same bluetooth database, including headsets and controllers.

And if you use MissionControl you can even spoof any mac from controllers synced with other consoles or PCs and you don't need to lose your sync with external devices.

More information on:

https://github.com/Atmosphere-NX/Atmosphere/releases/tag/1.5.1

that does not allow me to get the pairing keys from that database file, and i have no idea how its formatted in a hex editor

impeeza commented 1 year ago

its a dump of the HOS database, so you can look on Switchbrew page about that information.

TechniXC commented 1 month ago

@zekromisblack Hey! I think I found the sollution! It works for me to transfer non OEM joy-cons LTK to L4T, but you could do the same for all your BT devices.

You could open bluetooth_devices.db with https://hexed.it/ and on the first BT device mac start at 0x00000008. Then LTK is the sequence of 16 bytes between 25:08 and 01 bytes. Aprox address of it's first byte is 0x00000031. Important thing that LTK bytes here in REVERSE order. That's mean if you have 78A62351XXXXXXXXXXXXXXD37C24 sequence in bluetooth_devices.db you should copy LTK as 247CD3XXXXXXXXXXXXXX5123A678.