@skizzles I am using buster in Retropie. I just bought an Xbox series S/X controller and to my surprise, there is no video explaining how to connect this with Retropie. All videos mention either 360 or Xbox one controllers which although similar have differences in connection. I followed the steps above and was able to connect this to pie but the connection was not persistent. Even xpadneo drivers didn't make the connection persist. And I made the following tweaks after experimenting and watching other videos. I have to share them in a noob-proof manner here so that I don't forget the steps. I request mods not delete this post as it was a headache to make it work.
Steps (Slightly modified to make them persistent): make sure to connect a keyboard as well for settings.
Update firmware on the Xbox series s controller through windows computer.
Now get inside Retropie Setup>Manage packages>Drivers>Removed Xpad drivers (although it might not be necessary). Also, install Xpadneo drivers if not already installed. then Reboot
I pressed F4 in Retropie and opened the command prompt terminal.
Now open "main.conf" file as mentioned in the above post located inside "/etc/bluetooth/main.conf" and search for Privacy = off. Change that to:
Privacy = device
make sure to remove "#" before Privacy=device to enable the command if it is there. Press Ctrl+X then "Y" and ENTER key to save the file.
5. On the command prompt type "sudo nano /opt/retropie/configs/all/autostart.sh"
6. Enter (these 2 lines must be entered above "emulationstation #auto" to make them persistent. When 'ertm' is disabled the Bluetooth needs to be refreshed to connect the Xbox series s controller on reboot. So, both lines are necessary.
sudo bash -c 'echo 1 > /sys/module/bluetooth/parameters/disable_ertm'
sudo systemctl restart bluetooth
emulationstation #auto
Press Ctrl+X then "Y" and ENTER key to save the file.
Type "sudo reboot" on the command prompt to restart. Again press F4 in the emulation station to enter the terminal.
7. Make sure that you xbox controller bluetooth is in connection mode. Press the button in front of the controller so that the xbox light will blink fast for pairing. Now Enter in terminal:
sudo bash -c 'echo 1 > /sys/module/bluetooth/parameters/disable_ertm'
sudo systemctl restart bluetooth
sudo bluetoothctl scan on (Note the mac address of your controller that is listed after this command. It's unique for every controller. For eg mine was "44:16:22:DB:C9:8E". Type this command again if your device is not shown initially)
sudo bluetoothctl pair 44:16:22:DB:C9:8E (Use your own mac address discovered above)
sudo bluetoothctl connect 44:16:22:DB:C9:8E
sudo bluetoothctl trust 44:16:22:DB:C9:8E
If all these steps are successful then you can also type " bluetoothctl paired-devices" command to see whether your controller is paired successfully or not. Your device mac address must be shown after this command is entered.
then sudo reboot and restart your pi.
Press the Xbox icon(Light must blink) so that Pi4 sees it as it is starting up. At this point, you might also need to re-enter your controller keys according to your needs. And it should all work from here.
Note: Bluetooth GUI under settings didn't work for connecting to the Xbox Series s/X controller for me. I don't know why? Only connecting through the terminal worked. Deviating from the above steps didn't work for me. And so I had to write the step wise guide on what is currently working.