games-util/xone: add 0.3_p20240425

Signed-off-by: SigHunter <sighunter@gmx.de>
This commit is contained in:
SigHunter 2024-10-05 00:30:48 +02:00
parent 5d478711eb
commit 4d5ddd599b
No known key found for this signature in database
GPG Key ID: E6359D3AA1AA2397
4 changed files with 262 additions and 0 deletions

View File

@ -1,3 +1,4 @@
DIST xone-0.3_p20230517.tar.gz 50602 BLAKE2B b1427d7eb31934765b250e82f1e3859bab1ef3ea4ad2d79d94b9531130bb49a95a31ee95a5353b369df1d0ff363d3128c0740db64cc4dd3650e675fb116bdc3f SHA512 78cd605a5d56c8230e8800dd43f9f423da52d896625242669480211a4105bbce3364669b742f678b6b48ecd3bc42ad2982d46fe0c6e99ec8e05b69a47c5c88ab DIST xone-0.3_p20230517.tar.gz 50602 BLAKE2B b1427d7eb31934765b250e82f1e3859bab1ef3ea4ad2d79d94b9531130bb49a95a31ee95a5353b369df1d0ff363d3128c0740db64cc4dd3650e675fb116bdc3f SHA512 78cd605a5d56c8230e8800dd43f9f423da52d896625242669480211a4105bbce3364669b742f678b6b48ecd3bc42ad2982d46fe0c6e99ec8e05b69a47c5c88ab
DIST xone-0.3_p20240226.tar.gz 56920 BLAKE2B 4f5ac1125d4bac37315160a1ed4fed2daf1e07e245e2e34c4aedb01459a7e8111c19500e41b491a5a3738cf4952852414bed4c014904068049437af67321d657 SHA512 a9d30ab9391e4d69d4cec12af801f220bb950b78e1e6a1487a4946600707a220596cc96617ae7033f7e740492b0edf82279aa503ce34c2bacf1170c7d126ab38 DIST xone-0.3_p20240226.tar.gz 56920 BLAKE2B 4f5ac1125d4bac37315160a1ed4fed2daf1e07e245e2e34c4aedb01459a7e8111c19500e41b491a5a3738cf4952852414bed4c014904068049437af67321d657 SHA512 a9d30ab9391e4d69d4cec12af801f220bb950b78e1e6a1487a4946600707a220596cc96617ae7033f7e740492b0edf82279aa503ce34c2bacf1170c7d126ab38
DIST xone-0.3_p20240425.tar.gz 62680 BLAKE2B c4a7a0fa3eb2f53e9213413bca809824f24f8b273093dc65b57b3d3729f1c2805f1477f686d143975cb8f17248a7abed35ae303236cdd7ba4912fec66261efea SHA512 b195b413b41a026a1e802d332b0365b433847176f876cd765368fa7c17b0d4d3c18608697351ecd47381110d4bc62af87de53dcd385ffc8758910bae9761152d
DIST xone-driver-201707-1cd6a87c-623f-4407-a52d-c31be49e925c_e19f60808bdcbfbd3c3df6be3e71ffc52e43261e.cab 199891 BLAKE2B f531a9f4b8220ee4501431b308ee6e29a8dea26467020df25b7fa22228543cc560e1170d13b1cb3490c64c48bf610e3fb7ddfb743e4a2028f5980e02d0c36790 SHA512 0906debd6c1f4706348ec1b1cbf233ea2c45bbc0b8882593740964036808722f5bb701f43da803320609e02072cd16dada572d337fd4c05cc1cf6dde6fd38908 DIST xone-driver-201707-1cd6a87c-623f-4407-a52d-c31be49e925c_e19f60808bdcbfbd3c3df6be3e71ffc52e43261e.cab 199891 BLAKE2B f531a9f4b8220ee4501431b308ee6e29a8dea26467020df25b7fa22228543cc560e1170d13b1cb3490c64c48bf610e3fb7ddfb743e4a2028f5980e02d0c36790 SHA512 0906debd6c1f4706348ec1b1cbf233ea2c45bbc0b8882593740964036808722f5bb701f43da803320609e02072cd16dada572d337fd4c05cc1cf6dde6fd38908

View File

