Skip to content

Commit 82b2bea

Browse files
committed
Include udev/devd rules in Linux/FreeBSD install
This allows RPCS3 to communicate with Dualshock 3,4 and DualSense controller out of the box on Linux distributions and FreeBSD, without the need for manual actions.
1 parent 1cae72c commit 82b2bea

File tree

4 files changed

+87
-0
lines changed

4 files changed

+87
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ option(USE_LTO "Use LTO for building" ON)
6363
option(BUILD_RPCS3_TESTS "Build RPCS3 unit tests." OFF)
6464
option(RUN_RPCS3_TESTS "Run RPCS3 unit tests. Requires BUILD_RPCS3_TESTS" OFF)
6565
option(USE_GAMEMODE "Choose whether to enable GameMode features or not." ON)
66+
option(BUNDLE_UDEV_RULES "Include udev rules on Linux/FreeBSD" OFF)
6667

6768
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/buildfiles/cmake")
6869

config/udev/devd.conf

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# DualShock 3
2+
notify 100 {
3+
match "system" "USB";
4+
match "subsystem" "INTERFACE";
5+
match "type" "ATTACH";
6+
match "vendor" "0x054c";
7+
match "product" "0x0268";
8+
action "chmod 0666 /dev/$cdev";
9+
};
10+
11+
# DualShock 4
12+
notify 100 {
13+
match "system" "USB";
14+
match "subsystem" "INTERFACE";
15+
match "type" "ATTACH";
16+
match "vendor" "0x054c";
17+
match "product" "0x05c4";
18+
action "chmod 0666 /dev/$cdev";
19+
};
20+
21+
# DualShock 4 Wireless Adapter
22+
notify 100 {
23+
match "system" "USB";
24+
match "subsystem" "INTERFACE";
25+
match "type" "ATTACH";
26+
match "vendor" "0x054c";
27+
match "product" "0x0ba0";
28+
action "chmod 0666 /dev/$cdev";
29+
};
30+
31+
# DualShock 4 Slim
32+
notify 100 {
33+
match "system" "USB";
34+
match "subsystem" "INTERFACE";
35+
match "type" "ATTACH";
36+
match "vendor" "0x054c";
37+
match "product" "0x09cc";
38+
action "chmod 0666 /dev/$cdev";
39+
};
40+
41+
# DualSense
42+
notify 100 {
43+
match "system" "USB";
44+
match "subsystem" "INTERFACE";
45+
match "type" "ATTACH";
46+
match "vendor" "0x054c";
47+
match "product" "0x0ce6";
48+
action "chmod 0666 /dev/$cdev";
49+
};

config/udev/udev.rules

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# DualShock 3 over USB
2+
KERNEL=="hidraw*", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="0268", MODE="0666"
3+
4+
# DualShock 3 over Bluetooth
5+
KERNEL=="hidraw*", KERNELS=="*054C:0268*", MODE="0666"
6+
7+
# DualShock 4 over USB
8+
KERNEL=="hidraw*", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="05c4", MODE="0666"
9+
10+
# DualShock 4 Wireless Adapter over USB
11+
KERNEL=="hidraw*", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="0ba0", MODE="0666"
12+
13+
# DualShock 4 Slim over USB
14+
KERNEL=="hidraw*", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="09cc", MODE="0666"
15+
16+
# DualShock 4 over Bluetooth
17+
KERNEL=="hidraw*", KERNELS=="*054C:05C4*", MODE="0666"
18+
19+
# DualShock 4 Slim over Bluetooth
20+
KERNEL=="hidraw*", KERNELS=="*054C:09CC*", MODE="0666"
21+
22+
# PS5 DualSense controller over USB hidraw
23+
KERNEL=="hidraw*", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="0ce6", MODE="0666", TAG+="uaccess"
24+
25+
# PS5 DualSense controller over bluetooth hidraw
26+
KERNEL=="hidraw*", KERNELS=="*054C:0CE6*", MODE="0666", TAG+="uaccess"

rpcs3/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,14 @@ if(BUILD_RPCS3_TESTS)
226226
)
227227
endif()
228228
endif()
229+
230+
# Udev rules, per platform
231+
if (BUNDLE_UDEV_RULES)
232+
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
233+
install(FILES ../config/udev/udev.rules
234+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/udev/rules.d/ RENAME 99-rpcs3.rules)
235+
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
236+
install(FILES ../config/udev/devd.conf
237+
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/devd/ RENAME rpcs3.conf)
238+
endif()
239+
endif()

0 commit comments

Comments
 (0)