Steam Deck

Steam Deck

Zombi Dec 1, 2024 @ 10:47pm
GUIDE: Shared Bluetooth pairings with Dual Boot and Multi Boot (SteamOS, Batocera, & Windows)
No option to post a guide for the Steam Deck, so I guess this is going here....

------------------------------------------------------------------------------------------

Dual- or multi-booting your Steam Deck(1) and want your Bluetooth peripherals to work across OSes without constantly re-pairing? Here’s the guide for you.

There’s several resources on how to do this, but I found most to be incomplete or inadequate for the uninitiated, which is why I’m doing this guide.(2) I’m multi-booting SteamOS, Windows, and Batocera and this guide will reflect that, but I will quickly cover how to do this if you’re only, say, dual-booting SteamOS and Windows.

The devices that I have personally paired are the Logitech K380, Microsoft Arc Mouse, Fosmon Bluetooth Keyboard/Mouse, 8bitdo M30, and Xbox Series Controller. This guide will, naturally, work for more devices than that, but these are at least devices that I’ve confirmed to work.

**Now, as you’ll be getting into registries and potentially using root access in Linux, this will be a USE AT YOUR OWN RISK guide. As long as you don’t deviate from the guide, you should be fine, but I take no responsibility for any mistakes you (or I) may have made.**

First off, make sure every device has been paired once on each OS. I, personally, found it most useful to have Windows be the last device to which you’re pairing, mainly for BLE devices because of the fact that there may be a different byte in the device’s MAC address that is easier to change with Linux.(3)

Next, you’ll need PsExec from Microsoft to get into the registry entries that you’ll need for copying or editing those Bluetooth adapter’s entries:

https://learn.microsoft.com/en-us/sysinternals/downloads/psexec

It’ll be located in the PsTools zip that you’ll download. I just put it into “C:\Temp”, so you’ll need to adjust that if you’ve put it somewhere else. I can’t guarantee that it’ll work in all locations, like in user or protected folders, for example.

Click on start and type CMD. Right click on Command Prompt and Run as Administrator.

Type or copy/paste:

cd c:\temp
psexec -s -i regedit.exe


From the registry, you’ll be navigating to:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BTHPORT\
Parameters\Keys\[Bluetooth adapter MAC address]

There should likely only be one Bluetooth MAC address.(4) Each device’s MAC address will be listed within. The entries in the info panel will be the non-BLE devices. The entries below, in the folder, will be the BLE devices. Right click on the adapter’s folder, select Export, and save the entries in the Temp folder (or perhaps an external USB drive) for reference. Perhaps you can also make a screen shot of the non-BLE info page and each BLE device, but it’s not totally necessary. I would at least jot down or copy any “ERand” and “EDIV” numbers (decimal, not Hex) you see so you don’t have to do any hex inverting and/or converting later.

These are the entries you’re likely to find to copy over in the file/registry:

Standard Bluetooth Device (non-BLE):

[LinkKey]

BLE Devices:

LTK or LongTermKey

And potentially some BLE devices but not all:

CSRK or LocalSignatureKey
IRK or IdentityResolvingKey
ERand or Rand
EDIV or EDiv
PeripheralLongTermKey (same key as LTK, I think)
SlaveLongTermKey (same key as LTK, I think)


Now that we have that, let’s launch into Batocera. If you’re just dual-booting Windows and Linux/SteamOS, you can go into Linux/Desktop Mode. We’ll circle back to that in a moment.

Go into the Bluetooth settings and disable/turn off the Bluetooth adapter. You may need to plug in a KB/M to navigate, depending on what you do next. I found it easier to just SFTP into Batocera (I use WinSCP) with another computer and edit the necessary files that way.(5) Or, while I’m not sure if it’ll work, you can edit the files in Batocera’s file manager (F1 key), too. I went into the file manager while doing this, too, if only so the music wasn’t running in the background.

Now, you can FTP over or open the files you saved in the Windows “C:\Temp” folder from before for reference – or open them from the flash drive that you may have used.

If you aren’t using Batocera, you can navigate to the location in the file manager in Desktop mode, right click on the [.../bluetooth] folder, and “open as root” – editing the files in Kate or some other text editor. Just make sure your disabling the Bluetooth adapter beforehand. I don’t believe you can add or modify files in the necessary Batocera location while running SteamOS which is why I’m editing the files while in Batocera.(6)

You’ll be navigating to:

