The DualSense from Sony is a $70 piece of plastic manufactured in China that never ceases to amaze me. Less than a month after the controller’s release in the US, Valve added enhanced functionality to the controller in the Steam beta client. In addition to having basic input functionality baked in, it was now possible to configure LED colors, use the trackpad, the basic vibration, and even gyroscope. As of a few weeks ago, those features are baked in to the stable branch of Steam.
Shortly thereafter, SDL 2.0.14 included support for the DualSense, allowing functionality of the DS to expand further in scope than just Steam games. We’re hit with yet another surprise when Sony released their official driver for the DS less than two weeks ago, again increasing compatibly with most, if not all games across the board, besides SDL-based games and games on Steam. This driver will also allow the trackpad to be used as a mouse, just like the trackpad’s functionality on the DS4, and the battery percentage is now displayed on the taskbar. Unfortunately adaptive triggers and haptic feedback aren’t quite here yet.
I’m sure this is probably old news for most of you. However, what I’d like to bring to your attention is the DS driver for Linux allows us to modify the LED values that are by the trackpad, including color, brightness, etc. What may also be of interest is the fact that there’s actually five individual LEDs that can be toggled on the bottom of the trackpad, not just the side LEDs.
After discovering this, I wanted to make an application that would make modifying the LEDs a bit easier. As a result, I put some Python coding skills to use and created a program: the DualSense LED Configurator.
With this program, you can change the LED colors on the side of the trackpad, choose a brightness, and even apply a glowing effect where the LEDs slowly glow a random color, die down, then turn to a different color. The LEDs on the bottom of the trackpad can also be toggled on or off, and you can apply different patterns to it, such as a progress-bar-like display, or a disco effect where the LEDs turn on or off randomly.
What are the requirements to run this? Well, besides your DS, you’ll need to have Sony’s driver installed. It’s available in the AUR. If you’re not using an Arch-based system, you’ll need to download Sony’s patches, apply them to the kernel, then compile said kernel. As this is something I’ve never done before, you’re on your own for that.
Once you have the driver installed, clone my repository:
You may need to install a couple of Python dependencies, since this is a GUI-based application that relies on both GTK and Tkinter (I know, it’s weird and unnecessary that I’m using both instead of one or the other, but I had to temporarily resort to Tkinter for some of the functions since I couldn’t figure how to do the same thing with GTK). This is obviously in addition to having Python 3 installed on your system. Likely, you’ll already have all three components installed, since many other Python applications use these libraries.
Connect your DS to your Linux PC, either in wired mode or via Bluetooth. Find the MAC address (or technically, the hardware address) for your device; you can easily find this in your Bluetooth device settings or by going to /sys/class/leds/playstation::[mac_address]. Now, open ds_led.py, and replace the MAC address inside the quotes in line 15 (or similar) with the MAC of your DS. Save the file, then run the script as root:
sudo python ds_led.py
The reason why the script needs to be run as root, is because it modifies the values found in /sys/class/leds/playstation…, which require administrative rights to change.
Should be good to go now. Change the LEDs to your liking, and if you dare, run the rainbow, progress bar, or disco patterns. These functions are currently unstable and will cause the program to loop indefinitely, so you’ll need to hit Enter in the terminal window to close the application.
As for DS4 owners, I tried to see if I could add functionality for that device as well, but sadly the folder that the program would need access to changes every time the device is connected, and I currently have no idea how I can work that into the script. In the meantime, there’s always OpenRGB to configure DS4 LEDs.
If Steam is running, modifying the LED colors in this program will override what Steam has. Additionally, vibration may not work if you use the “Rainbow” LED effect.
There’s a few other things I’d like to do to enhance this program. First, I definitely need to find a way to get rainbow, disco, etc. working without going into an endless loop. Second, I’d like to find a way to get the DS’s MAC address without the user needing to put it in themselves, though based on my research, there doesn’t seem to be any easy way of doing that. Third, the GUI is static, meaning if the battery gets to a lower percentage, or you connect a USB cable to charge the device, the GUI won’t reflect this until you run the program again. There’s got to be a way to fix this.
If you have a DualSense and happen to have the driver installed, I invite you to test this application and let me know your thoughts on it. And if you happen to have experience with Python, I could definitely use some of your expertise on how to further enhance the program, since my knowledge of Python is pretty sparse.