@ -0,0 +1,26 @@
From 28df566c38e0ee500fd5f74643fc35f21a4ff696 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Torleif=20Sk=C3=A5r?=
<16509259+tskaar@users.noreply.github.com>
Date: Tue, 30 Jul 2024 22:35:25 +0200
Subject: [PATCH] fix: build on kernel v6.11
---
bus/bus.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/bus/bus.c b/bus/bus.c
index 4a6c64f..8dc9bbb 100644
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -56,7 +56,11 @@ static struct device_type gip_client_type = {
.release = gip_client_release,
};
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0)
static int gip_bus_match(struct device *dev, struct device_driver *driver)
+#else
+static int gip_bus_match(struct device *dev, const struct device_driver *driver)
+#endif
{
struct gip_client *client;
struct gip_driver *drv;

View File

@ -0,0 +1,163 @@
From 3463d0e2335998c1b94bb1605dc7a6668d4ba262 Mon Sep 17 00:00:00 2001
From: Daniel Lundqvist <daniel@malarhojden.nu>
Date: Thu, 20 Apr 2023 17:12:54 +0200
Subject: [PATCH 1/2] Revert "Remove dongle pairing sysfs attribute"
This reverts commit 304da811e94081156376a8e10ff5eee5876c6e41.
---
README.md | 18 ++++++++++++++++-
transport/dongle.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 8e7c9f1..05181f1 100644
--- a/README.md
+++ b/README.md
@@ -111,7 +111,9 @@ Xbox devices have to be paired to the wireless dongle. They will not automatical
Instructions for pairing your devices can be found [here](https://support.xbox.com/en-US/help/hardware-network/controller/connect-xbox-wireless-controller-to-pc) (see the section on *Xbox Wireless*).
-## LED control
+## Kernel interface
+
+### LED control
The guide button LED can be controlled via `sysfs`:
@@ -129,6 +131,20 @@ ACTION=="add", SUBSYSTEM=="leds", KERNEL=="gip*", ATTR{mode}="2", ATTR{brightnes
Replace the wildcard (`gip*`) if you want to control the LED of a specific device.
The modes and the maximum brightness can vary from device to device.
+### Pairing mode
+
+The pairing mode of the dongle can be queried via `sysfs`:
+
+```
+cat /sys/bus/usb/drivers/xone-dongle/*/pairing
+```
+
+You can enable (`1`) or disable (`0`) the pairing using the following command:
+
+```
+echo 1 | sudo tee /sys/bus/usb/drivers/xone-dongle/*/pairing
+```
+
## Troubleshooting
Uninstall the release version and install a debug build of `xone` (see installation guide).
diff --git a/transport/dongle.c b/transport/dongle.c
index aa58ac2..5eb6f9c 100644
--- a/transport/dongle.c
+++ b/transport/dongle.c
@@ -8,6 +8,7 @@
#include <linux/bitfield.h>
#include <linux/version.h>
#include <linux/usb.h>
+#include <linux/sysfs.h>
#include <linux/ieee80211.h>
#include <net/cfg80211.h>
@@ -262,6 +263,47 @@ static void xone_dongle_pairing_timeout(struct work_struct *work)
__func__, err);
}
+static ssize_t xone_dongle_pairing_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct usb_interface *intf = to_usb_interface(dev);
+ struct xone_dongle *dongle = usb_get_intfdata(intf);
+
+ return sprintf(buf, "%d\n", dongle->pairing);
+}
+
+static ssize_t xone_dongle_pairing_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct usb_interface *intf = to_usb_interface(dev);
+ struct xone_dongle *dongle = usb_get_intfdata(intf);
+ bool enable;
+ int err;
+
+ err = kstrtobool(buf, &enable);
+ if (err)
+ return err;
+
+ err = xone_dongle_toggle_pairing(dongle, enable);
+ if (err)
+ return err;
+
+ return count;
+}
+
+static struct device_attribute xone_dongle_attr_pairing =
+ __ATTR(pairing, 0644,
+ xone_dongle_pairing_show,
+ xone_dongle_pairing_store);
+
+static struct attribute *xone_dongle_attrs[] = {
+ &xone_dongle_attr_pairing.attr,
+ NULL,
+};
+ATTRIBUTE_GROUPS(xone_dongle);
+
static struct xone_dongle_client *
xone_dongle_create_client(struct xone_dongle *dongle, u8 *addr)
{
@@ -942,6 +984,12 @@ static int xone_dongle_probe(struct usb_interface *intf,
usb_set_intfdata(intf, dongle);
+ err = device_add_groups(&intf->dev, xone_dongle_groups);
+ if (err) {
+ xone_dongle_destroy(dongle);
+ return err;
+ }
+
/* enable USB remote wakeup and autosuspend */
intf->needs_remote_wakeup = true;
device_wakeup_enable(&dongle->mt.udev->dev);
@@ -957,6 +1005,8 @@ static void xone_dongle_disconnect(struct usb_interface *intf)
struct xone_dongle *dongle = usb_get_intfdata(intf);
int err;
+ device_remove_groups(&intf->dev, xone_dongle_groups);
+
/* can fail during USB device removal */
err = xone_dongle_power_off_clients(dongle);
if (err)
From 810bdccb08cbebd610de76a4da210e02920c535b Mon Sep 17 00:00:00 2001
From: Daniel Lundqvist <daniel@malarhojden.nu>
Date: Fri, 19 May 2023 16:13:30 +0200
Subject: [PATCH 2/2] usb: Resume adapter before trying to enable pairing via
sysfs
If device is suspended, enabling pairing will fail. Make sure device
is resumed before trying.
---
transport/dongle.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/transport/dongle.c b/transport/dongle.c
index 5eb6f9c..243bf02 100644
--- a/transport/dongle.c
+++ b/transport/dongle.c
@@ -286,10 +286,16 @@ static ssize_t xone_dongle_pairing_store(struct device *dev,
if (err)
return err;
+ err = pm_runtime_resume_and_get(dev);
+ if (err)
+ return err;
+
err = xone_dongle_toggle_pairing(dongle, enable);
if (err)
return err;
+ pm_runtime_put(dev);
+
return count;
}

View File

@ -0,0 +1,72 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit linux-mod-r1
COMMIT="29ec3577e52a50f876440c81267f609575c5161e"
XONE_DRIVER_VERSION="201707-1cd6a87c-623f-4407-a52d-c31be49e925c_e19f60808bdcbfbd3c3df6be3e71ffc52e43261e"
DESCRIPTION="Linux kernel driver for Xbox One and Xbox Series X|S accessories"
HOMEPAGE="https://github.com/medusalix/xone"
SRC_URI="
mirror+https://github.com/medusalix/xone/archive/${COMMIT}.tar.gz -> ${P}.tar.gz
http://download.windowsupdate.com/c/msdownload/update/driver/drvs/${XONE_DRIVER_VERSION:0:4}/${XONE_DRIVER_VERSION:4:2}/${XONE_DRIVER_VERSION:7}.cab
-> ${PN}-driver-${XONE_DRIVER_VERSION}.cab
"
S="${WORKDIR}/${PN}-${COMMIT}"
LICENSE="GPL-2 MS-TOU"
SLOT="0"
KEYWORDS="~amd64"
RESTRICT="bindist mirror test"
BDEPEND="app-arch/cabextract"
CONFIG_CHECK="SND CFG80211 INPUT_FF_MEMLESS USB POWER_SUPPLY LEDS_CLASS HID"
MODULES_KERNEL_MIN=5.11
PATCHES=(
"${FILESDIR}/${PN}-0.3_p20240425-kernel_6.11.patch"
"${FILESDIR}/${PN}-0.3_p20240425-sysfs_pairing.patch"
)
src_unpack() {
unpack ${P}.tar.gz
cabextract -F FW_ACC_00U.bin -d "${S}" "${DISTDIR}/${PN}-driver-${XONE_DRIVER_VERSION}.cab" > /dev/null \
|| die "Failed to unpack driver"
}
src_prepare() {
cp "${FILESDIR}/Makefile" "${S}" || die
default
}
src_compile() {
local modlist=(
xone-wired=kernel/drivers/input/joystick
xone-dongle=kernel/drivers/input/joystick
xone-gip=kernel/drivers/input/joystick
xone-gip-gamepad=kernel/drivers/input/joystick
xone-gip-headset=kernel/drivers/input/joystick
xone-gip-chatpad=kernel/drivers/input/joystick
xone-gip-madcatz-strat=kernel/drivers/input/joystick
)
linux-mod-r1_src_compile
}
src_install() {
linux-mod-r1_src_install
einfo "Installing module blacklist"
insinto /etc/modprobe.d/
newins "${S}"/install/modprobe.conf xone-blacklist.conf
einfo "Installing Microsoft binary firmware"
insinto /lib/firmware/
newins "${S}"/FW_ACC_00U.bin xow_dongle.bin
}