<root>/var/lib/bluetooth/[Bluetooth adapter MAC address]

You’ll want to do this for both the SteamOS and Batocera locations. The SteamOS location is in the [<root>/media] folder. If it’s not showing up, restart Batocera until it does.

In these folders, you’ll see folders labeled with each device’s MAC address. Inside, you’ll be editing the “info” files.

Open the saved registry file from Windows from before with a text editor (or LibreOffice for easier editing) so we can copy those values over to the Linux installations.

For non-BLE devices, all you need to copy over is the [LinkKey] under the MasterIRK section. You’ll see the “[Device MAC address]=hex:” followed buy the [LinkKey] you’ll be copying over. You’ll want to remove the commas and, while I don’t know for sure if it’s necessary, I changed all of the entries to uppercase in Libreoffice using Format>Text>UPPERCASE.

For BLE devices, first things first – make sure that the device MAC addresses match from the Windows MAC address to the other two OSes addresses. By that, I mean (it would seem) that sometimes the MAC address will have one different byte 5 places from the end (00:00:00:0X:00:00). This is why I paired the devices to Windows last. Just edit the folder name in Linux/WinSCP to match the Windows MAC address (I also did the same in the adapter’s cache folder just in case, but I don’t know if that’s necessary).

Then, copy over values from any of the present entries listed in the “BLE Devices” section above to both of the Linux “info” files – again, taking care to remove commas and to give uppercase formatting (“key=[COPIEDKEY]”) For example, my BLE mouse had LTK, CSRK, EDIV, and Rand numbers to copy over while my Xbox controller had the IRK and copies of the LTK in both the [PeripheralLongTermKey] and [SlaveLongTermKey] sections.

If you didn’t jot down the [ERand/Rand] or [EDIV] numbers, the [EDIV] would need to be converted to decimal. Then for the [ERand] hex, you’ll need to reverse the Hex (so 00:11:22:33 would be 33:22:11:00) then convert it into a decimal. That jotted down number and the reversed then converted hex would be a match.

And make sure that [EncSize/Keylength] numbers match. Pretty sure they shouldn’t need editing, though.

Make sure to save (and make sure it actually saved if you’re using SFTP) then restart the Deck.

That should be it! Just re-enable the Bluetooth adapter and hopefully now you’ll be seeing that everything connects nicely on all OSes! Way to go! The hours spent researching, troubleshooting, and writing this guide will save me many, many minutes. Minutes I tell you!

Hope this helps and makes this process more convenient for you!(7)

I’ve only been using this for the last few days, but so-far-so-good! I don’t know yet if every step listed is a necessary one, but over time I’ll try to update this guide to reflect any newly gleaned information.


Notes:

1) This should, I believe, work across most Windows and Linux installs, not just the Steam Deck. I think some of the referenced resources note how to access the necessary files/entries on Mac as well.

2) ...and for myself when I need to do this again months down the line having totally forgotten how to do it.

3) Not sure how, or if, it can be changed in Windows. Changing the name in the registry alone just made that pairing not show up anymore. Something else likely needs editing, but I don’t know what.

4) But if there is more than one, try to make sure you’re using the right one. Only if you’ve had more than one Bluetooth receiver attached/installed should there be more than one entry. You can verify with the paired device’s individual MAC addresses; you can see the MAC addresses/names easily in the Bluetooth settings in the Linux desktop.

5) I do have Batocera installed on my local SSD, so while I’m assuming this method will work if you’re on an SD card, I’m not entirely sure.

6) If you do know how to do more than just read-only access to the Batocera Share partition within SteamOS, I’d love to find out. Still a relative novice in all things Linux, so I’m pretty ignorant of how to set permissions without potentially borking everything.

7) Keep in mind this doesn’t negate Bluetooth jank like randomly dropping connections and all that crap. Bluetooth is a weird standard, that’s for sure. It’s also, admittedly, not that impressive a connection on the LCD model, at least. Pretty laggy (and inconsistently so) compared to dedicated, single-device adapters like from 8bitdo and Mayflash.

Refrences:

https://superuser.com/questions/422435/how-to-use-bluetooth-devices-under-two-different-operation-systems

https://www.sergeykozharinov.com/notes/2023/11/13/bluetooth-pairing-on-linux-windows-dualboot/
Last edited by Zombi; Dec 2, 2024 @ 2:45pm
Date Posted: Dec 1, 2024 @ 10:47pm
Posts: 0