VERY experimental Nintendo Switch 2 emulator
C++
[cmake, dist] Update udev rule to act on all joysticks, and add install option (#3968)
crueterca6bb3ae1d28
diff --git a/CMakeLists.txt b/CMakeLists.txtindex 32e873f009..cbb4a25a2d 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -190,8 +190,7 @@ if(MSVC)$<$<COMPILE_LANGUAGE:C,CXX>:$<$<CONFIG:Debug>:/${libflag}d>>$<$<COMPILE_LANGUAGE:C,CXX>:$<$<CONFIG:Release>:/${libflag}>>$<$<COMPILE_LANGUAGE:C,CXX>:$<$<CONFIG:RelWithDebInfo>:/${libflag}>>- $<$<COMPILE_LANGUAGE:C,CXX>:$<$<CONFIG:MinSizeRel>:/${libflag}>>- )+ $<$<COMPILE_LANGUAGE:C,CXX>:$<$<CONFIG:MinSizeRel>:/${libflag}>>)endif()# TODO(crueter): Cleanup, each dep that has a bundled option should allow to choose between bundled, external, system@@ -230,6 +229,10 @@ cmake_dependent_option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFFoption(YUZU_TESTS "Compile tests" "${BUILD_TESTING}")+# Install udev rules on Linux (mainly for gyros)+# Only acts on joysticks and nothing else.+cmake_dependent_option(YUZU_INSTALL_UDEV_RULES "Install udev rules for gyro access" OFF "PLATFORM_LINUX" OFF)+option(YUZU_DOWNLOAD_ANDROID_VVL "Download validation layer binary for android" ON)option(YUZU_LEGACY "Apply patches that improve compatibility with older GPUs (e.g. Snapdragon 865) at the cost of performance" OFF)@@ -730,6 +733,8 @@ endif()# https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html# https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html# https://www.freedesktop.org/software/appstream/docs/++# TODO: Icon/install handling n such should be put into dist/CMakeLists.txtif(ENABLE_QT AND UNIX AND NOT APPLE)install(FILES "dist/dev.eden_emu.eden.desktop"DESTINATION "share/applications")@@ -742,3 +747,10 @@ if(ENABLE_QT AND UNIX AND NOT APPLE)install(FILES "dist/dev.eden_emu.eden.metainfo.xml"DESTINATION "share/metainfo")endif()++if (YUZU_INSTALL_UDEV_RULES)+ include(GNUInstallDirs)++ install(FILES "dist/72-eden-input.rules"+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/udev/rules.d")+endif()diff --git a/dist/72-eden-input.rules b/dist/72-eden-input.rulesnew file mode 100644index 0000000000..b84ed200a3--- /dev/null+++ b/dist/72-eden-input.rules@@ -0,0 +1,8 @@+# SPDX-FileCopyrightText: 2023 yuzu Emulator Project+# SPDX-License-Identifier: GPL-2.0-or-later++# Allow systemd-logind to manage user access to hidraw with this file+# On most systems, this file should be installed to /etc/udev/rules.d/72-eden-input.rules+# Consult your distro if this is not the case++KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ENV{ID_INPUT_JOYSTICK}=="1", MODE="0660", TAG+="uaccess"diff --git a/dist/72-yuzu-input.rules b/dist/72-yuzu-input.rulesdeleted file mode 100644index d64f8b28d7..0000000000--- a/dist/72-yuzu-input.rules+++ /dev/null@@ -1,19 +0,0 @@-# SPDX-FileCopyrightText: 2023 yuzu Emulator Project-# SPDX-License-Identifier: GPL-2.0-or-later--# Allow systemd-logind to manage user access to hidraw with this file-# On most systems, this file should be installed to /etc/udev/rules.d/72-yuzu-input.rules-# Consult your distro if this is not the case--# Switch Pro Controller (USB/Bluetooth)-KERNEL=="hidraw*", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="2009", MODE="0660", TAG+="uaccess"-KERNEL=="hidraw*", KERNELS=="*057e:2009*", MODE="0660", TAG+="uaccess"--# Joy-Con L (Bluetooth)-KERNEL=="hidraw*", KERNELS=="*057e:2006*", MODE="0660", TAG+="uaccess"--# Joy-Con R (Bluetooth)-KERNEL=="hidraw*", KERNELS=="*057e:2007*", MODE="0660", TAG+="uaccess"--# Joy-Con Charging Grip (USB)-KERNEL=="hidraw*", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="200e", MODE="0660", TAG+="uaccess"diff --git a/docs/Options.md b/docs/Options.mdindex 3eb6effe92..adf8127d41 100644--- a/docs/Options.md+++ b/docs/Options.md@@ -44,6 +44,9 @@ These options control dependencies.- UNIX may be better off appending `-flto=thin` to compiler args- `USE_FASTER_LINKER` (OFF) Check if a faster linker is available- Not recommended outside of Linux+- `YUZU_INSTALL_UDEV_RULES` (OFF) Install udev rules to enable hidraw access+ - Needed for gyroscopes+ - Only available on Linux### Flavors