atar-axis / xpadneo

Advanced Linux Driver for Xbox One Wireless Controller (shipped with Xbox One S)
https://atar-axis.github.io/xpadneo/
GNU General Public License v3.0
2.02k stars 114 forks source link

How To Update Controller Firmware through Xbox Accessories and VirtualBox #472

Open BobbyBlock opened 6 months ago

BobbyBlock commented 6 months ago

So a bit of context I just spent two days troubleshooting an issue that turned out to be just me neglecting to download the linux-headers because it's not auto installed as a dependency by either xpadneo (which makes sense) or DKMS, during this process I assumed I had a firmware issue so tried updating the controller firmware through VirtualBox and managed to soft-brick my controller, making it not show up on my computer nor phone's Bluetooth while in pairing mode. However through this process I learned a fool-proof way to update the firmware through VirtualBox and thought I would share since I see it's an issue a lot of people have had.

Controller Model

But I see no reason why it wouldn't work the same with other controller

Steps to Update Controller Firmware through Xbox Accessories and VirtualBox

  1. Download VirtualBox
  2. Download Windows 10 ISO (You can get it here from Microsoft as long as you are not accessing the website from a Windows device, if you have a Windows device then just download Xbox Accessories on that and skip VirtualBox and this guide altogether)
  3. Load the Windows ISO on the virtual machine
  4. Set up Windows, install all Windows Updates and all updates available in the Microsoft Store to ensure maximum compatibility, also install Xbox Accessories from the Microsoft Store and then shutdown the VM

So far all pretty standard

  1. If you have xpad installed (was installed by default for me) you are going to want to disable that by placing a file in etc/modprobe.d/, this file can be named whatever as long as it ends in .conf

  2. Inside this file write blacklist xpad. These 2 steps will stop the xpad drivers being loaded. Otherwise the xpad driver will make the controller look like a 360 controller to your PC, which affects the USB passthrough into Windows and will prevent it from showing up properly in Xbox Accessories

  3. Restart your PC

  4. Go into your VirtualBox VM's Settings and go to "USB" on the sidebar Screenshot_20240506_205242

  5. Then, while ensuring your controller is plugged in, go to "Add new USB filter with all fields set to the values of the selected USB device connected to the host PC" (The little picture of the USB with the plus next to it). Select your controller from the list of devices that pop up

  6. Then edit that new filter by double clicking on it in the "USB Device Filters List" and remove all fields except Port, this will ensure that the controller stays connected throughout the firmware update and not soft-brick it like I did, and Name which you can set to whatever you want. Ensure that you keep to controller connected to the same USB Port throughout as what you have just done will mean anything connected to that port will autoconnect to the VM while it's running.

  7. Launch the VM and open Xbox Accessories, at this point the controller should appear correctly and you will be able to update the firmware successfully

  8. At this point if you are planning on using xpad again in future (useful for if you want to play over wire instead of Bluetooth) you will want to reverse the actions taken in steps 6 & 7 by deleting that file you created.

Hope this helps some people

kakra commented 6 months ago

So a bit of context I just spent two days troubleshooting an issue that turned out to be just me neglecting to download the linux-headers because it's not auto installed as a dependency by either xpadneo (which makes sense) or DKMS

Distributions don't install kernel headers as part of DKMS, e.g. Arch documents this as a manual step, and other distributions depend on correct headers if you install xpadneo-dkms through the package manager.

If you install xpadneo from source, you're supposed to also provide the proper kernel headers. This project has no business in installing random packages, especially since this is different per distribution. We provide hints in the docs for that, and I'm pretty sure kernel headers are generally mentioned. ;-)

OTOH, "which makes sense" could just mean "it makes sense for xpadneo to not install the headers". But something similar is true for DKMS itself. I think Arch Linux documents, why...

during this process I assumed I had a firmware issue so tried updating the controller firmware through VirtualBox and managed to soft-brick my controller, making it not show up on my computer nor phone's Bluetooth while in pairing mode. However through this process I learned a fool-proof way to update the firmware through VirtualBox and thought I would share since I see it's an issue a lot of people have had.

Yes, the controller boots into a firmware upgrade mode which can make it appear soft-bricked. I'm pretty sure this can be reset by removing the batteries. But good you found a way of resolving and documented the whole process.

I'll keep this open so we can include it in the documentation later.

Thanks.