summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@gentoo.org>2020-10-31 21:56:53 +0000
committerJames Le Cuirot <chewi@gentoo.org>2020-10-31 21:56:53 +0000
commitd701134d275f0273076a897ad6df9429efc4d3bf (patch)
tree43c001a0f9fd7da830284f49edb583c55d0366d8 /games-util/game-device-udev-rules
parentprofiles/package.mask: mask only the affected version of opentmpfiles (diff)
downloadgentoo-d701134d275f0273076a897ad6df9429efc4d3bf.tar.gz
gentoo-d701134d275f0273076a897ad6df9429efc4d3bf.tar.bz2
gentoo-d701134d275f0273076a897ad6df9429efc4d3bf.zip
games-util/game-device-udev-rules: New package
Package-Manager: Portage-3.0.8, Repoman-3.0.1 Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Diffstat (limited to 'games-util/game-device-udev-rules')
-rw-r--r--games-util/game-device-udev-rules/Manifest1
-rw-r--r--games-util/game-device-udev-rules/files/60-game-input-20201025.rules3
-rw-r--r--games-util/game-device-udev-rules/game-device-udev-rules-20201025.ebuild80
-rw-r--r--games-util/game-device-udev-rules/metadata.xml12
4 files changed, 96 insertions, 0 deletions
diff --git a/games-util/game-device-udev-rules/Manifest b/games-util/game-device-udev-rules/Manifest
new file mode 100644
index 000000000000..bb0a4866ef7c
--- /dev/null
+++ b/games-util/game-device-udev-rules/Manifest
@@ -0,0 +1 @@
+DIST steam-devices-46bd9ae69542577c0db44a4bd664585c03eaad9d.tar.gz 2104 BLAKE2B 82a62fbe12ed7474234376d2fc66b99985b828954a1c861db1ba03cb2d10344bdfc2c0c3755278b2a4e0086f5b4ddef211412316d1c7fc68beaffd42f9ace3d2 SHA512 55db08aa8f48d21b67ce7850b80629fd70761104b04e260188ff7e6c7267827e2756b7feed937a647711342616649fe638efe9f8b3a6f898a5c8dd557683d76f
diff --git a/games-util/game-device-udev-rules/files/60-game-input-20201025.rules b/games-util/game-device-udev-rules/files/60-game-input-20201025.rules
new file mode 100644
index 000000000000..04a6ce41f4a6
--- /dev/null
+++ b/games-util/game-device-udev-rules/files/60-game-input-20201025.rules
@@ -0,0 +1,3 @@
+
+# Thrustmaster T-Wireless
+KERNEL=="hidraw*", ATTRS{idVendor}=="044f", ATTRS{idProduct}=="d007", TAG+="uaccess"
diff --git a/games-util/game-device-udev-rules/game-device-udev-rules-20201025.ebuild b/games-util/game-device-udev-rules/game-device-udev-rules-20201025.ebuild
new file mode 100644
index 000000000000..79f0a6401254
--- /dev/null
+++ b/games-util/game-device-udev-rules/game-device-udev-rules-20201025.ebuild
@@ -0,0 +1,80 @@
+# Copyright 2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit udev
+
+# Although this is mainly a tweaked version of Steam's udev rules, it
+# also has its own rules and more may be added later so we version it
+# independently.
+
+STEAM_COMMIT="46bd9ae69542577c0db44a4bd664585c03eaad9d"
+MY_P="steam-devices-${STEAM_COMMIT}"
+
+DESCRIPTION="udev rules for various game hardware devices"
+HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Games"
+SRC_URI="https://github.com/ValveSoftware/steam-devices/archive/${STEAM_COMMIT}.tar.gz -> ${MY_P}.tar.gz"
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="+acl elogind systemd"
+REQUIRED_USE="acl? ( || ( elogind systemd ) )"
+
+RDEPEND="
+ acl? (
+ elogind? ( sys-auth/elogind[acl] )
+ systemd? ( sys-apps/systemd[acl] )
+ )
+ !acl? (
+ acct-group/input
+ )
+ virtual/udev
+"
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_setup() {
+ if ! use acl; then
+ elog "Users of game hardware devices must be added to the input group."
+
+ if use elogind || use systemd; then
+ ewarn "It is highly recommended that you enable USE=acl on this package instead"
+ ewarn "when using elogind or systemd as this is more secure and just works."
+ fi
+ fi
+}
+
+src_prepare() {
+ default
+
+ local SRC DEST EXTRA
+ for SRC in 60-steam-{input,vr}.rules; do
+ DEST=${SRC//steam/game}
+ EXTRA=${FILESDIR}/${DEST/./-${PV}.}
+
+ # Make changes in a copy.
+ cp -v "${SRC}" "${DEST}" || die
+
+ # Append our additional rules.
+ if [[ -f ${EXTRA} ]]; then
+ cat "${EXTRA}" >> "${DEST}" || die
+ fi
+
+ # Clear any existing mode settings.
+ sed -i 's/, *MODE="[0-9]*"//' "${DEST}" || die
+
+ if ! use acl; then
+ # Replace uaccess tag with our group+mode if not using ACL.
+ sed -i 's/, *TAG+="uaccess"/, GROUP="input", MODE="0660"/' "${DEST}" || die
+ fi
+ done
+}
+
+src_install() {
+ udev_dorules 60-game-{input,vr}.rules
+}
+
+pkg_postinst() {
+ udev_reload
+}
diff --git a/games-util/game-device-udev-rules/metadata.xml b/games-util/game-device-udev-rules/metadata.xml
new file mode 100644
index 000000000000..9a8e14a39d4a
--- /dev/null
+++ b/games-util/game-device-udev-rules/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>chewi@gentoo.org</email>
+ <name>James Le Cuirot</name>
+ </maintainer>
+ <maintainer type="project">
+ <email>games@gentoo.org</email>
+ <name>Gentoo Games Project</name>
+ </maintainer>
+</pkgmetadata>