This project provides a simple, systemd-integrated solution to use your Sony DualShock 4 (PS4) controller on Linux as a standard Xbox 360 controller. This is particularly useful for games and applications that natively support Xbox controllers but may not fully support DualShock 4 controllers out-of-the-box.
- Automatic Detection: Uses a
udev
rule to automatically detect your DualShock 4 controller when connected[cite: 1]. - Systemd Integration: Runs
xboxdrv
as a systemd service, ensuring it starts reliably in the background[cite: 2]. - Xbox 360 Emulation: Maps DualShock 4 inputs to mimic an Xbox 360 controller using
xboxdrv
[cite: 3]. - Automatic Device Grabbing with
evsieve
: Utilizesevsieve
to grab exclusive control of the controller input, preventing conflicts with other applications (like Steam's own input handling) and then passes events toxboxdrv
[cite: 3]. - Easy Installation & Uninstallation:
install.sh
automates setup, including dependency checks and configuration, anduninstall.sh
reverts changes.
- A Linux Distribution: Tested on Arch-based (CachyOS) and Fedora/Nobara, but designed to be compatible with most systemd-based Linux distributions.
xboxdrv
: This is the core utility. Theinstall.sh
script will prompt you to install it if it's missing and attempt to do so using your distribution's package manager or recommend COPR for Fedora users.evsieve
: This utility is crucial for grabbing the device input. Theinstall.sh
script will also prompt you to install it if missing.systemd
: Your system must usesystemd
as its init system (most modern distributions do).udev
: For device detection and rule triggering.
Follow these steps to install the controller mapping solution on your system:
-
Download the project files: If you're getting this from a GitHub repository, clone it using Git:
git clone [https://github.com/YourUsername/ps4-to-xboxdrv.git](https://github.com/YourUsername/ps4-to-xboxdrv.git) # Replace with your actual repository URL cd ps4-to-xboxdrv
Alternatively, if you received the files in a ZIP archive, simply extract them to a desired location (e.g.,
/run/media/niku/9A2EDA072ED9DBF7/Desc linux/V4/
) and navigate into the extracted directory in your terminal. -
Make installer executable:
chmod +x install.sh
-
Run the installer script: In the project directory, execute the
install.sh
script withsudo
:sudo ./install.sh
-
Follow the on-screen prompts:
- The script will first greet you and ask for your
sudo
password[cite: 56]. - It will check if
evsieve
andxboxdrv
are installed and offer to install them for you if they are missing (using your distribution's package manager likeapt
,dnf
,pacman
, orzypper
)[cite: 56]. For Fedora/Nobara users, it will specifically recommend and offer to enable the COPR repository forxboxdrv
for a more up-to-date installation[cite: 56]. - It will then copy the necessary scripts, service files, and udev rules to their proper system locations[cite: 56].
- It automatically configures the systemd service to run under your current username[cite: 56].
- The script will first greet you and ask for your
-
Important Post-Installation Steps:
- User Group Membership: Ensure that the user under which you want
xboxdrv
to run (your username) is part of theinput
group. This is crucial forxboxdrv
andevsieve
to have the necessary permissions to read from and grab input devices.- You can check your groups with:
groups your_username
(replaceyour_username
with your actual username)[cite: 92]. - If
input
is not listed, add yourself to the group:sudo usermod -aG input your_username
[cite: 92] - After adding, you MUST log out and log back in (or reboot) for group changes to take effect! [cite: 93]
- You can check your groups with:
- Activate Service: Disconnect your DualShock 4 controller if it's plugged in, then reconnect it. The
udev
rule should detect it and automatically start theds4-xboxdrv.service
[cite: 94].
- User Group Membership: Ensure that the user under which you want
After successful installation and reconnecting your controller:
-
Check Service Status: Confirm the
ds4-xboxdrv.service
is active and running:systemctl status ds4-xboxdrv.service
It should show
Active: active (running)
. -
Monitor Service Logs: To see real-time output and check for any errors from the
xboxdrv
andevsieve
processes:journalctl -fu ds4-xboxdrv.service
-
Test Controller Input:
- Graphical Tool: Install a joystick testing utility like
jstest-gtk
(e.g.,sudo apt install jstest-gtk
orsudo pacman -S jstest-gtk
). Launchjstest-gtk
and look for a device typically named "Microsoft X-Box 360 pad" (or similar). Select it and test all buttons and axes. Your original "Wireless Controller" (DualShock 4) device should ideally no longer show input when you press buttons, asevsieve
has successfully grabbed it. - In-Game Testing: Launch any game that supports Xbox 360 controllers and verify that your DualShock 4 is now recognized and functions correctly.
- Graphical Tool: Install a joystick testing utility like
To remove all installed files and configurations, run the uninstall.sh
script with sudo
:
- Make uninstaller executable:
chmod +x uninstall.sh
- Run the uninstaller script:
This script will stop and disable the systemd service, and remove the installed files. It will not uninstall
sudo ./uninstall.sh
xboxdrv
orevsieve
packages themselves. Instructions for manual removal of those packages will be provided by the uninstaller.
If you encounter issues, always start by checking the service logs: journalctl -fu ds4-xboxdrv.service
. Look for error messages related to device grabbing, permissions, or xboxdrv
/evsieve
startup.
If your PlayStation controller (e.g., a newer DualSense model not yet included) is not being detected or mapped, you might need to add its Vendor ID (VID) and Product ID (PID) to the 99-ds4-xboxdrv.rules
file and the ds4-xboxdrv.sh
script.
To find your device's Vendor ID and Product ID:
- Plug in your controller.
- Open a terminal and run the following command:
cat /proc/bus/input/devices
- Look for a section related to your controller. It usually has
Name="Sony Interactive Entertainment Wireless Controller"
or similar. Identify the line starting withI:
followed byBus=
,Vendor=
,Product=
, andVersion=
. Example:I: Bus=0005 Vendor=054c Product=0ce6 Version=0100
In this example:Vendor=054c
(This is theidVendor
)Product=0ce6
(This is theidProduct
)
If you find your device's VID and PID and it's not already in the scripts:
- Locate and send the
99-ds4-xboxdrv.rules
file: This file is in/etc/udev/rules.d/99-ds4-xboxdrv.rules
after installation, or in your project directory. - Locate and send the
ds4-xboxdrv.sh
script: This file is in/usr/local/bin/ds4-xboxdrv.sh
after installation, or in your project directory. - Provide the
idVendor
andidProduct
you found. - Describe the issue you're facing (e.g., "controller not detected", "buttons not working").
Please share this information with Gemini (the AI assistant) or Niku (@Niku200 on X) so the scripts can be updated to support more devices!
This solution was made possible with the help of:
- Niku (@Niku200 on X): For conceiving and testing the core solution[cite: 57].
- Gemini (AI Assistant): For assistance in scripting, debugging, and preparing documentation[cite: 57].
This project is open-source and available under the MIT License.