How to resolve the input lag when using XBOX Series X|S with bluetooth on Linux

I connected my XBOX Series X|S to my Linux machine by following this answer. Now it has a noticeable lag which makes it hard to use in games. What can I do against it?


UPDATE 28/09/2021: I updated the firmware of the controller. I also updated the Kernel (5.14 from Ubuntu Mainline) and xpadneo (rev. 67585b). I did not apply what is written below. After repairing the controller worked flawlessly, without any noticeable lags.

First one needs to locate the configuration file. If the Bluetooth dongle/chipset has address DONGLE_ADDR and the gamepad has address XBOX_ADDR then the configuration file is /var/lib/$DONGLE_ADDR/$XBOX_ADDR/info. On my PC it looks like this: /var/lib/bluetooth/5C:F3:70:A3:31:C7/44:16:22:6D:6B:E5/info. This file will contain some gamepad specific stuff (at least the name), so if one is unsure one can guess a bit.

The Bluetooth address of the Gamepad will be shown using the Bluetooth GUI of your distribution.

In that configuration file the following section needs to be added:

[ConnectionParameters]
MinInterval=6
MaxInterval=9
Latency=44
Timeout=216

After a reboot the gamepad should work without lag. Edit: Using systemctl restart bluetooth was sufficient too.

This answer goes back to this answer in the Arch forum. I thus suspect that it applies to other devices too.